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 Antwort
1
Akzeptierte Antwort

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
EXPERTE
beantwortet vor 4 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen