QwenLM / Qwen-Agent

Agent framework and applications built upon Qwen>=2.0, featuring Function Calling, Code Interpreter, RAG, and Chrome extension.
https://pypi.org/project/qwen-agent/
Other
3.38k stars 335 forks source link

extra_generate_cfg 配置完后,如何传参 #275

Closed Miguitian closed 3 months ago

Miguitian commented 3 months ago

我内网环境部署的qwen模型,需要设置一下extra_generate_cfg = { "extra_headers": { "Host": "qwen1-5-32b-isvc.ai-platform.example.com" } } 来指定Host,我如果使用FnCallAgent类来实现智能体,配置好llm_cfg 参数,那我应该在哪里传入extra_generate_cfg配置? 尝试了一下将extra_generate_cfg 写到llm_cfg里面并没有生效 。

JianxinMa commented 3 months ago

试试类似这样?

llm_cfg = {
    'model': 'qwen-max',
    'model_server': 'dashscope',
    'api_key': 'YOUR_DASHSCOPE_API_KEY',

    'generate_cfg': {
        "extra_headers": {
            "Host": "qwen1-5-32b-isvc.ai-platform.example.com"
          }
    }
}

可以注意下 https://github.com/QwenLM/Qwen-Agent/blob/main/qwen_agent/llm/oai.py#L53https://github.com/QwenLM/Qwen-Agent/blob/main/qwen_agent/llm/oai.py#L78这两行