请问如何在微软的Autogen 0.4框架下使用Qwen模型实现工具调用?

目前Qwen模型官方文档中,工具调用的语法格式如下:

tools = [
    # 工具1 获取当前时刻的时间
    {
        "type": "function",
        "function": {
            "name": "get_current_time",
            "description": "当你想知道现在的时间时非常有用。",
            "parameters": {}  # 因为获取当前时间无需输入参数,因此parameters为空字典
        }
    },

但是在微软Autogen 0.4中按照该语法调用工具,则会返回错误ValueError: Unsupported tool type: 。
而如果按照Autogen语法调用工具,则会返回错误openai.BadRequestError: Error code: 400 - {'error': {'message': '<400> InternalError.Algo.InvalidParameter: messages with role "tool" must be a response to a preceeding message with "tool_calls". (request id: 20250)', 'type': 'upstream_error', 'param': '400', 'code': 'bad_response_status_code'}}
请问应当如何解决?

展开
收起
n7m5rpxebzapk 2025-03-20 16:34:47 37 发布于北京 分享
分享
版权
举报
0 条回答
写回答
取消 提交回答
问答分类:
问答地址:

基于通义系列大模型和开源大模型的一站式大模型服务平台,提供「生成式大模型的全流程应用工具」和「企业大模型的全链路训练工具」。为大模型,也为小应用。 阿里云百炼官网网址:https://www.aliyun.com/product/bailian

热门讨论

热门文章

还有其他疑问?
咨询AI助理