MindSearch
MindSearch copied to clipboard
子问题不继续推理回答停止
版本:v0.2.0
现象:运行terminal.py,只返回根节点回答,子问题不继续执行了。
WebBrowser设置了搜索引擎的api_key吗
WebBrowser设置了搜索引擎的api_key吗
search_engine="BingSearch",在.env中配置了WEB_SEARCH_API_KEY
lagent版本是0.5以上吗,不显式传api_key会报参数缺失
WebBrowser(
searcher_type="BingSearch",
api_key=os.getenv("WEB_SEARCH_API_KEY"),
topk=6
)
lagent版本是0.5以上吗,不显式传api_key会报参数缺失
WebBrowser( searcher_type="BingSearch", api_key=os.getenv("WEB_SEARCH_API_KEY"), topk=6 )
lagent==0.5.0rc1,这三个参数都是给了的。
这个格式internlm-2.5外的模型难follow上,拼一下planner和searcher的fewshot提示词(可能还要进一步调整),然后InterpreterParser和PluginParser解析工具的begin和end模式放宽松一点
from mindsearch.agent.mindsearch_prompt import (
fewshot_example_cn,
fewshot_example_en,
graph_fewshot_example_cn,
graph_fewshot_example_en,
)
agent = MindSearchAgent(
llm=llm,
template=date,
output_format=InterpreterParser(
begin="<|action_start|><|interpreter|>",
end="<|action_end|>",
template=(
GRAPH_PROMPT_CN + graph_fewshot_example_cn
if lang == "cn"
else GRAPH_PROMPT_EN + graph_fewshot_example_en
),
),
searcher_cfg=dict(
llm=llm,
plugins=plugins,
template=date,
output_format=PluginParser(
begin="<|action_start|><|plugin|>",
end="<|action_end|>",
template=(
searcher_system_prompt_cn + fewshot_example_cn
if lang == "cn"
else searcher_system_prompt_en + fewshot_example_en
),
tool_info=get_plugin_prompt(plugins),
),
user_input_template=(
searcher_input_template_cn if lang == "cn" else searcher_input_template_en
),
user_context_template=(
searcher_context_template_cn if lang == "cn" else searcher_context_template_en
),
),
summary_prompt=FINAL_RESPONSE_CN if lang == "cn" else FINAL_RESPONSE_EN,
max_turn=10,
)