Skip to content

Commit 479b346

Browse files
authored
change clai default model to gpt-4.1 (#2227)
1 parent 4a47596 commit 479b346

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

clai/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ positional arguments:
6868
options:
6969
-h, --help show this help message and exit
7070
-m [MODEL], --model [MODEL]
71-
Model to use, in format "<provider>:<model>" e.g. "openai:gpt-4o" or "anthropic:claude-3-7-sonnet-latest". Defaults to "openai:gpt-4o".
71+
Model to use, in format "<provider>:<model>" e.g. "openai:gpt-4.1" or "anthropic:claude-sonnet-4-0". Defaults to "openai:gpt-4.1".
7272
-a AGENT, --agent AGENT
7373
Custom Agent to use, in format "module:variable", e.g. "mymodule.submodule:my_agent"
7474
-l, --list-models List all available models and exit

docs/cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ uvx clai --help
6060
You can specify which model to use with the `--model` flag:
6161

6262
```bash
63-
uvx clai --model anthropic:claude-3-7-sonnet-latest
63+
uvx clai --model anthropic:claude-sonnet-4-0
6464
```
6565

6666
(a full list of models available can be printed with `uvx clai --list-models`)
@@ -72,7 +72,7 @@ You can specify a custom agent using the `--agent` flag with a module path and v
7272
```python {title="custom_agent.py" test="skip"}
7373
from pydantic_ai import Agent
7474

75-
agent = Agent('openai:gpt-4o', instructions='You always respond in Italian.')
75+
agent = Agent('openai:gpt-4.1', instructions='You always respond in Italian.')
7676
```
7777

7878
Then run:
@@ -92,7 +92,7 @@ Additionally, you can directly launch CLI mode from an `Agent` instance using `A
9292
```python {title="agent_to_cli_sync.py" test="skip" hl_lines=4}
9393
from pydantic_ai import Agent
9494

95-
agent = Agent('openai:gpt-4o', instructions='You always respond in Italian.')
95+
agent = Agent('openai:gpt-4.1', instructions='You always respond in Italian.')
9696
agent.to_cli_sync()
9797
```
9898

@@ -101,7 +101,7 @@ You can also use the async interface with `Agent.to_cli()`:
101101
```python {title="agent_to_cli.py" test="skip" hl_lines=6}
102102
from pydantic_ai import Agent
103103

104-
agent = Agent('openai:gpt-4o', instructions='You always respond in Italian.')
104+
agent = Agent('openai:gpt-4.1', instructions='You always respond in Italian.')
105105

106106
async def main():
107107
await agent.to_cli()

pydantic_ai_slim/pydantic_ai/_cli.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ def cli_exit(prog_name: str = 'pai'): # pragma: no cover
101101
sys.exit(cli(prog_name=prog_name))
102102

103103

104-
def cli(args_list: Sequence[str] | None = None, *, prog_name: str = 'pai') -> int: # noqa: C901
104+
def cli( # noqa: C901
105+
args_list: Sequence[str] | None = None, *, prog_name: str = 'pai', default_model: str = 'openai:gpt-4.1'
106+
) -> int:
105107
"""Run the CLI and return the exit code for the process."""
106108
parser = argparse.ArgumentParser(
107109
prog=prog_name,
@@ -120,7 +122,7 @@ def cli(args_list: Sequence[str] | None = None, *, prog_name: str = 'pai') -> in
120122
'-m',
121123
'--model',
122124
nargs='?',
123-
help='Model to use, in format "<provider>:<model>" e.g. "openai:gpt-4o" or "anthropic:claude-3-7-sonnet-latest". Defaults to "openai:gpt-4o".',
125+
help=f'Model to use, in format "<provider>:<model>" e.g. "openai:gpt-4.1" or "anthropic:claude-sonnet-4-0". Defaults to "{default_model}".',
124126
)
125127
# we don't want to autocomplete or list models that don't include the provider,
126128
# e.g. we want to show `openai:gpt-4o` but not `gpt-4o`
@@ -179,7 +181,7 @@ def cli(args_list: Sequence[str] | None = None, *, prog_name: str = 'pai') -> in
179181
model_arg_set = args.model is not None
180182
if agent.model is None or model_arg_set:
181183
try:
182-
agent.model = infer_model(args.model or 'openai:gpt-4o')
184+
agent.model = infer_model(args.model or default_model)
183185
except UserError as e:
184186
console.print(f'Error initializing [magenta]{args.model}[/magenta]:\n[red]{e}[/red]')
185187
return 1

0 commit comments

Comments
 (0)