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: FinanceAgent/README.md
+52-16Lines changed: 52 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,20 @@
2
2
3
3
## 1. Overview
4
4
5
-
The architecture of this Finance Agent example is shown in the figure below. The agent has 3 main functions:
5
+
The architecture of this Finance Agent example is shown in the figure below. The agent is a hierarchical multi-agent system and has 3 main functions:
6
6
7
-
1. Summarize long financial documents and provide key points.
8
-
2. Answer questions over financial documents, such as SEC filings.
9
-
3. Conduct research of a public company and provide an investment report of the company.
7
+
1. Summarize long financial documents and provide key points (using OPEA DocSum).
8
+
2. Answer questions over financial documents, such as SEC filings (using a worker agent).
9
+
3. Conduct research of a public company and provide an investment report of the company (using a worker agent).
10
+
11
+
The user interacts with the supervisor agent through the graphical UI. The supervisor agent gets the requests from the user and dispatches tasks to worker agents or to the summarization microservice. The user can also uploads documents through the UI.
The architectural diagram of the `dataprep` microservice is shown below. We use [docling](https://github.com/docling-project/docling) to extract text from PDFs and URLs into markdown format. Both the full document content and tables are extracted. We then use an LLM to extract metadata from the document, including the company name, year, quarter, document type, and document title. The full document markdown then gets chunked, and LLM is used to summarize each chunk, and the summaries are embedded and saved to a vector database. Each table is also summarized by LLM and the summaries are embedded and saved to the vector database. The chunks and tables are also saved into a KV store. The pipeline is designed as such to improve retrieval accuracy of the `search_knowledge_base` tool used by the Question Answering worker agent.
The `dataprep` microservice can ingest financial documents in two formats:
14
20
15
21
1. PDF documents stored locally, such as SEC filings saved in local directory.
@@ -20,31 +26,39 @@ Please note:
20
26
1. Each financial document should be about one company.
21
27
2. URLs ending in `.htm` are not supported.
22
28
29
+
The Question Answering worker agent uses `search_knowledge_base` tool to get relevant information. The tool uses a dense retriever and a BM25 retriever to get many pieces of information including financial statement tables. Then an LLM is used to extract useful information related to the query from the retrieved documents. Refer to the diagram below. We found that using this method significantly improves agent performance.
The UI microservice is launched in the previous step with the other microservices.
135
151
To see the UI, open a web browser to `http://${ip_address}:5175` to access the UI. Note the `ip_address` here is the host IP of the UI microservice.
136
152
137
-
1.`create Admin Account` with a random value
153
+
1. Create Admin Account with a random value
154
+
155
+
2. Enter the endpoints in the `Connections` settings
156
+
157
+
First, click on the user icon in the upper right corner to open `Settings`. Click on `Admin Settings`. Click on `Connections`.
158
+
159
+
Then, enter the supervisor agent endpoint in the `OpenAI API` section: `http://${ip_address}:9090/v1`. Enter the API key as "empty". Add an arbitrary model id in `Model IDs`, for example, "opea_agent". The `ip_address` here should be the host ip of the agent microservice.
160
+
161
+
Then, enter the dataprep endpoint in the `Icloud File API` section. You first need to enable `Icloud File API` by clicking on the button on the right to turn it into green and then enter the endpoint url, for example, `http://${ip_address}:6007/v1`. The `ip_address` here should be the host ip of the dataprep microservice.
162
+
163
+
You should see screen like the screenshot below when the settings are done.
Click on the `Workplace` icon in the top left corner. Click `Knowledge`. Click on the "+" sign to the right of `Icloud Knowledge`. You can paste an url in the left hand side of the pop-up window, or upload a local file by click on the cloud icon on the right hand side of the pop-up window. Then click on the `Upload Confirm` button. Wait till the processing is done and the pop-up window will be closed on its own when the data ingestion is done. See the screenshot below.
170
+
171
+
Note: the data ingestion may take a few minutes depending on the length of the document. Please wait patiently and do not close the pop-up window.
172
+
173
+

138
174
139
-
2. use an opea agent endpoint, for example, the `Research Agent` endpoint `http://$ip_address:9096/v1`, which is a openai compatible api
After the settings are done and documents are ingested, you can start to ask questions to the agent. Click on the `New Chat` icon in the top left corner, and type in your questions in the text box in the middle of the UI.
142
178
143
-
3. test opea agent with ui
179
+
The UI will stream the agent's response tokens. You need to expand the `Thinking` tab to see the agent's reasoning process. After the agent made tool calls, you would also see the tool output after the tool returns output to the agent. Note: it may take a while to get the tool output back if the tool execution takes time.
0 commit comments