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 Answer
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
EXPERT
Uri
answered 2 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