QwenLM / Qwen-Agent

Agent framework and applications built upon Qwen2, featuring Function Calling, Code Interpreter, RAG, and Chrome extension.
https://pypi.org/project/qwen-agent/
Other
2.97k stars 286 forks source link

怎么修改RAG或者agent的上下文 #257

Open xxzhang0927 opened 1 month ago

xxzhang0927 commented 1 month ago

qwen-agent-2405-blog-long-context-results 默认4K的上下文如何修改,我使用72B 128K的上下文,如何同步把RAG和agent的上下文扩充

xxzhang0927 commented 1 month ago

我希望将4K-RAG和4K-AGENT扩充到8K-RAG和8K-AGENT

JianxinMa commented 1 month ago

方法一:直接改代码的默认配置:https://github.com/QwenLM/Qwen-Agent/blob/main/qwen_agent/settings.py#L12 (改里面的DEFAULT_MAX_INPUT_TOKENS和DEFAULT_MAX_REF_TOKEN、DEFAULT_PARSER_PAGE_SIZE)等。

方法二:使用Assistant和llm时通过传参数控制:https://github.com/QwenLM/Qwen-Agent/blob/main/qwen_agent/memory/memory.py#L35 (Assistant类使用了这个Memory类,具体可以翻翻Assistant的代码) https://github.com/QwenLM/Qwen-Agent/blob/main/qwen_agent/llm/base.py#L369

(目前没人手,文档不完善,只能让大家翻翻代码理解这些东西怎么配置了)

xxzhang0927 commented 1 month ago

谢谢,已解决