langchain-ai / langchain

🦜🔗 Build context-aware reasoning applications
https://python.langchain.com
MIT License
93.69k stars 15.11k forks source link

AmazonKendraRetriever "Could not load credentials" error in latest release #7571

Closed sean-beath closed 1 year ago

sean-beath commented 1 year ago

System Info

LangChain version: 0.0.229 Platform: AWS Lambda execution Python version: 3.9

I get the following error when creating the AmazonKendraRetriever using LangChain version 0.0.229. Code to create retriever: retriever = AmazonKendraRetriever(index_id=kendra_index)

Error:


__root__
  Could not load credentials to authenticate with AWS client. Please check that credentials in the specified profile name are valid. (type=value_error)
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 171, in lambda_handler
    retriever = AmazonKendraRetriever(index_id=kendra_index)
  File "/opt/python/langchain/load/serializable.py", line 74, in __init__
    super().__init__(**kwargs)
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__```

When using LangChain version 0.0.219 this error does not occur.

Issue also raised on aws-samples git repo with potential solution: https://github.com/aws-samples/amazon-kendra-langchain-extensions/issues/24 

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

1. Install latest version of Langchain
2. Follow instructions here: https://python.langchain.com/docs/modules/data_connection/retrievers/integrations/amazon_kendra_retriever

### Expected behavior

Error not thrown when creating AmazonKendraRetriever
baskaryan commented 1 year ago

cc @3coins