From 7a478ca2dff58bfff86f43e99d6bc7765cc2f2f0 Mon Sep 17 00:00:00 2001 From: kyoonkwon Date: Thu, 9 Jan 2025 17:59:57 +0900 Subject: [PATCH] Add RequestMetadata field to ChatBedrockConverse --- libs/aws/langchain_aws/chat_models/bedrock_converse.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/aws/langchain_aws/chat_models/bedrock_converse.py b/libs/aws/langchain_aws/chat_models/bedrock_converse.py index 4748d8b6..90d0ed52 100644 --- a/libs/aws/langchain_aws/chat_models/bedrock_converse.py +++ b/libs/aws/langchain_aws/chat_models/bedrock_converse.py @@ -393,6 +393,9 @@ class Joke(BaseModel): ('auto') if a 'nova' model is used, empty otherwise. """ + request_metadata: Optional[Dict[str, str]] = None + """Key-Value pairs that you can use to filter invocation logs.""" + model_config = ConfigDict( extra="forbid", populate_by_name=True, @@ -623,6 +626,7 @@ def _converse_params( additionalModelRequestFields: Optional[dict] = None, additionalModelResponseFieldPaths: Optional[List[str]] = None, guardrailConfig: Optional[dict] = None, + requestMetadata: Optional[dict] = None, ) -> Dict[str, Any]: if not inferenceConfig: inferenceConfig = { @@ -645,6 +649,7 @@ def _converse_params( "additionalModelResponseFieldPaths": additionalModelResponseFieldPaths or self.additional_model_response_field_paths, "guardrailConfig": guardrailConfig or self.guardrail_config, + "requestMetadata": requestMetadata or self.request_metadata, } )