Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

子问题不继续推理回答停止 #249

Open
JansonChenQ opened this issue Nov 13, 2024 · 5 comments
Open

子问题不继续推理回答停止 #249

JansonChenQ opened this issue Nov 13, 2024 · 5 comments

Comments

@JansonChenQ
Copy link

版本:v0.2.0
现象:运行terminal.py,只返回根节点回答,子问题不继续执行了。
image

@braisedpork1964
Copy link
Collaborator

WebBrowser设置了搜索引擎的api_key吗

@JansonChenQ
Copy link
Author

WebBrowser设置了搜索引擎的api_key吗

search_engine="BingSearch",在.env中配置了WEB_SEARCH_API_KEY

@braisedpork1964
Copy link
Collaborator

lagent版本是0.5以上吗,不显式传api_key会报参数缺失

WebBrowser(
    searcher_type="BingSearch",
    api_key=os.getenv("WEB_SEARCH_API_KEY"),
    topk=6
)

@JansonChenQ
Copy link
Author

lagent版本是0.5以上吗,不显式传api_key会报参数缺失

WebBrowser(
    searcher_type="BingSearch",
    api_key=os.getenv("WEB_SEARCH_API_KEY"),
    topk=6
)

lagent==0.5.0rc1,这三个参数都是给了的。
image

@braisedpork1964
Copy link
Collaborator

这个格式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,
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants