The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: Add explicit error message to Bedrock error output. (#17328)
T Cramer540ebf35a9b8
diff --git a/libs/community/langchain_community/document_loaders/pdf.py b/libs/community/langchain_community/document_loaders/pdf.pyindex d4a636c69b..fc49be4e25 100644--- a/libs/community/langchain_community/document_loaders/pdf.py+++ b/libs/community/langchain_community/document_loaders/pdf.py@@ -670,7 +670,7 @@ class AmazonTextractPDFLoader(BasePDFLoader):raise ValueError("Could not load credentials to authenticate with AWS client. ""Please check that credentials in the specified "- "profile name are valid."+ f"profile name are valid. {e}") from eself.parser = AmazonTextractPDFParser(textract_features=features,diff --git a/libs/community/langchain_community/embeddings/bedrock.py b/libs/community/langchain_community/embeddings/bedrock.pyindex 7ab94df4dc..3cfa977fd9 100644--- a/libs/community/langchain_community/embeddings/bedrock.py+++ b/libs/community/langchain_community/embeddings/bedrock.py@@ -107,7 +107,7 @@ class BedrockEmbeddings(BaseModel, Embeddings):raise ValueError("Could not load credentials to authenticate with AWS client. ""Please check that credentials in the specified "- "profile name are valid."+ f"profile name are valid. Bedrock error: {e}") from ereturn valuesdiff --git a/libs/community/langchain_community/embeddings/sagemaker_endpoint.py b/libs/community/langchain_community/embeddings/sagemaker_endpoint.pyindex 4e906133f7..1f01e1ecf4 100644--- a/libs/community/langchain_community/embeddings/sagemaker_endpoint.py+++ b/libs/community/langchain_community/embeddings/sagemaker_endpoint.py@@ -142,7 +142,7 @@ class SagemakerEndpointEmbeddings(BaseModel, Embeddings):raise ValueError("Could not load credentials to authenticate with AWS client. ""Please check that credentials in the specified "- "profile name are valid."+ f"profile name are valid. {e}") from eexcept ImportError:diff --git a/libs/community/langchain_community/llms/bedrock.py b/libs/community/langchain_community/llms/bedrock.pyindex 8ab5ad276e..203110f87b 100644--- a/libs/community/langchain_community/llms/bedrock.py+++ b/libs/community/langchain_community/llms/bedrock.py@@ -427,11 +427,13 @@ class BedrockBase(BaseModel, ABC):"Could not import boto3 python package. ""Please install it with `pip install boto3`.")+ except ValueError as e:+ raise ValueError(f"Error raised by bedrock service: {e}")except Exception as e:raise ValueError("Could not load credentials to authenticate with AWS client. ""Please check that credentials in the specified "- "profile name are valid."+ f"profile name are valid. Bedrock error: {e}") from ereturn valuesdiff --git a/libs/experimental/langchain_experimental/comprehend_moderation/amazon_comprehend_moderation.py b/libs/experimental/langchain_experimental/comprehend_moderation/amazon_comprehend_moderation.pyindex 3298f2843f..197d789e32 100644--- a/libs/experimental/langchain_experimental/comprehend_moderation/amazon_comprehend_moderation.py+++ b/libs/experimental/langchain_experimental/comprehend_moderation/amazon_comprehend_moderation.py@@ -109,7 +109,7 @@ class AmazonComprehendModerationChain(Chain):raise ValueError("Could not load credentials to authenticate with AWS client. ""Please check that credentials in the specified "- "profile name are valid."+ f"profile name are valid. {e}") from e@property