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ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ