mirror of
https://github.com/microsoft/autogen.git
synced 2025-12-27 15:09:41 +00:00
Update AgentChat Docs for RAGAgent / Teachability (#5935)
<!-- Thank you for your contribution! Please review https://microsoft.github.io/autogen/docs/Contribute before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <img width="1151" alt="image" src="https://github.com/user-attachments/assets/98bc91ee-749c-4831-b36f-10322979883b" /> - Update migration guide to cover teachability/rag agents (mention how similar functionality can be accomplished with AssistantAgent + Memory) - Update memory docs to explicitly add a text chunking example and a rag agent <!-- Please give a short summary of the change and the problem this solves. --> ## Related issue number <!-- For example: "Closes #1234" --> Closes #5772 Closes #4742 ## Checks - [ ] I've included any doc changes needed for <https://microsoft.github.io/autogen/>. See <https://github.com/microsoft/autogen/blob/main/CONTRIBUTING.md> to build and test documentation locally. - [ ] I've added tests (if relevant) corresponding to the changes introduced in this PR. - [ ] I've made sure all auto checks have passed.
This commit is contained in:
parent
a4b6372813
commit
296de5253a
File diff suppressed because one or more lines are too long
@ -45,6 +45,7 @@ See each feature below for detailed information on how to migrate.
|
||||
- [Assistant Agent](#assistant-agent)
|
||||
- [Multi-Modal Agent](#multi-modal-agent)
|
||||
- [User Proxy](#user-proxy)
|
||||
- [RAG Agent](#rag-agent)
|
||||
- [Conversable Agent and Register Reply](#conversable-agent-and-register-reply)
|
||||
- [Save and Load Agent State](#save-and-load-agent-state)
|
||||
- [Two-Agent Chat](#two-agent-chat)
|
||||
@ -361,6 +362,54 @@ user_proxy = UserProxyAgent("user_proxy")
|
||||
See {py:class}`~autogen_agentchat.agents.UserProxyAgent`
|
||||
for more details and how to customize the input function with timeout.
|
||||
|
||||
## RAG Agent
|
||||
|
||||
In `v0.2`, there was the concept of teachable agents as well as a RAG agents that could take a database config.
|
||||
|
||||
```python
|
||||
teachable_agent = ConversableAgent(
|
||||
name="teachable_agent",
|
||||
llm_config=llm_config
|
||||
)
|
||||
|
||||
# Instantiate a Teachability object. Its parameters are all optional.
|
||||
teachability = Teachability(
|
||||
reset_db=False,
|
||||
path_to_db_dir="./tmp/interactive/teachability_db"
|
||||
)
|
||||
|
||||
teachability.add_to_agent(teachable_agent)
|
||||
```
|
||||
|
||||
In `v0.4`, you can implement a RAG agent using the {py:class}`~autogen_core.memory.Memory` class. Specifically, you can define a memory store class, and pass that as a parameter to the assistant agent. See the [Memory](memory.ipynb) tutorial for more details.
|
||||
|
||||
This clear separation of concerns allows you to implement a memory store that uses any database or storage system you want (you have to inherit from the `Memory` class) and use it with an assistant agent. The example below shows how to use a ChromaDB vector memory store with the assistant agent. In addition, your application logic should determine how and when to add content to the memory store. For example, you may choose to call `memory.add` for every response from the assistant agent or use a separate LLM call to determine if the content should be added to the memory store.
|
||||
|
||||
```python
|
||||
|
||||
# ...
|
||||
# example of a ChromaDBVectorMemory class
|
||||
chroma_user_memory = ChromaDBVectorMemory(
|
||||
config=PersistentChromaDBVectorMemoryConfig(
|
||||
collection_name="preferences",
|
||||
persistence_path=os.path.join(str(Path.home()), ".chromadb_autogen"),
|
||||
k=2, # Return top k results
|
||||
score_threshold=0.4, # Minimum similarity score
|
||||
)
|
||||
)
|
||||
|
||||
# you can add logic such as a document indexer that adds content to the memory store
|
||||
|
||||
assistant_agent = AssistantAgent(
|
||||
name="assistant_agent",
|
||||
model_client=OpenAIChatCompletionClient(
|
||||
model="gpt-4o",
|
||||
),
|
||||
tools=[get_weather],
|
||||
memory=[chroma_user_memory],
|
||||
)
|
||||
```
|
||||
|
||||
## Conversable Agent and Register Reply
|
||||
|
||||
In `v0.2`, you can create a conversable agent and register a reply function as follows:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user