Retrieval Augmentation
Retrieval Augmented Generation (RAG) is a powerful technique that combines language models with external knowledge retrieval to improve the quality and relevance of generated responses.
One way to realize RAG in AutoGen is to construct agent chats with AssistantAgent
and RetrieveUserProxyAgent
classes.
Example Setup: RAG with Retrieval Augmented Agents
The following is an example setup demonstrating how to create retrieval augmented agents in AutoGen:
Step 1. Create an instance of AssistantAgent
and RetrieveUserProxyAgent
.
Here RetrieveUserProxyAgent
instance acts as a proxy agent that retrieves relevant information based on the user’s input.
Refer to the doc for more information on the detailed configurations.
Step 2. Initiating Agent Chat with Retrieval Augmentation
Once the retrieval augmented agents are set up, you can initiate a chat with retrieval augmentation using the following code:
Example Setup: RAG with Retrieval Augmented Agents with PGVector
The following is an example setup demonstrating how to create retrieval augmented agents in AutoGen:
Step 1. Create an instance of AssistantAgent
and RetrieveUserProxyAgent
.
Here RetrieveUserProxyAgent
instance acts as a proxy agent that retrieves relevant information based on the user’s input.
Specify the connection_string, or the host, port, database, username, and password in the db_config.
Step 2. Initiating Agent Chat with Retrieval Augmentation
Once the retrieval augmented agents are set up, you can initiate a chat with retrieval augmentation using the following code:
Online Demo
Retrival-Augmented Chat Demo on Huggingface
More Examples and Notebooks
For more detailed examples and notebooks showcasing the usage of retrieval augmented agents in AutoGen, refer to the following:
- Automated Code Generation and Question Answering with Retrieval Augmented Agents - View Notebook
- Automated Code Generation and Question Answering with PGVector based Retrieval Augmented Agents - View Notebook
- Automated Code Generation and Question Answering with Qdrant based Retrieval Augmented Agents - View Notebook
- Automated Code Generation and Question Answering with MongoDB Atlas based Retrieval Augmented Agents - View Notebook
- Chat with OpenAI Assistant with Retrieval Augmentation - View Notebook
- RAG: Group Chat with Retrieval Augmented Generation (with 5 group member agents and 1 manager agent) - View Notebook
Roadmap
Explore our detailed roadmap here for further advancements plan around RAG. Your contributions, feedback, and use cases are highly appreciated! We invite you to engage with us and play a pivotal role in the development of this impactful feature.