This commit is contained in:
CakeCN
2024-12-03 16:21:19 +08:00
commit 4198ca63b1
975 changed files with 333413 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
# AgentScope Copilot: a Multi-Agent RAG Application
* **What is this example about?**
With the provided implementation and configuration,
you will obtain three different agents who can help you answer different questions about AgentScope.
* **What is this example for?** By this example, we want to show how the agent with retrieval augmented generation (RAG)
capability can be used to build easily.
## Prerequisites
* **Cloning repo:** This example requires cloning the whole AgentScope repo to local.
* **Packages:** This example is built on the LlamaIndex package. Thus, some packages need to be installed before running the example.
```bash
pip install llama-index==0.10.30 llama-index-readers-docstring-walker==0.1.3 tree-sitter==0.21.3 tree-sitter-languages==1.10.2
```
* **Model APIs:** This example uses Dashscope APIs. Thus, we also need an API key for DashScope.
```bash
export DASHSCOPE_API_KEY='YOUR_API_KEY'
```
**Note:** This example has been tested with `dashscope_chat` and `dashscope_text_embedding` model wrapper, with `qwen-max` and `text-embedding-v2` models.
However, you are welcome to replace the Dashscope language and embedding model wrappers or models with other models you like to test.
## Start AgentScope Copilot
* **Terminal:** The most simple way to execute the AgentScope Copilot is running in terminal.
```bash
python ./rag_example.py
```
* **AS gradio:** If you want to have more organized, clean UI, you can also run with our `as_gradio`.
```bash
as_gradio ./rag_example.py
```
### Agents in the example
After you run the example, you may notice that this example consists of three RAG agents:
* `Tutorial-Assistant`: responsible for answering questions based on AgentScope tutorials (markdown files).
* `Code-Search-Assistant`: responsible for answering questions based on AgentScope code base (python files).
* `API-Assistant`: responsible for answering questions based on AgentScope API documents (html files, generated by `sphinx`)
* `Searching-Assistant`: responsible for general search in tutorial and code base (markdown files and code files)
* `Agent-Guiding-Assistant`: responsible for referring the correct agent(s) among the above ones.
Besides the last `Agent-Guiding-Assistant`, all other agents can be configured to answering questions based on other GitHub repo by replacing the `knowledge`.
For more details about how to use the RAG module in AgentScope, please refer to the tutorial.