阿里通义千问 Qwen

可用模型清单:https://help.aliyun.com/zh/dashscope/developer-reference/openai-file-interface

因为qwen API适配了OpenAI的接口格式规范,我们推荐您使用OAIClient进行请求。

import Agently
agent = (
    Agently.create_agent()
    .set_settings("current_model", "OAIClient")
        .set_settings("model.OAIClient.auth.api_key", "<Your-API-Key>")
        # 使用DashScope专门适配的API Base URL
        .set_settings("model.OAIClient.url", "https://dashscope.aliyuncs.com/compatible-mode/v1")
        # 如果需要切换模型,可参考模型清单:https://help.aliyun.com/zh/dashscope/developer-reference/openai-file-interface
        .set_settings("model.OAIClient.options.model", "qwen-turbo")
)