From 4dab37741ac9ccfa8cb3e91add0cc7d16c977bff Mon Sep 17 00:00:00 2001 From: JuR-0 <94719392+JuR-0@users.noreply.github.com> Date: Wed, 3 Jan 2024 02:25:48 +0100 Subject: [PATCH] Fix Bedrock broad error catching (#14398) Fixes #14347 --------- Co-authored-by: Julien Raffy Co-authored-by: Harrison Chase --- libs/community/langchain_community/llms/bedrock.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/community/langchain_community/llms/bedrock.py b/libs/community/langchain_community/llms/bedrock.py index 90187100d15..ddc15d5ef1c 100644 --- a/libs/community/langchain_community/llms/bedrock.py +++ b/libs/community/langchain_community/llms/bedrock.py @@ -277,7 +277,9 @@ class BedrockBase(BaseModel, ABC): text = LLMInputOutputAdapter.prepare_output(provider, response) except Exception as e: - raise ValueError(f"Error raised by bedrock service: {e}") + raise ValueError(f"Error raised by bedrock service: {e}").with_traceback( + e.__traceback__ + ) if stop is not None: text = enforce_stop_tokens(text, stop)