pydantic-ai-slim 0.4.3__py3-none-any.whl → 0.4.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pydantic-ai-slim might be problematic. Click here for more details.
- pydantic_ai/_agent_graph.py +220 -319
- pydantic_ai/_cli.py +9 -7
- pydantic_ai/_output.py +295 -331
- pydantic_ai/_parts_manager.py +2 -2
- pydantic_ai/_run_context.py +8 -14
- pydantic_ai/_tool_manager.py +190 -0
- pydantic_ai/_utils.py +18 -1
- pydantic_ai/ag_ui.py +675 -0
- pydantic_ai/agent.py +369 -156
- pydantic_ai/exceptions.py +12 -0
- pydantic_ai/ext/aci.py +12 -3
- pydantic_ai/ext/langchain.py +9 -1
- pydantic_ai/mcp.py +147 -84
- pydantic_ai/messages.py +13 -5
- pydantic_ai/models/__init__.py +30 -18
- pydantic_ai/models/anthropic.py +1 -1
- pydantic_ai/models/function.py +50 -24
- pydantic_ai/models/gemini.py +1 -9
- pydantic_ai/models/google.py +2 -11
- pydantic_ai/models/groq.py +1 -0
- pydantic_ai/models/mistral.py +1 -1
- pydantic_ai/models/openai.py +3 -3
- pydantic_ai/output.py +21 -7
- pydantic_ai/profiles/google.py +1 -1
- pydantic_ai/profiles/moonshotai.py +8 -0
- pydantic_ai/providers/grok.py +13 -1
- pydantic_ai/providers/groq.py +2 -0
- pydantic_ai/result.py +58 -45
- pydantic_ai/tools.py +26 -119
- pydantic_ai/toolsets/__init__.py +22 -0
- pydantic_ai/toolsets/abstract.py +155 -0
- pydantic_ai/toolsets/combined.py +88 -0
- pydantic_ai/toolsets/deferred.py +38 -0
- pydantic_ai/toolsets/filtered.py +24 -0
- pydantic_ai/toolsets/function.py +238 -0
- pydantic_ai/toolsets/prefixed.py +37 -0
- pydantic_ai/toolsets/prepared.py +36 -0
- pydantic_ai/toolsets/renamed.py +42 -0
- pydantic_ai/toolsets/wrapper.py +37 -0
- pydantic_ai/usage.py +14 -8
- {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.4.dist-info}/METADATA +10 -7
- {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.4.dist-info}/RECORD +45 -32
- {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.4.dist-info}/WHEEL +0 -0
- {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.4.dist-info}/entry_points.txt +0 -0
- {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.4.dist-info}/licenses/LICENSE +0 -0
pydantic_ai/_cli.py
CHANGED
|
@@ -38,7 +38,7 @@ try:
|
|
|
38
38
|
from rich.text import Text
|
|
39
39
|
except ImportError as _import_error:
|
|
40
40
|
raise ImportError(
|
|
41
|
-
'Please install `rich`, `prompt-toolkit` and `argcomplete` to use the
|
|
41
|
+
'Please install `rich`, `prompt-toolkit` and `argcomplete` to use the Pydantic AI CLI, '
|
|
42
42
|
'you can use the `cli` optional group — `pip install "pydantic-ai-slim[cli]"`'
|
|
43
43
|
) from _import_error
|
|
44
44
|
|
|
@@ -47,7 +47,7 @@ __all__ = 'cli', 'cli_exit'
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
PYDANTIC_AI_HOME = Path.home() / '.pydantic-ai'
|
|
50
|
-
"""The home directory for
|
|
50
|
+
"""The home directory for Pydantic AI CLI.
|
|
51
51
|
|
|
52
52
|
This folder is used to store the prompt history and configuration.
|
|
53
53
|
"""
|
|
@@ -101,12 +101,14 @@ def cli_exit(prog_name: str = 'pai'): # pragma: no cover
|
|
|
101
101
|
sys.exit(cli(prog_name=prog_name))
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
def cli(
|
|
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:
|
|
105
107
|
"""Run the CLI and return the exit code for the process."""
|
|
106
108
|
parser = argparse.ArgumentParser(
|
|
107
109
|
prog=prog_name,
|
|
108
110
|
description=f"""\
|
|
109
|
-
|
|
111
|
+
Pydantic AI CLI v{__version__}\n\n
|
|
110
112
|
|
|
111
113
|
Special prompts:
|
|
112
114
|
* `/exit` - exit the interactive mode (ctrl-c and ctrl-d also work)
|
|
@@ -120,7 +122,7 @@ Special prompts:
|
|
|
120
122
|
'-m',
|
|
121
123
|
'--model',
|
|
122
124
|
nargs='?',
|
|
123
|
-
help='Model to use, in format "<provider>:<model>" e.g. "openai:gpt-
|
|
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}".',
|
|
124
126
|
)
|
|
125
127
|
# we don't want to autocomplete or list models that don't include the provider,
|
|
126
128
|
# e.g. we want to show `openai:gpt-4o` but not `gpt-4o`
|
|
@@ -151,7 +153,7 @@ Special prompts:
|
|
|
151
153
|
args = parser.parse_args(args_list)
|
|
152
154
|
|
|
153
155
|
console = Console()
|
|
154
|
-
name_version = f'[green]{prog_name} -
|
|
156
|
+
name_version = f'[green]{prog_name} - Pydantic AI CLI v{__version__}[/green]'
|
|
155
157
|
if args.version:
|
|
156
158
|
console.print(name_version, highlight=False)
|
|
157
159
|
return 0
|
|
@@ -179,7 +181,7 @@ Special prompts:
|
|
|
179
181
|
model_arg_set = args.model is not None
|
|
180
182
|
if agent.model is None or model_arg_set:
|
|
181
183
|
try:
|
|
182
|
-
agent.model = infer_model(args.model or
|
|
184
|
+
agent.model = infer_model(args.model or default_model)
|
|
183
185
|
except UserError as e:
|
|
184
186
|
console.print(f'Error initializing [magenta]{args.model}[/magenta]:\n[red]{e}[/red]')
|
|
185
187
|
return 1
|