調整推理強度
V4-Pro 預設以 "high" 的強度思考。若你需要它在特別困難的問題上更用力推理,設定 reasoning_effort="max",模型就會花更長時間逐步完成推理。
在這個練習中,你會再次送出前一題相同的 math_problem——這次加上 reasoning_effort="max"——並比較回應的呈現方式有何不同。
本練習屬於課程
使用 Python 操作 DeepSeek
練習說明
- 建立一個請求,將
math_problem送到"deepseek-ai/DeepSeek-V4.1-Flash"。 - 將
reasoning_effort設為"max",把思考強度調到最高。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
client = OpenAI(api_key="", base_url="https://api.together.xyz/v1")
# Crank up the reasoning effort
response = client.chat.completions.create(
model="deepseek-ai/____",
reasoning_effort=____,
max_tokens=600,
messages=[
{"role": "user",
"content": math_problem}]
)
print(response.choices[0].message.content)