Skip to content

Commit

Permalink
Clean up RetrieveAssistantAgent, part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkall committed Aug 14, 2024
1 parent 3eb575c commit bb3ba7a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion notebook/agentchat_RetrieveChat_mongodb.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"AutoGen offers conversable agents powered by LLM, tool or human, which can be used to perform tasks collectively via automated chat. This framework allows tool use and human participation through multi-agent conversation.\n",
"Please find documentation about this feature [here](https://microsoft.github.io/autogen/docs/Use-Cases/agent_chat).\n",
"\n",
"RetrieveChat is a conversational system for retrieval-augmented code generation and question answering. In this notebook, we demonstrate how to utilize RetrieveChat to generate code and answer questions based on customized documentations that are not present in the LLM's training dataset. RetrieveChat uses the `RetrieveAssistantAgent` and `RetrieveUserProxyAgent`, which is similar to the usage of `AssistantAgent` and `UserProxyAgent` in other notebooks (e.g., [Automated Task Solving with Code Generation, Execution & Debugging](https://github.com/microsoft/autogen/blob/main/notebook/agentchat_auto_feedback_from_code_execution.ipynb)). Essentially, `RetrieveAssistantAgent` and `RetrieveUserProxyAgent` implement a different auto-reply mechanism corresponding to the RetrieveChat prompts.\n",
"RetrieveChat is a conversational system for retrieval-augmented code generation and question answering. In this notebook, we demonstrate how to utilize RetrieveChat to generate code and answer questions based on customized documentations that are not present in the LLM's training dataset. RetrieveChat uses the `AssistantAgent` and `RetrieveUserProxyAgent`, which is similar to the usage of `AssistantAgent` and `UserProxyAgent` in other notebooks (e.g., [Automated Task Solving with Code Generation, Execution & Debugging](https://github.com/microsoft/autogen/blob/main/notebook/agentchat_auto_feedback_from_code_execution.ipynb)). Essentially, `RetrieveUserProxyAgent` implement a different auto-reply mechanism corresponding to the RetrieveChat prompts.\n",
"\n",
"## Table of Contents\n",
"We'll demonstrate six examples of using RetrieveChat for code generation and question answering:\n",
Expand Down
11 changes: 6 additions & 5 deletions notebook/agentchat_microsoft_fabric.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"\n",
"In this notebook, we demonstrate several examples:\n",
"- 1. How to use `AssistantAgent` and `UserProxyAgent` to write code and execute the code.\n",
"- 2. How to use `RetrieveAssistantAgent` and `RetrieveUserProxyAgent` to do Retrieval Augmented Generation (RAG) for QA and Code Generation.\n",
"- 2. How to use `AssistantAgent` and `RetrieveUserProxyAgent` to do Retrieval Augmented Generation (RAG) for QA and Code Generation.\n",
"- 3. How to use `MultimodalConversableAgent` to chat with images.\n",
"\n",
"### Requirements\n",
Expand Down Expand Up @@ -139,6 +139,7 @@
" }\n",
" return config_list, llm_config\n",
"\n",
"\n",
"config_list, llm_config = get_config_list()\n",
"\n",
"assert len(config_list) > 0\n",
Expand Down Expand Up @@ -401,7 +402,7 @@
},
"source": [
"### Example 2\n",
"How to use `RetrieveAssistantAgent` and `RetrieveUserProxyAgent` to do Retrieval Augmented Generation (RAG) for QA and Code Generation.\n",
"How to use `AssistantAgent` and `RetrieveUserProxyAgent` to do Retrieval Augmented Generation (RAG) for QA and Code Generation.\n",
"\n",
"Check out this [blog](https://microsoft.github.io/autogen/blog/2023/10/18/RetrieveChat) for more details."
]
Expand Down Expand Up @@ -479,11 +480,11 @@
},
"outputs": [],
"source": [
"from autogen.agentchat.contrib.retrieve_assistant_agent import RetrieveAssistantAgent\n",
"from autogen import AssistantAgent\n",
"from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent\n",
"\n",
"# 1. create an RetrieveAssistantAgent instance named \"assistant\"\n",
"assistant = RetrieveAssistantAgent(\n",
"# 1. create an AssistantAgent instance named \"assistant\"\n",
"assistant = AssistantAgent(\n",
" name=\"assistant\",\n",
" system_message=\"You are a helpful assistant.\",\n",
" llm_config=llm_config,\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import pytest
from sentence_transformers import SentenceTransformer

from autogen import config_list_from_json
from autogen.agentchat.contrib.retrieve_assistant_agent import RetrieveAssistantAgent
from autogen import AssistantAgent, config_list_from_json

sys.path.append(os.path.join(os.path.dirname(__file__), "../../.."))
from conftest import skip_openai # noqa: E402
Expand All @@ -18,9 +17,6 @@
try:
import pgvector

from autogen.agentchat.contrib.retrieve_assistant_agent import (
RetrieveAssistantAgent,
)
from autogen.agentchat.contrib.retrieve_user_proxy_agent import (
RetrieveUserProxyAgent,
)
Expand All @@ -46,7 +42,7 @@ def test_retrievechat():
file_location=KEY_LOC,
)

assistant = RetrieveAssistantAgent(
assistant = AssistantAgent(
name="assistant",
system_message="You are a helpful assistant.",
llm_config={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

import pytest

from autogen import config_list_from_json
from autogen.agentchat.contrib.retrieve_assistant_agent import RetrieveAssistantAgent
from autogen import AssistantAgent, config_list_from_json

sys.path.append(os.path.join(os.path.dirname(__file__), "../../.."))
from conftest import skip_openai # noqa: E402
Expand Down Expand Up @@ -51,7 +50,7 @@ def test_retrievechat():
file_location=KEY_LOC,
)

assistant = RetrieveAssistantAgent(
assistant = AssistantAgent(
name="assistant",
system_message="You are a helpful assistant.",
llm_config={
Expand Down
6 changes: 2 additions & 4 deletions test/agentchat/contrib/retrievechat/test_retrievechat.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
import openai
from chromadb.utils import embedding_functions as ef

from autogen.agentchat.contrib.retrieve_assistant_agent import (
RetrieveAssistantAgent,
)
from autogen import AssistantAgent
from autogen.agentchat.contrib.retrieve_user_proxy_agent import (
RetrieveUserProxyAgent,
)
Expand All @@ -45,7 +43,7 @@ def test_retrievechat():
file_location=KEY_LOC,
)

assistant = RetrieveAssistantAgent(
assistant = AssistantAgent(
name="assistant",
system_message="You are a helpful assistant.",
llm_config={
Expand Down

0 comments on commit bb3ba7a

Please sign in to comment.