如何让DeepSeek-R1-Distill-Qwen-32B支持Function calling

描述:

deep seek-r1是不支持funciton calling调用,如果想让离线版本支持function calling,那怎么弄呢。

现象:

vllm:0.9.1

2张A6000卡

通过vllm0.9.1发布DeepSeek-R1-Distill-Qwen-32B大语言模型。

vllm serve "/mnt/data/models/DeepSeek-R1-Distill-Qwen-32B" \
	        --host "0.0.0.0" \
		 --port 9400 \
		  --gpu-memory-utilization 0.9 \
          --max-model-len 8192 \      
		  --served-model-name "qwen32b" \
		  --tensor-parallel-size 2 

再通过下面代码调用,发现没有返回function call

from openai import OpenAI
import json
import re
base_url = "http://127.0.0.1:9400/v1"
client = OpenAI(api_key="EMPTY", base_url=base_url)

def get_weather(location: str, unit: str):
    return f"{location}的气温是27 {unit},晴天。"
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "获取给定位置的当前天气",
        "parameters": {
            "type": "object",
            "properties": {
                "location": {"type": "string", "description": "城市和州,例如“北京市海淀区”"},
                "unit": {"type": "string", "enum": ["摄氏度", "华氏度"]}
            },
            "required": ["location", "unit"]
        }
    }
}]

response = client.chat.completions.create(
    model=client.models.list().data[0].id,
    messages=[
              {"role": "user
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值