pydantic-ai-slim 0.2.3__tar.gz → 0.2.4__tar.gz
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_slim-0.2.3 → pydantic_ai_slim-0.2.4}/PKG-INFO +4 -5
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_cli.py +29 -21
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pyproject.toml +0 -1
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/.gitignore +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/README.md +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/__init__.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/__main__.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_a2a.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_agent_graph.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_griffe.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_output.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_parts_manager.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_pydantic.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_system_prompt.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/_utils.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/agent.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/common_tools/__init__.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/common_tools/duckduckgo.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/common_tools/tavily.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/direct.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/exceptions.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/format_as_xml.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/format_prompt.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/mcp.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/messages.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/__init__.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/_json_schema.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/anthropic.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/bedrock.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/cohere.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/fallback.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/function.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/gemini.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/groq.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/instrumented.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/mistral.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/openai.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/test.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/models/wrapper.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/__init__.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/anthropic.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/azure.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/bedrock.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/cohere.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/deepseek.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/google_gla.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/google_vertex.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/groq.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/mistral.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/providers/openai.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/py.typed +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/result.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/settings.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/tools.py +0 -0
- {pydantic_ai_slim-0.2.3 → pydantic_ai_slim-0.2.4}/pydantic_ai/usage.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydantic-ai-slim
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Agent Framework / shim to use Pydantic with LLMs, slim package
|
|
5
5
|
Author-email: Samuel Colvin <samuel@pydantic.dev>, Marcelo Trylesinski <marcelotryle@gmail.com>, David Montague <david@pydantic.dev>, Alex Hall <alex@pydantic.dev>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -26,15 +26,14 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
26
26
|
Requires-Python: >=3.9
|
|
27
27
|
Requires-Dist: eval-type-backport>=0.2.0
|
|
28
28
|
Requires-Dist: exceptiongroup; python_version < '3.11'
|
|
29
|
-
Requires-Dist: fasta2a==0.2.3
|
|
30
29
|
Requires-Dist: griffe>=1.3.2
|
|
31
30
|
Requires-Dist: httpx>=0.27
|
|
32
31
|
Requires-Dist: opentelemetry-api>=1.28.0
|
|
33
|
-
Requires-Dist: pydantic-graph==0.2.
|
|
32
|
+
Requires-Dist: pydantic-graph==0.2.4
|
|
34
33
|
Requires-Dist: pydantic>=2.10
|
|
35
34
|
Requires-Dist: typing-inspection>=0.4.0
|
|
36
35
|
Provides-Extra: a2a
|
|
37
|
-
Requires-Dist: fasta2a==0.2.
|
|
36
|
+
Requires-Dist: fasta2a==0.2.4; extra == 'a2a'
|
|
38
37
|
Provides-Extra: anthropic
|
|
39
38
|
Requires-Dist: anthropic>=0.49.0; extra == 'anthropic'
|
|
40
39
|
Provides-Extra: bedrock
|
|
@@ -48,7 +47,7 @@ Requires-Dist: cohere>=5.13.11; (platform_system != 'Emscripten') and extra == '
|
|
|
48
47
|
Provides-Extra: duckduckgo
|
|
49
48
|
Requires-Dist: duckduckgo-search>=7.0.0; extra == 'duckduckgo'
|
|
50
49
|
Provides-Extra: evals
|
|
51
|
-
Requires-Dist: pydantic-evals==0.2.
|
|
50
|
+
Requires-Dist: pydantic-evals==0.2.4; extra == 'evals'
|
|
52
51
|
Provides-Extra: groq
|
|
53
52
|
Requires-Dist: groq>=0.15.0; extra == 'groq'
|
|
54
53
|
Provides-Extra: logfire
|
|
@@ -102,7 +102,7 @@ def cli_exit(prog_name: str = 'pai'): # pragma: no cover
|
|
|
102
102
|
sys.exit(cli(prog_name=prog_name))
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
def cli(args_list: Sequence[str] | None = None, *, prog_name: str = 'pai') -> int:
|
|
105
|
+
def cli(args_list: Sequence[str] | None = None, *, prog_name: str = 'pai') -> int: # noqa: C901
|
|
106
106
|
"""Run the CLI and return the exit code for the process."""
|
|
107
107
|
parser = argparse.ArgumentParser(
|
|
108
108
|
prog=prog_name,
|
|
@@ -122,7 +122,6 @@ Special prompts:
|
|
|
122
122
|
'--model',
|
|
123
123
|
nargs='?',
|
|
124
124
|
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
|
-
default='openai:gpt-4o',
|
|
126
125
|
)
|
|
127
126
|
# we don't want to autocomplete or list models that don't include the provider,
|
|
128
127
|
# e.g. we want to show `openai:gpt-4o` but not `gpt-4o`
|
|
@@ -153,40 +152,49 @@ Special prompts:
|
|
|
153
152
|
args = parser.parse_args(args_list)
|
|
154
153
|
|
|
155
154
|
console = Console()
|
|
156
|
-
|
|
157
|
-
f'[green]{prog_name} - PydanticAI CLI v{__version__} using[/green] [magenta]{args.model}[/magenta]',
|
|
158
|
-
highlight=False,
|
|
159
|
-
)
|
|
155
|
+
name_version = f'[green]{prog_name} - PydanticAI CLI v{__version__}[/green]'
|
|
160
156
|
if args.version:
|
|
157
|
+
console.print(name_version, highlight=False)
|
|
161
158
|
return 0
|
|
162
159
|
if args.list_models:
|
|
163
|
-
console.print('Available models:
|
|
160
|
+
console.print(f'{name_version}\n\n[green]Available models:[/green]')
|
|
164
161
|
for model in qualified_model_names:
|
|
165
162
|
console.print(f' {model}', highlight=False)
|
|
166
163
|
return 0
|
|
167
164
|
|
|
168
165
|
agent: Agent[None, str] = cli_agent
|
|
169
166
|
if args.agent:
|
|
167
|
+
sys.path.append(os.getcwd())
|
|
170
168
|
try:
|
|
171
|
-
current_path = os.getcwd()
|
|
172
|
-
sys.path.append(current_path)
|
|
173
|
-
|
|
174
169
|
module_path, variable_name = args.agent.split(':')
|
|
175
|
-
module = importlib.import_module(module_path)
|
|
176
|
-
agent = getattr(module, variable_name)
|
|
177
|
-
if not isinstance(agent, Agent):
|
|
178
|
-
console.print(f'[red]Error: {args.agent} is not an Agent instance[/red]')
|
|
179
|
-
return 1
|
|
180
|
-
console.print(f'[green]Using custom agent:[/green] [magenta]{args.agent}[/magenta]', highlight=False)
|
|
181
170
|
except ValueError:
|
|
182
171
|
console.print('[red]Error: Agent must be specified in "module:variable" format[/red]')
|
|
183
172
|
return 1
|
|
184
173
|
|
|
185
|
-
|
|
186
|
-
agent
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
174
|
+
module = importlib.import_module(module_path)
|
|
175
|
+
agent = getattr(module, variable_name)
|
|
176
|
+
if not isinstance(agent, Agent):
|
|
177
|
+
console.print(f'[red]Error: {args.agent} is not an Agent instance[/red]')
|
|
178
|
+
return 1
|
|
179
|
+
|
|
180
|
+
model_arg_set = args.model is not None
|
|
181
|
+
if agent.model is None or model_arg_set:
|
|
182
|
+
try:
|
|
183
|
+
agent.model = infer_model(args.model or 'openai:gpt-4o')
|
|
184
|
+
except UserError as e:
|
|
185
|
+
console.print(f'Error initializing [magenta]{args.model}[/magenta]:\n[red]{e}[/red]')
|
|
186
|
+
return 1
|
|
187
|
+
|
|
188
|
+
model_name = agent.model if isinstance(agent.model, str) else f'{agent.model.system}:{agent.model.model_name}'
|
|
189
|
+
if args.agent and model_arg_set:
|
|
190
|
+
console.print(
|
|
191
|
+
f'{name_version} using custom agent [magenta]{args.agent}[/magenta] with [magenta]{model_name}[/magenta]',
|
|
192
|
+
highlight=False,
|
|
193
|
+
)
|
|
194
|
+
elif args.agent:
|
|
195
|
+
console.print(f'{name_version} using custom agent [magenta]{args.agent}[/magenta]', highlight=False)
|
|
196
|
+
else:
|
|
197
|
+
console.print(f'{name_version} with [magenta]{model_name}[/magenta]', highlight=False)
|
|
190
198
|
|
|
191
199
|
stream = not args.no_stream
|
|
192
200
|
if args.code_theme == 'light':
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|