Bedrock agent lambda function

0

Hi, I am creating a simple project where I have data in an S3 bucket which I want Bedrock agent to query, when a question is asked. The data is in html format and I am using Amazon OpenSearch serverless as a vector database. I have got most of the moving parts in order like I have data in s3 bucket and another bucket with openapi spec. I have created knowledge base and agent using console.

My first task is to test that agent from console. So when I ask a question in agent console, I am hoping the lambda invokes and returns response. I am just not sure how to write the lambda function. Maybe I am thinking it wrong or searching wrong but I just don't seem to find a resolution. How should I structure the lambda function to just accept the event, query s3 (or hopefully vector db) for answer and return to agent console?

Thanks for your guidance in advance.

1 個回答
0

It should not be very different than writing the code in other platforms. You should deploy an API Gateway that will get the request from the console, API Gateway will invoke the Lambda function. In the function you have a handler method that you should use to extract the relevant data from the event object and then invoke some method that reads the data from S3 and invokes the Bedrock API.

profile pictureAWS
專家
Uri
已回答 2 個月前

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

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

回答問題指南