pydantic-ai-slim 0.1.12__tar.gz → 0.2.0__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.1.12 → pydantic_ai_slim-0.2.0}/PKG-INFO +3 -3
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/_parts_manager.py +3 -1
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/__init__.py +1 -5
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/_json_schema.py +8 -2
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/.gitignore +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/README.md +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/__init__.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/__main__.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/_agent_graph.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/_cli.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/_griffe.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/_output.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/_pydantic.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/_system_prompt.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/_utils.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/agent.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/common_tools/__init__.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/common_tools/duckduckgo.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/common_tools/tavily.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/exceptions.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/format_as_xml.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/format_prompt.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/mcp.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/messages.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/anthropic.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/bedrock.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/cohere.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/fallback.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/function.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/gemini.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/groq.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/instrumented.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/mistral.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/openai.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/test.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/models/wrapper.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/__init__.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/anthropic.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/azure.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/bedrock.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/cohere.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/deepseek.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/google_gla.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/google_vertex.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/groq.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/mistral.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/providers/openai.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/py.typed +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/result.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/settings.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/tools.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pydantic_ai/usage.py +0 -0
- {pydantic_ai_slim-0.1.12 → pydantic_ai_slim-0.2.0}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydantic-ai-slim
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
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
|
|
@@ -29,7 +29,7 @@ Requires-Dist: exceptiongroup; python_version < '3.11'
|
|
|
29
29
|
Requires-Dist: griffe>=1.3.2
|
|
30
30
|
Requires-Dist: httpx>=0.27
|
|
31
31
|
Requires-Dist: opentelemetry-api>=1.28.0
|
|
32
|
-
Requires-Dist: pydantic-graph==0.
|
|
32
|
+
Requires-Dist: pydantic-graph==0.2.0
|
|
33
33
|
Requires-Dist: pydantic>=2.10
|
|
34
34
|
Requires-Dist: typing-inspection>=0.4.0
|
|
35
35
|
Provides-Extra: anthropic
|
|
@@ -45,7 +45,7 @@ Requires-Dist: cohere>=5.13.11; (platform_system != 'Emscripten') and extra == '
|
|
|
45
45
|
Provides-Extra: duckduckgo
|
|
46
46
|
Requires-Dist: duckduckgo-search>=7.0.0; extra == 'duckduckgo'
|
|
47
47
|
Provides-Extra: evals
|
|
48
|
-
Requires-Dist: pydantic-evals==0.
|
|
48
|
+
Requires-Dist: pydantic-evals==0.2.0; extra == 'evals'
|
|
49
49
|
Provides-Extra: groq
|
|
50
50
|
Requires-Dist: groq>=0.15.0; extra == 'groq'
|
|
51
51
|
Provides-Extra: logfire
|
|
@@ -14,7 +14,7 @@ event-emitting logic.
|
|
|
14
14
|
from __future__ import annotations as _annotations
|
|
15
15
|
|
|
16
16
|
from collections.abc import Hashable
|
|
17
|
-
from dataclasses import dataclass, field
|
|
17
|
+
from dataclasses import dataclass, field, replace
|
|
18
18
|
from typing import Any, Union
|
|
19
19
|
|
|
20
20
|
from pydantic_ai.exceptions import UnexpectedModelBehavior
|
|
@@ -198,6 +198,8 @@ class ModelResponsePartsManager:
|
|
|
198
198
|
return PartStartEvent(index=part_index, part=updated_part)
|
|
199
199
|
else:
|
|
200
200
|
# We updated an existing part, so emit a PartDeltaEvent
|
|
201
|
+
if updated_part.tool_call_id and not delta.tool_call_id:
|
|
202
|
+
delta = replace(delta, tool_call_id=updated_part.tool_call_id)
|
|
201
203
|
return PartDeltaEvent(index=part_index, delta=delta)
|
|
202
204
|
|
|
203
205
|
def handle_tool_call_part(
|
|
@@ -12,7 +12,6 @@ from contextlib import asynccontextmanager, contextmanager
|
|
|
12
12
|
from dataclasses import dataclass, field
|
|
13
13
|
from datetime import datetime
|
|
14
14
|
from functools import cache
|
|
15
|
-
from typing import TYPE_CHECKING
|
|
16
15
|
|
|
17
16
|
import httpx
|
|
18
17
|
from typing_extensions import Literal, TypeAliasType
|
|
@@ -21,12 +20,9 @@ from .._parts_manager import ModelResponsePartsManager
|
|
|
21
20
|
from ..exceptions import UserError
|
|
22
21
|
from ..messages import ModelMessage, ModelRequest, ModelResponse, ModelResponseStreamEvent
|
|
23
22
|
from ..settings import ModelSettings
|
|
23
|
+
from ..tools import ToolDefinition
|
|
24
24
|
from ..usage import Usage
|
|
25
25
|
|
|
26
|
-
if TYPE_CHECKING:
|
|
27
|
-
from ..tools import ToolDefinition
|
|
28
|
-
|
|
29
|
-
|
|
30
26
|
KnownModelName = TypeAliasType(
|
|
31
27
|
'KnownModelName',
|
|
32
28
|
Literal[
|
|
@@ -25,7 +25,7 @@ class WalkJsonSchema(ABC):
|
|
|
25
25
|
self.simplify_nullable_unions = simplify_nullable_unions
|
|
26
26
|
|
|
27
27
|
self.defs: dict[str, JsonSchema] = self.schema.get('$defs', {})
|
|
28
|
-
self.refs_stack =
|
|
28
|
+
self.refs_stack: list[str] = []
|
|
29
29
|
self.recursive_refs = set[str]()
|
|
30
30
|
|
|
31
31
|
@abstractmethod
|
|
@@ -62,13 +62,16 @@ class WalkJsonSchema(ABC):
|
|
|
62
62
|
return handled
|
|
63
63
|
|
|
64
64
|
def _handle(self, schema: JsonSchema) -> JsonSchema:
|
|
65
|
+
nested_refs = 0
|
|
65
66
|
if self.prefer_inlined_defs:
|
|
66
67
|
while ref := schema.get('$ref'):
|
|
67
68
|
key = re.sub(r'^#/\$defs/', '', ref)
|
|
68
69
|
if key in self.refs_stack:
|
|
69
70
|
self.recursive_refs.add(key)
|
|
70
71
|
break # recursive ref can't be unpacked
|
|
71
|
-
self.refs_stack
|
|
72
|
+
self.refs_stack.append(key)
|
|
73
|
+
nested_refs += 1
|
|
74
|
+
|
|
72
75
|
def_schema = self.defs.get(key)
|
|
73
76
|
if def_schema is None: # pragma: no cover
|
|
74
77
|
raise UserError(f'Could not find $ref definition for {key}')
|
|
@@ -87,6 +90,9 @@ class WalkJsonSchema(ABC):
|
|
|
87
90
|
# Apply the base transform
|
|
88
91
|
schema = self.transform(schema)
|
|
89
92
|
|
|
93
|
+
if nested_refs > 0:
|
|
94
|
+
self.refs_stack = self.refs_stack[:-nested_refs]
|
|
95
|
+
|
|
90
96
|
return schema
|
|
91
97
|
|
|
92
98
|
def _handle_object(self, schema: JsonSchema) -> JsonSchema:
|
|
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
|