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.

已提問 4 個月前檢視次數 299 次
1 個回答
1
已接受的答案

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
專家
已回答 4 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南