modelscope / modelscope-agent

ModelScope-Agent: An agent framework connecting models in ModelScope with the world
https://modelscope-agent.readthedocs.io/en/latest/
Apache License 2.0
2.56k stars 289 forks source link

[RAG] What is the best way to add RAG in Agent? #465

Closed douyh closed 2 months ago

douyh commented 2 months ago

Initial Checks

Description

I can see some examples of rag in examples.

image

I have a question. I don't want to call rag every time, that is, I don't want to add ref_doc directly beacuase of huge time comsumption. How can I decide what is the right time to use rag? Use rag as a tool?

I hope to get some suggestions. Thanks.

Use case

No response

zzhangpurdue commented 2 months ago

The best practice is to index file once, and save indexing file, there is no way to avoid the indexing step which cost huge time, we default set the 'use_knowledge_cache' to True, to allow use cached indexing. BTW, we are upgrading our RAG ability, by using llama-index, user could easily apply the llama-index component in our agents.

suluyana commented 2 months ago

Using rag as a tool may be a good idea, but the effect may be questionable. Or call llm first to decide whether the current round of query uses rag.

douyh commented 2 months ago

The best practice is to index file once, and save indexing file, there is no way to avoid the indexing step which cost huge time, we default set the 'use_knowledge_cache' to True, to allow use cached indexing. BTW, we are upgrading our RAG ability, by using llama-index, user could easily apply the llama-index component in our agents.

I see. I will try llama-index. Thanks for your reply.