Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
问题定位与解决
Bug1
在添加 qwen 的 API KEY 后 sample_standard_app/app/examples/law_chat_bot.py 无法跑通,报错如下:在配置文件 sample_standard_app/app/core/agent/rag_agent_case/law_rag_agent.yaml 中显示,law_chat_bot.py 使用的 agent 为 law_rag_agent,其调用的模型为 qwen_llm
对比 demo_rag_agent 的配置文件sample_standard_app/app/core/agent/rag_agent_case/demo_rag_agent.yaml,law_rag_agent 中增加了 law_knowledge(sample_standard_app/app/core/agent/rag_agent_case/law_rag_agent.yaml):
其中的 nlu_rag_router (sample_standard_app/app/core/rag_router/nlu_rag_router.yaml)也调用了 llm,且默认为 gpt:
将 demo_llm 修改为 qwen_llm 后,该 Bug 解决。
Bug2
Bug1 解决后再次运行 law_chat_bot.py 虽有输出,但仍有报错,且输出的 retrieved background 为空:定位报错信息的 agentuniverse/agent/action/knowledge/knowledge.py 的 190 附近,原因是 futures 的返回结果为空,此处应该是在知识库 civil_law_chroma_store 和 civil_law_sqlite_store 中进行检索
单独运行 StoreManager().get_instance_obj().query(),出现报错:
Bug2.1
报错是因为 agentuniverse/agent/action/knowledge/store/chroma_store.py 中 self.collection 为 None,根本原因是 self.collection 在 _new_client 中被赋值,但 _new_client 未被调用:在 self.collection 为 None 时增加 _new_client 的调用后该 Bug 消失:
Bug2.2
Bug2.1 解决后再次运行 law_chat_bot.py 仍有报错:报错是因为 agentuniverse/agent/action/knowledge/store/sqlite_store.py 中 self.conn 为 None,根本原因同样是 self.conn 在 _new_client 中被赋值,但 _new_client 未被调用:
同样在 self.conn 为 None 时增加 _new_client 的调用:
解决完 Bug2.1 和 Bug2.2 后 futures 的返回结果正常,最终输出结果的 retrieved background 不为空: