Skip to content

Commit

Permalink
add optmized endpoints support for converse
Browse files Browse the repository at this point in the history
  • Loading branch information
cipher982 committed Dec 19, 2024
1 parent 19e791c commit 0378749
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libs/aws/langchain_aws/chat_models/bedrock_converse.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,16 @@ class Joke(BaseModel):
('auto') if a 'nova' model is used, empty otherwise.
"""

performance_config: Optional[Dict[str, Any]] = Field(
default=None,
description="""Performance configuration settings for latency optimization.
Example:
performance_config={'latency': 'optimized'}
If not provided, defaults to standard latency.
""",
)

model_config = ConfigDict(
extra="forbid",
populate_by_name=True,
Expand Down Expand Up @@ -623,6 +633,7 @@ def _converse_params(
additionalModelRequestFields: Optional[dict] = None,
additionalModelResponseFieldPaths: Optional[List[str]] = None,
guardrailConfig: Optional[dict] = None,
performanceConfig: Optional[Dict[str, Any]] = None,
) -> Dict[str, Any]:
if not inferenceConfig:
inferenceConfig = {
Expand All @@ -645,6 +656,7 @@ def _converse_params(
"additionalModelResponseFieldPaths": additionalModelResponseFieldPaths
or self.additional_model_response_field_paths,
"guardrailConfig": guardrailConfig or self.guardrail_config,
"performanceConfig": performanceConfig or self.performance_config,
}
)

Expand Down

0 comments on commit 0378749

Please sign in to comment.