-
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.
- 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.
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.
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.
-
Terminal: The most simple way to execute the AgentScope Copilot is running in terminal.
python ./rag_example.py
-
AS gradio: If you want to have more organized, clean UI, you can also run with our
as_gradio
.as_gradio ./rag_example.py
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 bysphinx
)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.