Skip to content

Can we create an agent with an action group to perform custom retrievals on a KB? If not, can we do it on OpenSearch or define a custom RAG flow using either of them?

0

We want to create an agent in Amazon Bedrock and define an action group that can perform custom retrievals.

Can custom retrievals be performed directly on a Knowledge Base (KB)?

If not, can custom retrievals be performed using OpenSearch instead?

Alternatively, is there any other way to implement a custom RAG (Retrieval-Augmented Generation) workflow—either on KB or OpenSearch—where we can define our own retrieval logic?

If none of these options are viable, what are the other options for us

2 Answers
0

Yes, you can create an agent with an action group to perform custom retrievals on a Knowledge Base (KB) in Amazon Bedrock. Here's how you can approach this:

  1. Custom Retrievals on Knowledge Base: You can define a custom retrieval logic for a Knowledge Base by using the Retrieve API or RetrieveAndGenerate API within an action group Lambda function. This allows you to customize the retrieval process, including specifying the number of results, applying filters, and even using different search configurations.

  2. Using OpenSearch: While the sources don't explicitly mention using OpenSearch for custom retrievals with Bedrock Agents, you can potentially integrate OpenSearch into your workflow by creating a custom Lambda function as part of your action group. This function could interact with OpenSearch to perform custom retrievals based on your specific requirements.

  3. Custom RAG Workflow: You can implement a custom RAG workflow using Amazon Bedrock Agents by combining various components:

a. Create an agent with a custom instruction that defines its purpose and capabilities. b. Define an action group with Lambda functions that implement your custom retrieval logic. c. Use the Retrieve or RetrieveAndGenerate API within your Lambda function to interact with the Knowledge Base. d. Implement additional logic in your Lambda function to process and filter the retrieved information as needed. e. Return the processed information to the agent for further reasoning and response generation.

This approach allows you to have fine-grained control over the retrieval process while leveraging the power of Amazon Bedrock Agents for orchestration and reasoning.

  1. Alternative Options: If you need even more flexibility, you could consider building a custom RAG system using Amazon Nova Models. This approach allows you to define your own retriever as a tool and implement custom instructions for your RAG system. However, this would be separate from the Bedrock Agents framework.

In summary, the recommended approach would be to use Amazon Bedrock Agents with custom action groups (Lambda functions) to implement your desired retrieval logic on Knowledge Bases. This provides a good balance of flexibility and integration with the Bedrock ecosystem.
Sources
Bedrock Agent with knowledgebase metadata search | AWS re:Post
Integrate dynamic web content in your generative AI application using a web search API and Amazon Bedrock Agents | AWS Machine Learning Blog
Building a custom RAG system with Amazon Nova - Amazon Nova
Guidance for Agentic Workflow Assistants on AWS

answered 10 months ago
0

The provided response addresses the queries posed. For further reference, please refer to the accompanying documentation. [1] AWS Bedrock User Guide - "Action Groups": https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-bedrock.html [2] AWS Bedrock User Guide - "Lambda input event from Amazon Bedrock": https://docs.aws.amazon.com/bedrock/latest/userguide/agents-lambda.html#agents-lambda-input [3] AWS Bedrock User Guide - "Control agent session context": https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html [4] AWS Bedrock API Reference - "RetrieveAndGenerate": https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html [5] AWS Machine Learning Blog - "Integrate dynamic web content in your generative AI application using a web search API and Amazon Bedrock Agents": https://aws.amazon.com/blogs/machine-learning/integrate-dynamic-web-content-in-your-generative-ai-application-using-a-web-search-api-and-amazon-bedrock-agents/ [6] Amazon Nova Documentation - "Building a custom RAG system with Amazon Nova": https://docs.aws.amazon.com/nova/latest/userguide/rag-building.html

AWS
answered 10 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.