一、在ollama命令行使用时

/set nothink

关闭思考,打开思考
>>> /set nothink
Set 'nothink' mode.
>>> 什么是红黑树

>>> /set think
Set 'think' mode.
>>> 什么是红黑树

>>> /bye

二、在ollama run时指定

--think=false

C:\Users\user>ollama run deepseek-r1:1.5b --think=true
C:\Users\user>ollama run deepseek-r1:1.5b --think=false

--think=(true, false, high, medium, or low)

三、在代码中指定,python代码

"think": False

url = "http://localhost:11434/api/generate"
data = {
    "model": model,
    "prompt": prompt,
    "stream": False,  # 设置为 True 可以获取流式响应
    "think": False		# 设置为 False 以禁用思考
}

response = requests.post(url, json=data, stream=False)

四、在ollama中,修改模型配置文件的参数

.ollama\models\manifests\registry.ollama.ai\library\deepseek-r1\1.5b(json)

添加一个一级属性:"options": {"verbose": false}

这个麻烦,还不灵活,未实践。

Logo

欢迎加入DeepSeek 技术社区。在这里,你可以找到志同道合的朋友,共同探索AI技术的奥秘。

更多推荐