"src/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "d37f08da723cba38965b2df8b21a8136af9f358f"
Unverified Commit 0b14159f authored by Vincent Zhong's avatar Vincent Zhong Committed by GitHub
Browse files

Add reasoning examples for GPT-OSS in Markdown examples (#9626)

parent 1489cd6c
...@@ -6,7 +6,7 @@ Please refer to [https://github.com/sgl-project/sglang/issues/8833](https://gith ...@@ -6,7 +6,7 @@ Please refer to [https://github.com/sgl-project/sglang/issues/8833](https://gith
### Responses API ### Responses API
GPT‑OSS is compatible with the OpenAI Responses API. Use `client.responses.create(...)` with `model`, `instructions`, `input`, and optional `tools` to enable built‑in tool use. GPT‑OSS is compatible with the OpenAI Responses API. Use `client.responses.create(...)` with `model`, `instructions`, `input`, and optional `tools` to enable built‑in tool use. You can set reasoning level via `instructions`, e.g., "Reasoning: high" (also supports "medium" and "low") — levels: low (fast), medium (balanced), high (deep).
### Built-in Tools ### Built-in Tools
...@@ -69,6 +69,16 @@ tools = [ ...@@ -69,6 +69,16 @@ tools = [
{"type": "web_search_preview"}, {"type": "web_search_preview"},
] ]
# Reasoning level example
response = client.responses.create(
model="openai/gpt-oss-120b",
instructions="You are a helpful assistant."
reasoning_effort="high" # Supports high, medium, or low
input="In one sentence, explain the transformer architecture.",
)
print("====== reasoning: high ======")
print(response.output_text)
# Test python tool # Test python tool
response = client.responses.create( response = client.responses.create(
model="openai/gpt-oss-120b", model="openai/gpt-oss-120b",
......
...@@ -450,7 +450,7 @@ class ChatCompletionRequest(BaseModel): ...@@ -450,7 +450,7 @@ class ChatCompletionRequest(BaseModel):
description="Constrains effort on reasoning for reasoning models. " description="Constrains effort on reasoning for reasoning models. "
"'low' is the least effort, 'high' is the most effort. Reducing reasoning effort can " "'low' is the least effort, 'high' is the most effort. Reducing reasoning effort can "
"result in faster responses and fewer tokens used on reasoning in a response. " "result in faster responses and fewer tokens used on reasoning in a response. "
"Currently only supported for OpenAI models.", "Currently only supported for OpenAI models in the harmony path, i.e GPT-OSS models.",
) )
@model_validator(mode="before") @model_validator(mode="before")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment