Qwen2.5 icon indicating copy to clipboard operation
Qwen2.5 copied to clipboard

请问官网dashscope中的qwen1.5-14b-chat支持调用tools功能吗?

Open cgq0816 opened this issue 9 months ago • 2 comments

如题,测试了32b和72b模型,都支持调用tools功能,但是使用14b模型的时候不调用工具 32b/72b模型结果

result: [{'function': {'name': 'query_weather_info', 'arguments': '{"city": "北京", "date": "今天"}'}, 'id': '', 'type': 'function'}]

14b模型结果

GenerationOutput(text=None, choices=[Choice(finish_reason='stop', message=Message({'role': 'assistant', 'content': '对不起,我无法获取实时的天气信息。你可以查看各大天气预报网站,或者使用专业的天气应用来查询北京的天气。'}))], finish_reason=None)

tools定义

tools = [
            {
        "type": "function",
        "function": {
            "name": "query_train_info",
            "description": "根据用户提供的信息,查询对应的车次",
            "parameters": {
                "type": "object",
                "properties": {
                    "departure": {
                        "type": "string",
                        "description": "出发城市或车站",
                        },
                    "destination": {
                        "type": "string",
                        "description": "目的地城市或车站",
                        },
                    "date": {
                        "type": "string",
                        "description": "要查询的车次日期",
                        },
                    },
                "required": ["departure", "destination", "date"],
                },
        }
    },
            {
        "type": "function",
        "function": {
            "name": "query_weather_info",
            "description": "根据用户提供的信息,查询对应天气情况",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {
                        "type": "string",
                        "description": "要查询的城市",
                        },
                    "date": {
                        "type": "string",
                        "description": "要查询的天气日期",
                        },
                    },
                "required": ["city", "date"],
                },
        }
    }            
]

调用接口

            response = dashscope.Generation.call(
                model_name,
                api_key=api_key,
                tools = tools,
                messages=conversation,
                temperature=float(temperature),
                max_tokens=int(max_tokens),                    
                result_format='message',  # set the result is message format.
            ) 

请问如果14b支持tools的调用,我该怎么设置呢?谢谢

cgq0816 avatar Apr 25 '24 08:04 cgq0816