From f84b8df27755348ce425c33de2c513bc0534941b Mon Sep 17 00:00:00 2001 From: ardf Date: Mon, 2 Sep 2024 07:31:38 +0530 Subject: [PATCH] fixes #176 --- libs/aws/langchain_aws/llms/bedrock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/aws/langchain_aws/llms/bedrock.py b/libs/aws/langchain_aws/llms/bedrock.py index 848c7444..e726087b 100644 --- a/libs/aws/langchain_aws/llms/bedrock.py +++ b/libs/aws/langchain_aws/llms/bedrock.py @@ -144,8 +144,8 @@ def _stream_response_to_generation_chunk( return AIMessageChunk( content="", response_metadata={ - "stop_reason": stream_response["delta"]["stop_reason"], - "stop_sequence": stream_response["delta"]["stop_sequence"], + "stop_reason": stream_response["delta"].get("stop_reason"), + "stop_sequence": stream_response["delta"].get("stop_sequence"), }, ) else: