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 réponse
1
Réponse acceptée

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
répondu il y a 4 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions