Amazon Lambda Function for Amazon Lex chatbot using sagemaker and langchain

0

I have created one lambda function name: chatbot-sagemaker. Below is code structure:

chatbot-sagemaker: lambda_function.py requirements.txt


in requirements.txt -

langchain==0.0.161 pydantic==1.10.7 boto3==1.26.91 aws-requests-auth==0.4.3


The error I'm getting :

"errorMessage": "Unable to import module 'lambda_function': No module named 'langchain'", "errorType": "Runtime.ImportModuleError",

How can I solve this or how do I need to install those libraries in AWS lambda function? Please help.

1 Answer
1
Accepted Answer

Hi,

Specifying your dependencies in requirements.txt is not sufficient.

Lambda runtime supplies a limited set of 3rd-party Python packages. You have to add the missing ones by yourself.

Follow this guidance to do it for langchain: https://docs.aws.amazon.com/lambda/latest/dg/python-package.html

Best,

Didier

profile pictureAWS
EXPERT
answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions