You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AgentQnA/README.md
+62-20Lines changed: 62 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Overview
4
4
5
-
This example showcases a hierarchical multi-agent system for question-answering applications. The architecture diagram is shown below. The supervisor agent interfaces with the user and dispatch tasks to the worker agent and other tools to gather information and come up with answers. The worker agent uses the retrieval tool to generate answers to the queries posted by the supervisor agent. Other tools used by the supervisor agent may include APIs to interface knowledge graphs, SQL databases, external knowledge bases, etc.
5
+
This example showcases a hierarchical multi-agent system for question-answering applications. The architecture diagram is shown below. The supervisor agent interfaces with the user and dispatch tasks to two worker agents to gather information and come up with answers. The worker RAG agent uses the retrieval tool to retrieve relevant documents from the knowledge base (a vector database). The worker SQL agent retrieve relevant data from the SQL database. Although not included in this example, but other tools such as a web search tool or a knowledge graph query tool can be used by the supervisor agent to gather information from additional sources.
The AgentQnA example is implemented using the component-level microservices defined in [GenAIComps](https://github.com/opea-project/GenAIComps). The flow chart below shows the information flow between different microservices for this example.
@@ -38,6 +38,7 @@ flowchart LR
38
38
end
39
39
AG_REACT([Agent MicroService - react]):::blue
40
40
AG_RAG([Agent MicroService - rag]):::blue
41
+
AG_SQL([Agent MicroService - sql]):::blue
41
42
LLM_gen{{LLM Service <br>}}
42
43
DP([Data Preparation MicroService]):::blue
43
44
TEI_RER{{Reranking service<br>}}
@@ -51,6 +52,7 @@ flowchart LR
51
52
direction LR
52
53
a[User Input Query] --> AG_REACT
53
54
AG_REACT --> AG_RAG
55
+
AG_REACT --> AG_SQL
54
56
AG_RAG --> DocIndexRetriever-MegaService
55
57
EM ==> RET
56
58
RET ==> RER
@@ -59,6 +61,7 @@ flowchart LR
59
61
%% Embedding service flow
60
62
direction LR
61
63
AG_RAG <-.-> LLM_gen
64
+
AG_SQL <-.-> LLM_gen
62
65
AG_REACT <-.-> LLM_gen
63
66
EM <-.-> TEI_EM
64
67
RET <-.-> R_RET
@@ -75,11 +78,11 @@ flowchart LR
75
78
### Why Agent for question answering?
76
79
77
80
1. Improve relevancy of retrieved context.
78
-
Agent can rephrase user queries, decompose user queries, and iterate to get the most relevant context for answering user's questions. Compared to conventional RAG, RAG agent can significantly improve the correctness and relevancy of the answer.
79
-
2.Use tools to get additional knowledge.
80
-
For example, knowledge graphs and SQL databases can be exposed as APIs for Agents to gather knowledge that may be missing in the retrieval vector database.
81
-
3. Hierarchical agent can further improve performance.
82
-
Expert worker agents, such as retrieval agent, knowledge graph agent, SQL agent, etc., can provide high-quality output for different aspects of a complex query, and the supervisor agent can aggregate the information together to provide a comprehensive answer.
81
+
RAG agent can rephrase user queries, decompose user queries, and iterate to get the most relevant context for answering user's questions. Compared to conventional RAG, RAG agent can significantly improve the correctness and relevancy of the answer.
82
+
2.Expand scope of the agent.
83
+
The supervisor agent can interact with multiple worker agents that specialize in different domains with different skills (e.g., retrieve documents, write SQL queries, etc.), and thus can answer questions in multiple domains.
84
+
3. Hierarchical multi-agents can improve performance.
85
+
Expert worker agents, such as RAG agent and SQL agent, can provide high-quality output for different aspects of a complex query, and the supervisor agent can aggregate the information together to provide a comprehensive answer. If we only use one agent and provide all the tools to this single agent, it may get overwhelmed and not able to provide accurate answers.
In this example, we will use some of the mock APIs provided in the Meta CRAG KDD Challenge to demonstrate the benefits of gaining additional context from mock knowledge graphs.
153
166
154
167
```
155
168
docker run -d -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0
156
169
```
157
170
158
-
5. Launch agent services</br>
159
-
We provide two options for `llm_engine` of the agents: 1. open-source LLMs, 2. OpenAI models via API calls.
160
-
161
-
Deploy it on Gaudi or Xeon respectively
171
+
6. Launch multi-agent system. </br>
172
+
We provide two options for `llm_engine` of the agents: 1. open-source LLMs on Intel Gaudi2, 2. OpenAI models via API calls.
162
173
163
174
::::{tab-set}
164
175
:::{tab-item} Gaudi
165
176
:sync: Gaudi
166
177
167
-
To use open-source LLMs on Gaudi2, run commands below.
178
+
On Gaudi2 we will serve `meta-llama/Meta-Llama-3.1-70B-Instruct` using vllm.
Copy file name to clipboardExpand all lines: AgentQnA/docker_compose/intel/cpu/xeon/README.md
+32-9Lines changed: 32 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -41,21 +41,33 @@ This example showcases a hierarchical multi-agent system for question-answering
41
41
bash run_ingest_data.sh
42
42
```
43
43
44
-
4. Launch Tool service
44
+
4. Prepare SQL database
45
+
In this example, we will use the SQLite database provided in the [TAG-Bench](https://github.com/TAG-Research/TAG-Bench/tree/main). Run the commands below.
In this example, we will use some of the mock APIs provided in the Meta CRAG KDD Challenge to demonstrate the benefits of gaining additional context from mock knowledge graphs.
46
58
```
47
59
docker run -d -p=8080:8000 docker.io/aicrowd/kdd-cup-24-crag-mock-api:v0
48
60
```
49
-
5. Launch `Agent` service
61
+
6. Launch multi-agent system
50
62
51
-
The configurations of the supervisor agent and the worker agent are defined in the docker-compose yaml file. We currently use openAI GPT-4o-mini as LLM, and llama3.1-70B-instruct (served by TGI-Gaudi) in Gaudi example. To use openai llm, run command below.
63
+
The configurations of the supervisor agent and the worker agents are defined in the docker-compose yaml file. We currently use openAI GPT-4o-mini as LLM.
52
64
53
65
```
54
66
cd $WORKDIR/GenAIExamples/AgentQnA/docker_compose/intel/cpu/xeon
55
67
bash launch_agent_service_openai.sh
56
68
```
57
69
58
-
6.[Optional] Build `Agent` docker image if pulling images failed.
70
+
7.[Optional] Build `Agent` docker image if pulling images failed.
0 commit comments