reasoning_content フィールドに含まれています。このフィールドは、他の モデル の出力には存在しません。
- Python
- Bash
W&B Inference のレスポンスで推理(Reasoning)を返し、表示する方法
reasoning_content フィールドに含まれています。このフィールドは、他の モデル の出力には存在しません。
import openai
client = openai.OpenAI(
base_url='https://api.inference.wandb.ai/v1',
api_key="<your-api-key>", # https://wandb.ai/settings で APIキー を作成してください
)
response = client.chat.completions.create(
model="openai/gpt-oss-20b",
messages=[
{"role": "user", "content": "3.11 and 3.8, which is greater?"}
],
)
print(response.choices[0].message.reasoning_content)
print("--------------------------------")
print(response.choices[0].message.content)
curl https://api.inference.wandb.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your-api-key>" \
-d '{
"model": "openai/gpt-oss-20b",
"messages": [
{ "role": "user", "content": "3.11 and 3.8, which is greater?" }
],
}'