-
Notifications
You must be signed in to change notification settings - Fork 380
Update models document page to cover gpt-5 #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,53 @@ In day‑to‑day work you normally only interact with model **names** and occas | |
title="Specifying a model per‑agent" | ||
/> | ||
|
||
## Default model | ||
|
||
When you don't specify a model when initializing an `Agent`, the default model will be used. The default is currently [`gpt-4.1`](https://platform.openai.com/docs/models/gpt-4.1), which offers a strong balance of predictability for agentic workflows and low latency. | ||
|
||
If you want to switch to other models like [`gpt-5`](https://platform.openai.com/docs/models/gpt-5), there are two ways to configure your agents. | ||
|
||
First, if you want to consistently use a specific model for all agents that do not set a custom model, set the `OPENAI_DEFAULT_MODEL` environment variable before running your agents. | ||
|
||
```bash | ||
export OPENAI_DEFAULT_MODEL=gpt-5 | ||
node my-awesome-agent.js | ||
``` | ||
|
||
Second, you can set a default model for a `Runner` instance. If you don't set a model for an agent, this `Runner`'s default model will be used. | ||
|
||
<Code | ||
lang="typescript" | ||
code={runnerWithModelExample} | ||
title="Set a default model for a Runner" | ||
/> | ||
|
||
### GPT-5 models | ||
|
||
When you use any of GPT-5's reasoning models ([`gpt-5`](https://platform.openai.com/docs/models/gpt-5), [`gpt-5-mini`](https://platform.openai.com/docs/models/gpt-5-mini), or [`gpt-5-nano`](https://platform.openai.com/docs/models/gpt-5-nano)) this way, the SDK applies sensible `modelSettings` by default. Specifically, it sets both `reasoning.effort` and `verbosity` to `"low"`. To adjust the reasoning effort for the default model, pass your own `modelSettings`: | ||
|
||
```ts | ||
import { Agent } from '@openai/agents'; | ||
|
||
const myAgent = new Agent({ | ||
name: 'My Agent', | ||
instructions: "You're a helpful agent.", | ||
modelSettings: { | ||
reasoning: { effort: 'minimal' }, | ||
text: { verbosity: 'low' }, | ||
}, | ||
// If OPENAI_DEFAULT_MODEL=gpt-5 is set, passing only modelSettings works. | ||
// It's also fine to pass a GPT-5 model name explicitly: | ||
// model: 'gpt-5', | ||
}); | ||
``` | ||
|
||
For lower latency, using either [`gpt-5-mini`](https://platform.openai.com/docs/models/gpt-5-mini) or [`gpt-5-nano`](https://platform.openai.com/docs/models/gpt-5-nano) with `reasoning.effort="minimal"` will often return responses faster than the default settings. However, some built-in tools (such as file search and image generation) in Responses API do not support `"minimal"` reasoning effort, which is why this Agents SDK defaults to `"low"`. | ||
|
||
### Non-GPT-5 models | ||
|
||
If you pass a non–GPT-5 model name without custom `modelSettings`, the SDK reverts to generic `modelSettings` compatible with any model. | ||
|
||
--- | ||
|
||
## The OpenAI provider | ||
|
@@ -52,16 +99,6 @@ endpoints: | |
You can also plug your own `OpenAI` client via `setDefaultOpenAIClient(client)` if you need | ||
custom networking settings. | ||
|
||
### Default model | ||
|
||
The OpenAI provider defaults to `gpt‑4o`. Override per agent or globally: | ||
|
||
<Code | ||
lang="typescript" | ||
code={runnerWithModelExample} | ||
title="Set a default model" | ||
/> | ||
|
||
--- | ||
|
||
## ModelSettings | ||
|
@@ -79,6 +116,8 @@ The OpenAI provider defaults to `gpt‑4o`. Override per agent or globally: | |
| `truncation` | `'auto' \| 'disabled'` | Token truncation strategy. | | ||
| `maxTokens` | `number` | Maximum tokens in the response. | | ||
| `store` | `boolean` | Persist the response for retrieval / RAG workflows. | | ||
| `reasoning.effort` | `'minimal' \| 'low' \| 'medium' \| 'high'` | Reasoning effort for gpt-5 etc. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In your other code samples from other PRs these were still under providerDetails. If they are top level I think that's better. Just calling it out. Also |
||
| `text.verbosity` | `'low' \| 'medium' \| 'high'` | Text verbosity for gpt-5 etc. | | ||
|
||
Attach settings at either level: | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also encourage people to try out
medium
andhigh
. Just always optimizing for latency doesn't seem like an ideal recommendation. We already dumb down the model withlow
to make the latency closer to what people expect from non-reasoning models. However, just because that's the fastest and an okay default doesn't mean it's what people should strive for.