How to use different reasoning effort in the example?

#45
by TianheWu - opened

Thanks.

How can we apply varying reasoning efforts in this example?

from transformers import pipeline
import torch

model_id = "openai/gpt-oss-120b"

pipe = pipeline(
    "text-generation",
    model=model_id,
    torch_dtype="auto",
    device_map="auto",
)

messages = [
    {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
]

outputs = pipe(
    messages,
    max_new_tokens=256,
)
print(outputs[0]["generated_text"][-1])

Try adding {"role": "system", "content": "Reasoning: high"} as the first message

Sign up or log in to comment