generative-ai-on-aws-immersion-day
generative-ai-on-aws-immersion-day copied to clipboard
Lab 4 - Lambda fails to call Kendra
Getting Internal Server errors
Checking the Lambda function logs, it looks like Lambda can't call Kendra. Kendra index is populated with the docs and I verified Lambda has the correct index id.
[ERROR] KeyError: 'client'
Traceback (most recent call last):
File "/var/task/rag_app.py", line 85, in lambda_handler
retriever = AmazonKendraRetriever(
File "/var/task/langchain/load/serializable.py", line 74, in __init__
super().__init__(**kwargs)
File "pydantic/main.py", line 339, in pydantic.main.BaseModel.__init__
values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data)
File "pydantic/main.py", line 1050, in pydantic.main.validate_model
input_data = validator(cls_, input_data)
File "/var/task/langchain/retrievers/kendra.py", line 191, in create_client
if values["client"] is not None:
Hey @mmeidlinger
The lambda should have environment variable set with the Kendra index id in KENDRA_INDEX_ID
, along with SM_ENDPOINT_NAME
, and SM_MODEL_TYPE
You can set them in the CF template, and run sam build
, sam deploy
or go to the lambda environment variable configuration, and edit it there.
I did set these, I don't think this is a config issue:
Can you please pull latest changes, build and update the Lambda. We are now using Langchain for using Kendra retrieve API