Skip to content

The agent engineering platform.

Fix Bedrock broad error catching (#14398)

JuR-04dab37741ac9
diff --git a/libs/community/langchain_community/llms/bedrock.py b/libs/community/langchain_community/llms/bedrock.py
index 90187100d1..ddc15d5ef1 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)