pydantic-ai-slim 0.4.1__py3-none-any.whl → 0.4.3__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/__init__.py +2 -1
- pydantic_ai/_a2a.py +3 -4
- pydantic_ai/_agent_graph.py +5 -2
- pydantic_ai/_output.py +130 -20
- pydantic_ai/_utils.py +6 -1
- pydantic_ai/agent.py +13 -10
- pydantic_ai/common_tools/duckduckgo.py +5 -2
- pydantic_ai/exceptions.py +2 -2
- pydantic_ai/messages.py +6 -4
- pydantic_ai/models/__init__.py +34 -1
- pydantic_ai/models/anthropic.py +5 -2
- pydantic_ai/models/bedrock.py +5 -2
- pydantic_ai/models/cohere.py +5 -2
- pydantic_ai/models/fallback.py +1 -0
- pydantic_ai/models/function.py +13 -2
- pydantic_ai/models/gemini.py +13 -10
- pydantic_ai/models/google.py +5 -2
- pydantic_ai/models/groq.py +5 -2
- pydantic_ai/models/huggingface.py +463 -0
- pydantic_ai/models/instrumented.py +12 -12
- pydantic_ai/models/mistral.py +6 -3
- pydantic_ai/models/openai.py +16 -4
- pydantic_ai/models/test.py +22 -1
- pydantic_ai/models/wrapper.py +6 -0
- pydantic_ai/output.py +65 -1
- pydantic_ai/providers/__init__.py +4 -0
- pydantic_ai/providers/google.py +2 -2
- pydantic_ai/providers/google_vertex.py +10 -5
- pydantic_ai/providers/huggingface.py +88 -0
- pydantic_ai/result.py +16 -5
- {pydantic_ai_slim-0.4.1.dist-info → pydantic_ai_slim-0.4.3.dist-info}/METADATA +7 -5
- {pydantic_ai_slim-0.4.1.dist-info → pydantic_ai_slim-0.4.3.dist-info}/RECORD +35 -33
- {pydantic_ai_slim-0.4.1.dist-info → pydantic_ai_slim-0.4.3.dist-info}/WHEEL +0 -0
- {pydantic_ai_slim-0.4.1.dist-info → pydantic_ai_slim-0.4.3.dist-info}/entry_points.txt +0 -0
- {pydantic_ai_slim-0.4.1.dist-info → pydantic_ai_slim-0.4.3.dist-info}/licenses/LICENSE +0 -0
pydantic_ai/models/test.py
CHANGED
|
@@ -24,6 +24,7 @@ from ..messages import (
|
|
|
24
24
|
ToolCallPart,
|
|
25
25
|
ToolReturnPart,
|
|
26
26
|
)
|
|
27
|
+
from ..profiles import ModelProfileSpec
|
|
27
28
|
from ..settings import ModelSettings
|
|
28
29
|
from ..tools import ToolDefinition
|
|
29
30
|
from ..usage import Usage
|
|
@@ -45,7 +46,7 @@ class _WrappedToolOutput:
|
|
|
45
46
|
value: Any | None
|
|
46
47
|
|
|
47
48
|
|
|
48
|
-
@dataclass
|
|
49
|
+
@dataclass(init=False)
|
|
49
50
|
class TestModel(Model):
|
|
50
51
|
"""A model specifically for testing purposes.
|
|
51
52
|
|
|
@@ -79,6 +80,26 @@ class TestModel(Model):
|
|
|
79
80
|
_model_name: str = field(default='test', repr=False)
|
|
80
81
|
_system: str = field(default='test', repr=False)
|
|
81
82
|
|
|
83
|
+
def __init__(
|
|
84
|
+
self,
|
|
85
|
+
*,
|
|
86
|
+
call_tools: list[str] | Literal['all'] = 'all',
|
|
87
|
+
custom_output_text: str | None = None,
|
|
88
|
+
custom_output_args: Any | None = None,
|
|
89
|
+
seed: int = 0,
|
|
90
|
+
profile: ModelProfileSpec | None = None,
|
|
91
|
+
settings: ModelSettings | None = None,
|
|
92
|
+
):
|
|
93
|
+
"""Initialize TestModel with optional settings and profile."""
|
|
94
|
+
self.call_tools = call_tools
|
|
95
|
+
self.custom_output_text = custom_output_text
|
|
96
|
+
self.custom_output_args = custom_output_args
|
|
97
|
+
self.seed = seed
|
|
98
|
+
self.last_model_request_parameters = None
|
|
99
|
+
self._model_name = 'test'
|
|
100
|
+
self._system = 'test'
|
|
101
|
+
super().__init__(settings=settings, profile=profile)
|
|
102
|
+
|
|
82
103
|
async def request(
|
|
83
104
|
self,
|
|
84
105
|
messages: list[ModelMessage],
|
pydantic_ai/models/wrapper.py
CHANGED
|
@@ -23,6 +23,7 @@ class WrapperModel(Model):
|
|
|
23
23
|
"""The underlying model being wrapped."""
|
|
24
24
|
|
|
25
25
|
def __init__(self, wrapped: Model | KnownModelName):
|
|
26
|
+
super().__init__()
|
|
26
27
|
self.wrapped = infer_model(wrapped)
|
|
27
28
|
|
|
28
29
|
async def request(self, *args: Any, **kwargs: Any) -> ModelResponse:
|
|
@@ -53,5 +54,10 @@ class WrapperModel(Model):
|
|
|
53
54
|
def profile(self) -> ModelProfile:
|
|
54
55
|
return self.wrapped.profile
|
|
55
56
|
|
|
57
|
+
@property
|
|
58
|
+
def settings(self) -> ModelSettings | None:
|
|
59
|
+
"""Get the settings from the wrapped model."""
|
|
60
|
+
return self.wrapped.settings
|
|
61
|
+
|
|
56
62
|
def __getattr__(self, item: str):
|
|
57
63
|
return getattr(self.wrapped, item) # pragma: no cover
|
pydantic_ai/output.py
CHANGED
|
@@ -2,10 +2,14 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
from collections.abc import Awaitable, Sequence
|
|
4
4
|
from dataclasses import dataclass
|
|
5
|
-
from typing import Callable, Generic, Literal, Union
|
|
5
|
+
from typing import Any, Callable, Generic, Literal, Union
|
|
6
6
|
|
|
7
|
+
from pydantic import GetCoreSchemaHandler, GetJsonSchemaHandler
|
|
8
|
+
from pydantic.json_schema import JsonSchemaValue
|
|
9
|
+
from pydantic_core import core_schema
|
|
7
10
|
from typing_extensions import TypeAliasType, TypeVar
|
|
8
11
|
|
|
12
|
+
from . import _utils
|
|
9
13
|
from .tools import RunContext
|
|
10
14
|
|
|
11
15
|
__all__ = (
|
|
@@ -14,6 +18,7 @@ __all__ = (
|
|
|
14
18
|
'NativeOutput',
|
|
15
19
|
'PromptedOutput',
|
|
16
20
|
'TextOutput',
|
|
21
|
+
'StructuredDict',
|
|
17
22
|
# types
|
|
18
23
|
'OutputDataT',
|
|
19
24
|
'OutputMode',
|
|
@@ -266,6 +271,65 @@ class TextOutput(Generic[OutputDataT]):
|
|
|
266
271
|
"""The function that will be called to process the model's plain text output. The function must take a single string argument."""
|
|
267
272
|
|
|
268
273
|
|
|
274
|
+
def StructuredDict(
|
|
275
|
+
json_schema: JsonSchemaValue, name: str | None = None, description: str | None = None
|
|
276
|
+
) -> type[JsonSchemaValue]:
|
|
277
|
+
"""Returns a `dict[str, Any]` subclass with a JSON schema attached that will be used for structured output.
|
|
278
|
+
|
|
279
|
+
Args:
|
|
280
|
+
json_schema: A JSON schema of type `object` defining the structure of the dictionary content.
|
|
281
|
+
name: Optional name of the structured output. If not provided, the `title` field of the JSON schema will be used if it's present.
|
|
282
|
+
description: Optional description of the structured output. If not provided, the `description` field of the JSON schema will be used if it's present.
|
|
283
|
+
|
|
284
|
+
Example:
|
|
285
|
+
```python {title="structured_dict.py"}
|
|
286
|
+
from pydantic_ai import Agent, StructuredDict
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
schema = {
|
|
290
|
+
"type": "object",
|
|
291
|
+
"properties": {
|
|
292
|
+
"name": {"type": "string"},
|
|
293
|
+
"age": {"type": "integer"}
|
|
294
|
+
},
|
|
295
|
+
"required": ["name", "age"]
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
agent = Agent('openai:gpt-4o', output_type=StructuredDict(schema))
|
|
299
|
+
result = agent.run_sync("Create a person")
|
|
300
|
+
print(result.output)
|
|
301
|
+
#> {'name': 'John Doe', 'age': 30}
|
|
302
|
+
```
|
|
303
|
+
"""
|
|
304
|
+
json_schema = _utils.check_object_json_schema(json_schema)
|
|
305
|
+
|
|
306
|
+
if name:
|
|
307
|
+
json_schema['title'] = name
|
|
308
|
+
|
|
309
|
+
if description:
|
|
310
|
+
json_schema['description'] = description
|
|
311
|
+
|
|
312
|
+
class _StructuredDict(JsonSchemaValue):
|
|
313
|
+
__is_model_like__ = True
|
|
314
|
+
|
|
315
|
+
@classmethod
|
|
316
|
+
def __get_pydantic_core_schema__(
|
|
317
|
+
cls, source_type: Any, handler: GetCoreSchemaHandler
|
|
318
|
+
) -> core_schema.CoreSchema:
|
|
319
|
+
return core_schema.dict_schema(
|
|
320
|
+
keys_schema=core_schema.str_schema(),
|
|
321
|
+
values_schema=core_schema.any_schema(),
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
@classmethod
|
|
325
|
+
def __get_pydantic_json_schema__(
|
|
326
|
+
cls, core_schema: core_schema.CoreSchema, handler: GetJsonSchemaHandler
|
|
327
|
+
) -> JsonSchemaValue:
|
|
328
|
+
return json_schema
|
|
329
|
+
|
|
330
|
+
return _StructuredDict
|
|
331
|
+
|
|
332
|
+
|
|
269
333
|
OutputSpec = TypeAliasType(
|
|
270
334
|
'OutputSpec',
|
|
271
335
|
Union[
|
|
@@ -111,6 +111,10 @@ def infer_provider_class(provider: str) -> type[Provider[Any]]: # noqa: C901
|
|
|
111
111
|
from .heroku import HerokuProvider
|
|
112
112
|
|
|
113
113
|
return HerokuProvider
|
|
114
|
+
elif provider == 'huggingface':
|
|
115
|
+
from .huggingface import HuggingFaceProvider
|
|
116
|
+
|
|
117
|
+
return HuggingFaceProvider
|
|
114
118
|
elif provider == 'github':
|
|
115
119
|
from .github import GitHubProvider
|
|
116
120
|
|
pydantic_ai/providers/google.py
CHANGED
|
@@ -86,7 +86,7 @@ class GoogleProvider(Provider[genai.Client]):
|
|
|
86
86
|
# NOTE: We are keeping GEMINI_API_KEY for backwards compatibility.
|
|
87
87
|
api_key = api_key or os.getenv('GOOGLE_API_KEY') or os.getenv('GEMINI_API_KEY')
|
|
88
88
|
|
|
89
|
-
if vertexai is None:
|
|
89
|
+
if vertexai is None:
|
|
90
90
|
vertexai = bool(location or project or credentials)
|
|
91
91
|
|
|
92
92
|
if not vertexai:
|
|
@@ -114,7 +114,7 @@ class GoogleProvider(Provider[genai.Client]):
|
|
|
114
114
|
http_options={'headers': {'User-Agent': get_user_agent()}},
|
|
115
115
|
)
|
|
116
116
|
else:
|
|
117
|
-
self._client = client
|
|
117
|
+
self._client = client
|
|
118
118
|
|
|
119
119
|
|
|
120
120
|
VertexAILocation = Literal[
|
|
@@ -50,7 +50,7 @@ class GoogleVertexProvider(Provider[httpx.AsyncClient]):
|
|
|
50
50
|
return self._client
|
|
51
51
|
|
|
52
52
|
def model_profile(self, model_name: str) -> ModelProfile | None:
|
|
53
|
-
return google_model_profile(model_name)
|
|
53
|
+
return google_model_profile(model_name)
|
|
54
54
|
|
|
55
55
|
@overload
|
|
56
56
|
def __init__(
|
|
@@ -116,6 +116,8 @@ class GoogleVertexProvider(Provider[httpx.AsyncClient]):
|
|
|
116
116
|
class _VertexAIAuth(httpx.Auth):
|
|
117
117
|
"""Auth class for Vertex AI API."""
|
|
118
118
|
|
|
119
|
+
_refresh_lock: anyio.Lock = anyio.Lock()
|
|
120
|
+
|
|
119
121
|
credentials: BaseCredentials | ServiceAccountCredentials | None
|
|
120
122
|
|
|
121
123
|
def __init__(
|
|
@@ -169,10 +171,13 @@ class _VertexAIAuth(httpx.Auth):
|
|
|
169
171
|
return creds
|
|
170
172
|
|
|
171
173
|
async def _refresh_token(self) -> str: # pragma: no cover
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
async with self._refresh_lock:
|
|
175
|
+
assert self.credentials is not None
|
|
176
|
+
await anyio.to_thread.run_sync(self.credentials.refresh, Request()) # type: ignore[reportUnknownMemberType]
|
|
177
|
+
assert isinstance(self.credentials.token, str), ( # type: ignore[reportUnknownMemberType]
|
|
178
|
+
f'Expected token to be a string, got {self.credentials.token}' # type: ignore[reportUnknownMemberType]
|
|
179
|
+
)
|
|
180
|
+
return self.credentials.token
|
|
176
181
|
|
|
177
182
|
|
|
178
183
|
async def _async_google_auth() -> tuple[BaseCredentials, str | None]:
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from __future__ import annotations as _annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
from typing import overload
|
|
5
|
+
|
|
6
|
+
from httpx import AsyncClient
|
|
7
|
+
|
|
8
|
+
from pydantic_ai.exceptions import UserError
|
|
9
|
+
|
|
10
|
+
try:
|
|
11
|
+
from huggingface_hub import AsyncInferenceClient
|
|
12
|
+
except ImportError as _import_error: # pragma: no cover
|
|
13
|
+
raise ImportError(
|
|
14
|
+
'Please install the `huggingface_hub` package to use the HuggingFace provider, '
|
|
15
|
+
"you can use the `huggingface` optional group — `pip install 'pydantic-ai-slim[huggingface]'`"
|
|
16
|
+
) from _import_error
|
|
17
|
+
|
|
18
|
+
from . import Provider
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class HuggingFaceProvider(Provider[AsyncInferenceClient]):
|
|
22
|
+
"""Provider for Hugging Face."""
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def name(self) -> str:
|
|
26
|
+
return 'huggingface'
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def base_url(self) -> str:
|
|
30
|
+
return self.client.model # type: ignore
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def client(self) -> AsyncInferenceClient:
|
|
34
|
+
return self._client
|
|
35
|
+
|
|
36
|
+
@overload
|
|
37
|
+
def __init__(self, *, base_url: str, api_key: str | None = None) -> None: ...
|
|
38
|
+
@overload
|
|
39
|
+
def __init__(self, *, provider_name: str, api_key: str | None = None) -> None: ...
|
|
40
|
+
@overload
|
|
41
|
+
def __init__(self, *, hf_client: AsyncInferenceClient, api_key: str | None = None) -> None: ...
|
|
42
|
+
@overload
|
|
43
|
+
def __init__(self, *, hf_client: AsyncInferenceClient, base_url: str, api_key: str | None = None) -> None: ...
|
|
44
|
+
@overload
|
|
45
|
+
def __init__(self, *, hf_client: AsyncInferenceClient, provider_name: str, api_key: str | None = None) -> None: ...
|
|
46
|
+
@overload
|
|
47
|
+
def __init__(self, *, api_key: str | None = None) -> None: ...
|
|
48
|
+
|
|
49
|
+
def __init__(
|
|
50
|
+
self,
|
|
51
|
+
base_url: str | None = None,
|
|
52
|
+
api_key: str | None = None,
|
|
53
|
+
hf_client: AsyncInferenceClient | None = None,
|
|
54
|
+
http_client: AsyncClient | None = None,
|
|
55
|
+
provider_name: str | None = None,
|
|
56
|
+
) -> None:
|
|
57
|
+
"""Create a new Hugging Face provider.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
base_url: The base url for the Hugging Face requests.
|
|
61
|
+
api_key: The API key to use for authentication, if not provided, the `HF_TOKEN` environment variable
|
|
62
|
+
will be used if available.
|
|
63
|
+
hf_client: An existing
|
|
64
|
+
[`AsyncInferenceClient`](https://huggingface.co/docs/huggingface_hub/v0.29.3/en/package_reference/inference_client#huggingface_hub.AsyncInferenceClient)
|
|
65
|
+
client to use. If not provided, a new instance will be created.
|
|
66
|
+
http_client: (currently ignored) An existing `httpx.AsyncClient` to use for making HTTP requests.
|
|
67
|
+
provider_name : Name of the provider to use for inference. available providers can be found in the [HF Inference Providers documentation](https://huggingface.co/docs/inference-providers/index#partners).
|
|
68
|
+
defaults to "auto", which will select the first available provider for the model, the first of the providers available for the model, sorted by the user's order in https://hf.co/settings/inference-providers.
|
|
69
|
+
If `base_url` is passed, then `provider_name` is not used.
|
|
70
|
+
"""
|
|
71
|
+
api_key = api_key or os.environ.get('HF_TOKEN')
|
|
72
|
+
|
|
73
|
+
if api_key is None:
|
|
74
|
+
raise UserError(
|
|
75
|
+
'Set the `HF_TOKEN` environment variable or pass it via `HuggingFaceProvider(api_key=...)`'
|
|
76
|
+
'to use the HuggingFace provider.'
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
if http_client is not None:
|
|
80
|
+
raise ValueError('`http_client` is ignored for HuggingFace provider, please use `hf_client` instead.')
|
|
81
|
+
|
|
82
|
+
if base_url is not None and provider_name is not None:
|
|
83
|
+
raise ValueError('Cannot provide both `base_url` and `provider_name`.')
|
|
84
|
+
|
|
85
|
+
if hf_client is None:
|
|
86
|
+
self._client = AsyncInferenceClient(api_key=api_key, provider=provider_name, base_url=base_url) # type: ignore
|
|
87
|
+
else:
|
|
88
|
+
self._client = hf_client
|
pydantic_ai/result.py
CHANGED
|
@@ -19,6 +19,7 @@ from ._output import (
|
|
|
19
19
|
PlainTextOutputSchema,
|
|
20
20
|
TextOutputSchema,
|
|
21
21
|
ToolOutputSchema,
|
|
22
|
+
TraceContext,
|
|
22
23
|
)
|
|
23
24
|
from ._run_context import AgentDepsT, RunContext
|
|
24
25
|
from .messages import AgentStreamEvent, FinalResultEvent
|
|
@@ -46,6 +47,7 @@ class AgentStream(Generic[AgentDepsT, OutputDataT]):
|
|
|
46
47
|
_output_schema: OutputSchema[OutputDataT]
|
|
47
48
|
_output_validators: list[OutputValidator[AgentDepsT, OutputDataT]]
|
|
48
49
|
_run_ctx: RunContext[AgentDepsT]
|
|
50
|
+
_trace_ctx: TraceContext
|
|
49
51
|
_usage_limits: UsageLimits | None
|
|
50
52
|
|
|
51
53
|
_agent_stream_iterator: AsyncIterator[AgentStreamEvent] | None = field(default=None, init=False)
|
|
@@ -105,13 +107,17 @@ class AgentStream(Generic[AgentDepsT, OutputDataT]):
|
|
|
105
107
|
|
|
106
108
|
call, output_tool = match
|
|
107
109
|
result_data = await output_tool.process(
|
|
108
|
-
call,
|
|
110
|
+
call,
|
|
111
|
+
self._run_ctx,
|
|
112
|
+
self._trace_ctx,
|
|
113
|
+
allow_partial=allow_partial,
|
|
114
|
+
wrap_validation_errors=False,
|
|
109
115
|
)
|
|
110
116
|
elif isinstance(self._output_schema, TextOutputSchema):
|
|
111
117
|
text = '\n\n'.join(x.content for x in message.parts if isinstance(x, _messages.TextPart))
|
|
112
118
|
|
|
113
119
|
result_data = await self._output_schema.process(
|
|
114
|
-
text, self._run_ctx, allow_partial=allow_partial, wrap_validation_errors=False
|
|
120
|
+
text, self._run_ctx, self._trace_ctx, allow_partial=allow_partial, wrap_validation_errors=False
|
|
115
121
|
)
|
|
116
122
|
else:
|
|
117
123
|
raise exceptions.UnexpectedModelBehavior( # pragma: no cover
|
|
@@ -177,6 +183,7 @@ class StreamedRunResult(Generic[AgentDepsT, OutputDataT]):
|
|
|
177
183
|
_stream_response: models.StreamedResponse
|
|
178
184
|
_output_schema: OutputSchema[OutputDataT]
|
|
179
185
|
_run_ctx: RunContext[AgentDepsT]
|
|
186
|
+
_trace_ctx: TraceContext
|
|
180
187
|
_output_validators: list[OutputValidator[AgentDepsT, OutputDataT]]
|
|
181
188
|
_output_tool_name: str | None
|
|
182
189
|
_on_complete: Callable[[], Awaitable[None]]
|
|
@@ -320,7 +327,7 @@ class StreamedRunResult(Generic[AgentDepsT, OutputDataT]):
|
|
|
320
327
|
yield await self.validate_structured_output(structured_message, allow_partial=not is_last)
|
|
321
328
|
except ValidationError:
|
|
322
329
|
if is_last:
|
|
323
|
-
raise # pragma:
|
|
330
|
+
raise # pragma: no cover
|
|
324
331
|
|
|
325
332
|
async def stream_text(self, *, delta: bool = False, debounce_by: float | None = 0.1) -> AsyncIterator[str]:
|
|
326
333
|
"""Stream the text result as an async iterable.
|
|
@@ -423,13 +430,17 @@ class StreamedRunResult(Generic[AgentDepsT, OutputDataT]):
|
|
|
423
430
|
|
|
424
431
|
call, output_tool = match
|
|
425
432
|
result_data = await output_tool.process(
|
|
426
|
-
call,
|
|
433
|
+
call,
|
|
434
|
+
self._run_ctx,
|
|
435
|
+
self._trace_ctx,
|
|
436
|
+
allow_partial=allow_partial,
|
|
437
|
+
wrap_validation_errors=False,
|
|
427
438
|
)
|
|
428
439
|
elif isinstance(self._output_schema, TextOutputSchema):
|
|
429
440
|
text = '\n\n'.join(x.content for x in message.parts if isinstance(x, _messages.TextPart))
|
|
430
441
|
|
|
431
442
|
result_data = await self._output_schema.process(
|
|
432
|
-
text, self._run_ctx, allow_partial=allow_partial, wrap_validation_errors=False
|
|
443
|
+
text, self._run_ctx, self._trace_ctx, allow_partial=allow_partial, wrap_validation_errors=False
|
|
433
444
|
)
|
|
434
445
|
else:
|
|
435
446
|
raise exceptions.UnexpectedModelBehavior( # pragma: no cover
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydantic-ai-slim
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
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
|
|
@@ -30,11 +30,11 @@ Requires-Dist: exceptiongroup; python_version < '3.11'
|
|
|
30
30
|
Requires-Dist: griffe>=1.3.2
|
|
31
31
|
Requires-Dist: httpx>=0.27
|
|
32
32
|
Requires-Dist: opentelemetry-api>=1.28.0
|
|
33
|
-
Requires-Dist: pydantic-graph==0.4.
|
|
33
|
+
Requires-Dist: pydantic-graph==0.4.3
|
|
34
34
|
Requires-Dist: pydantic>=2.10
|
|
35
35
|
Requires-Dist: typing-inspection>=0.4.0
|
|
36
36
|
Provides-Extra: a2a
|
|
37
|
-
Requires-Dist: fasta2a
|
|
37
|
+
Requires-Dist: fasta2a>=0.4.1; extra == 'a2a'
|
|
38
38
|
Provides-Extra: anthropic
|
|
39
39
|
Requires-Dist: anthropic>=0.52.0; extra == 'anthropic'
|
|
40
40
|
Provides-Extra: bedrock
|
|
@@ -46,13 +46,15 @@ Requires-Dist: rich>=13; extra == 'cli'
|
|
|
46
46
|
Provides-Extra: cohere
|
|
47
47
|
Requires-Dist: cohere>=5.13.11; (platform_system != 'Emscripten') and extra == 'cohere'
|
|
48
48
|
Provides-Extra: duckduckgo
|
|
49
|
-
Requires-Dist:
|
|
49
|
+
Requires-Dist: ddgs>=9.0.0; extra == 'duckduckgo'
|
|
50
50
|
Provides-Extra: evals
|
|
51
|
-
Requires-Dist: pydantic-evals==0.4.
|
|
51
|
+
Requires-Dist: pydantic-evals==0.4.3; extra == 'evals'
|
|
52
52
|
Provides-Extra: google
|
|
53
53
|
Requires-Dist: google-genai>=1.24.0; extra == 'google'
|
|
54
54
|
Provides-Extra: groq
|
|
55
55
|
Requires-Dist: groq>=0.19.0; extra == 'groq'
|
|
56
|
+
Provides-Extra: huggingface
|
|
57
|
+
Requires-Dist: huggingface-hub[inference]>=0.33.2; extra == 'huggingface'
|
|
56
58
|
Provides-Extra: logfire
|
|
57
59
|
Requires-Dist: logfire>=3.11.0; extra == 'logfire'
|
|
58
60
|
Provides-Extra: mcp
|
|
@@ -1,51 +1,52 @@
|
|
|
1
|
-
pydantic_ai/__init__.py,sha256=
|
|
1
|
+
pydantic_ai/__init__.py,sha256=h6Rll8pEzUUUX6SckosummoAFbq7ctfBlI6WSyaXR4I,1300
|
|
2
2
|
pydantic_ai/__main__.py,sha256=Q_zJU15DUA01YtlJ2mnaLCoId2YmgmreVEERGuQT-Y0,132
|
|
3
|
-
pydantic_ai/_a2a.py,sha256=
|
|
4
|
-
pydantic_ai/_agent_graph.py,sha256=
|
|
3
|
+
pydantic_ai/_a2a.py,sha256=PFgqW6I3qh3deY4WFfubTUroig9-NaAWxbeMxYjdtfI,12067
|
|
4
|
+
pydantic_ai/_agent_graph.py,sha256=2XGCD8Or0zIKkXJLX0jY3eLI38km4mp_jHTQ8yxFw2g,42367
|
|
5
5
|
pydantic_ai/_cli.py,sha256=R-sE-9gYqPxV5-5utso4g-bzAKMiTCdo33XOVqE0ZEg,13206
|
|
6
6
|
pydantic_ai/_function_schema.py,sha256=BZus5y51eqiGQKxQIcCiDoSPml3AtAb12-st_aujU2k,10813
|
|
7
7
|
pydantic_ai/_griffe.py,sha256=Ugft16ZHw9CN_6-lW0Svn6jESK9zHXO_x4utkGBkbBI,5253
|
|
8
8
|
pydantic_ai/_mcp.py,sha256=PuvwnlLjv7YYOa9AZJCrklevBug99zGMhwJCBGG7BHQ,5626
|
|
9
|
-
pydantic_ai/_output.py,sha256=
|
|
9
|
+
pydantic_ai/_output.py,sha256=Z30MgZ7M3WMFwud6sJDIJ-N6Yil10Q8BrTHO5z5FBv0,37954
|
|
10
10
|
pydantic_ai/_parts_manager.py,sha256=Lioi8b7Nfyax09yQu8jTkMzxd26dYDrdAqhYvjRSKqQ,16182
|
|
11
11
|
pydantic_ai/_run_context.py,sha256=zNkSyiQSH-YweO39ii3iB2taouUOodo3sTjz2Lrj4Pc,1792
|
|
12
12
|
pydantic_ai/_system_prompt.py,sha256=lUSq-gDZjlYTGtd6BUm54yEvTIvgdwBmJ8mLsNZZtYU,1142
|
|
13
13
|
pydantic_ai/_thinking_part.py,sha256=mzx2RZSfiQxAKpljEflrcXRXmFKxtp6bKVyorY3UYZk,1554
|
|
14
|
-
pydantic_ai/_utils.py,sha256=
|
|
15
|
-
pydantic_ai/agent.py,sha256=
|
|
14
|
+
pydantic_ai/_utils.py,sha256=9QSHZhbrCbUK18ckchC55OkBkP-1o6xhAxUkEMo9DSQ,15741
|
|
15
|
+
pydantic_ai/agent.py,sha256=eAWi7onlDdaXOj2DAriVtzf3cTUrAUrt-oGYx--UJiA,96481
|
|
16
16
|
pydantic_ai/direct.py,sha256=WRfgke3zm-eeR39LTuh9XI2TrdHXAqO81eDvFwih4Ko,14803
|
|
17
|
-
pydantic_ai/exceptions.py,sha256=
|
|
17
|
+
pydantic_ai/exceptions.py,sha256=1ujJeB3jDDQ-pH5ydBYrgStvR35-GlEW0bYGTGEr4ME,3127
|
|
18
18
|
pydantic_ai/format_as_xml.py,sha256=IINfh1evWDphGahqHNLBArB5dQ4NIqS3S-kru35ztGg,372
|
|
19
19
|
pydantic_ai/format_prompt.py,sha256=qdKep95Sjlr7u1-qag4JwPbjoURbG0GbeU_l5ODTNw4,4466
|
|
20
20
|
pydantic_ai/mcp.py,sha256=6RvxXIn6bUlL2XWpX69i8G3atU-HLLZBgKc93dYqeVo,21830
|
|
21
|
-
pydantic_ai/messages.py,sha256=
|
|
22
|
-
pydantic_ai/output.py,sha256=
|
|
21
|
+
pydantic_ai/messages.py,sha256=1G6cQs1tlBaCUhuv17RXyCkkiXzad6nYrjg-ZevNsjM,39421
|
|
22
|
+
pydantic_ai/output.py,sha256=HU1dIiKyCaCvSxg8U6YMRvn1U50l0D9NMvGt_wqp_xI,11512
|
|
23
23
|
pydantic_ai/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
-
pydantic_ai/result.py,sha256=
|
|
24
|
+
pydantic_ai/result.py,sha256=PQNWopb0Jb-VD7C-DtIECDX-xjqaFWi8Grhn2Tte66g,25873
|
|
25
25
|
pydantic_ai/settings.py,sha256=yuUZ7-GkdPB-Gbx71kSdh8dSr6gwM9gEwk84qNxPO_I,3552
|
|
26
26
|
pydantic_ai/tools.py,sha256=ZZ5DZMzSLMZkM9y_G3fx5YnVTki6daPYgRkfuNXAQ-M,17774
|
|
27
27
|
pydantic_ai/usage.py,sha256=35YPmItlzfNOwP35Rhh0qBUOlg5On5rUE7xqHQWrpaU,5596
|
|
28
28
|
pydantic_ai/common_tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
29
|
-
pydantic_ai/common_tools/duckduckgo.py,sha256=
|
|
29
|
+
pydantic_ai/common_tools/duckduckgo.py,sha256=aQsm7zKuoRNgPM8ltbdyj8dPkREEkQenimsf_laF6kc,2245
|
|
30
30
|
pydantic_ai/common_tools/tavily.py,sha256=Q1xxSF5HtXAaZ10Pp-OaDOHXwJf2mco9wScGEQXD7E4,2495
|
|
31
31
|
pydantic_ai/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
32
32
|
pydantic_ai/ext/aci.py,sha256=eiuWamUh90kexWyuGw_Fw2kM-EAA6Pv-IfNhf5hQ8fs,2123
|
|
33
33
|
pydantic_ai/ext/langchain.py,sha256=iSyACZiJDDvxr0BKYl9dLxe4BPezCBHxgz_2Vk3W-Ak,1973
|
|
34
|
-
pydantic_ai/models/__init__.py,sha256=
|
|
35
|
-
pydantic_ai/models/anthropic.py,sha256=
|
|
36
|
-
pydantic_ai/models/bedrock.py,sha256=
|
|
37
|
-
pydantic_ai/models/cohere.py,sha256=
|
|
38
|
-
pydantic_ai/models/fallback.py,sha256=
|
|
39
|
-
pydantic_ai/models/function.py,sha256=
|
|
40
|
-
pydantic_ai/models/gemini.py,sha256=
|
|
41
|
-
pydantic_ai/models/google.py,sha256=
|
|
42
|
-
pydantic_ai/models/groq.py,sha256=
|
|
43
|
-
pydantic_ai/models/
|
|
34
|
+
pydantic_ai/models/__init__.py,sha256=SdGY1rsTsQADjsxFbkK-8BSO_ALjTVFj5XazthwWi8w,30299
|
|
35
|
+
pydantic_ai/models/anthropic.py,sha256=DqG1Y9q3rqXYKI2I-AEWTD1jUyoAjlxnuN0FgT5CRXc,23822
|
|
36
|
+
pydantic_ai/models/bedrock.py,sha256=WnYykDnkyBd340tpt4l35T8SjT3z50RO83EZ8n77FVA,29399
|
|
37
|
+
pydantic_ai/models/cohere.py,sha256=PTqwMRsgaLGVUrzb80sh9jS6CNuvDokvPHKT5KTYR_g,12788
|
|
38
|
+
pydantic_ai/models/fallback.py,sha256=URaV-dTQWkg99xrlkmknue5lXZWDcEt7cJ1Vsky4oB4,5130
|
|
39
|
+
pydantic_ai/models/function.py,sha256=Qyvg7n9SMyhNVugd9T525OrbWYW8BQedy7kBRpHu48Q,12457
|
|
40
|
+
pydantic_ai/models/gemini.py,sha256=iyuw3FBfLsdeUT10sHz5xWXsesUrhE0yLa7R6hy8HJs,38603
|
|
41
|
+
pydantic_ai/models/google.py,sha256=w6G9rXmL0x-PCI7KyBJFlqUdQV5feCpTR2kgCi52hTI,24192
|
|
42
|
+
pydantic_ai/models/groq.py,sha256=fMT1WPkhuLH2G0iQ8IMxZ1oc7zQVgTLhzVZYydASt88,18665
|
|
43
|
+
pydantic_ai/models/huggingface.py,sha256=DTkbfySeBfRqIrbMzgUunGnIo-3mLuaDyQjBYTT42bI,18857
|
|
44
|
+
pydantic_ai/models/instrumented.py,sha256=dkVCY_SIoPEBLyAr7jODTsJWh6LzslPVzPwOfvqy3iA,16078
|
|
44
45
|
pydantic_ai/models/mcp_sampling.py,sha256=q9nnjNEAAbhrfRc_Qw5z9TtCHMG_SwlCWW9FvKWjh8k,3395
|
|
45
|
-
pydantic_ai/models/mistral.py,sha256=
|
|
46
|
-
pydantic_ai/models/openai.py,sha256=
|
|
47
|
-
pydantic_ai/models/test.py,sha256=
|
|
48
|
-
pydantic_ai/models/wrapper.py,sha256=
|
|
46
|
+
pydantic_ai/models/mistral.py,sha256=fvR5ijjOGdV3OHBKtQFPBNjNO2qXhB0hxzXZkkSLMmY,30716
|
|
47
|
+
pydantic_ai/models/openai.py,sha256=gyN9idM3164ftEW4iW9fFogKP_xQh4--ChwkHQxG-5Q,54264
|
|
48
|
+
pydantic_ai/models/test.py,sha256=S8hp3fJZJVSwWl01bBi-q7YpijdbstXhGg3aCPon98o,18227
|
|
49
|
+
pydantic_ai/models/wrapper.py,sha256=A5-ncYhPF8c9S_czGoXkd55s2KOQb65p3jbVpwZiFPA,2043
|
|
49
50
|
pydantic_ai/profiles/__init__.py,sha256=BXMqUpgRfosmYgcxjKAI9ESCj47JTSa30DhKXEgVLzM,2419
|
|
50
51
|
pydantic_ai/profiles/_json_schema.py,sha256=sTNHkaK0kbwmbldZp9JRGQNax0f5Qvwy0HkWuu_nGxU,7179
|
|
51
52
|
pydantic_ai/profiles/amazon.py,sha256=O4ijm1Lpz01vaSiHrkSeGQhbCKV5lyQVtHYqh0pCW_k,339
|
|
@@ -58,7 +59,7 @@ pydantic_ai/profiles/meta.py,sha256=IAGPoUrLWd-g9ajAgpWp9fIeOrP-7dBlZ2HEFjIhUbY,
|
|
|
58
59
|
pydantic_ai/profiles/mistral.py,sha256=ll01PmcK3szwlTfbaJLQmfd0TADN8lqjov9HpPJzCMQ,217
|
|
59
60
|
pydantic_ai/profiles/openai.py,sha256=wFFtzbM22HbxxRNDXYEs6tr6_RSbv8xN_xBPz6RsP9s,6698
|
|
60
61
|
pydantic_ai/profiles/qwen.py,sha256=u7pL8uomoQTVl45g5wDrHx0P_oFDLaN6ALswuwmkWc0,334
|
|
61
|
-
pydantic_ai/providers/__init__.py,sha256=
|
|
62
|
+
pydantic_ai/providers/__init__.py,sha256=8D685KEGzwtgeg1Z5tC9ugr_O16E1VWWmeqSgAnx69k,3779
|
|
62
63
|
pydantic_ai/providers/anthropic.py,sha256=D35UXxCPXv8yIbD0fj9Zg2FvNyoMoJMeDUtVM8Sn78I,3046
|
|
63
64
|
pydantic_ai/providers/azure.py,sha256=y77IHGiSQ9Ttx9f4SGMgdpin2Daq6eYyzUdM9ET22RQ,5819
|
|
64
65
|
pydantic_ai/providers/bedrock.py,sha256=ycdTXnkj_WNqPMA7DNDPeYia0C37FP0_l0CygSQmWYI,5694
|
|
@@ -66,18 +67,19 @@ pydantic_ai/providers/cohere.py,sha256=LT6QaLPJBBlFUgYgXQOfKpbM9SXLzorWFxI7jNfOX
|
|
|
66
67
|
pydantic_ai/providers/deepseek.py,sha256=kUdM8eVp1lse4bS_uy70Gy7wgog94NTZ36GY-vhSB50,3060
|
|
67
68
|
pydantic_ai/providers/fireworks.py,sha256=TPbqOpNgXG59qovBaHWbbV2vsvROwlHwQ3PvqHUBH-s,3626
|
|
68
69
|
pydantic_ai/providers/github.py,sha256=zPu3oVJKjUE4zIqZ0YfgcTFBNdEy5rIBrSOdPCHJEG4,4406
|
|
69
|
-
pydantic_ai/providers/google.py,sha256=
|
|
70
|
+
pydantic_ai/providers/google.py,sha256=b8MOCsawPm07HrFEZGip5OGzW3zfq3HcCDzDNwXgPY4,5946
|
|
70
71
|
pydantic_ai/providers/google_gla.py,sha256=BCF5_6EVtpkCZ6qIDuvgY1Qa9EirS71l51CBqPqk4C4,1825
|
|
71
|
-
pydantic_ai/providers/google_vertex.py,sha256=
|
|
72
|
+
pydantic_ai/providers/google_vertex.py,sha256=MN3hnZg06pp2VFAmr3o_aAeop7LHj8TbgPSaF5D6PZE,9596
|
|
72
73
|
pydantic_ai/providers/grok.py,sha256=mtlx7KP6xEDrDnYR1pmuT61wjUlYbCJNASNCDfVGQ5A,2912
|
|
73
74
|
pydantic_ai/providers/groq.py,sha256=LcD0vXiZhWOsMatz0yKzt9NCIAw6H7OhJsQ5GPDqL44,3835
|
|
74
75
|
pydantic_ai/providers/heroku.py,sha256=NmDIkAdxtWsvCjlX-bKI5FgI4HW1zO9-e0mrNQNGMCk,2990
|
|
76
|
+
pydantic_ai/providers/huggingface.py,sha256=LRmJcJpQRRYvam3IAPkYs2fMUJf70GgE3aDgQltGRCU,3821
|
|
75
77
|
pydantic_ai/providers/mistral.py,sha256=EIUSENjFuGzBhvbdrarUTM4VPkesIMnZrzfnEKHOsc4,3120
|
|
76
78
|
pydantic_ai/providers/openai.py,sha256=7iGij0EaFylab7dTZAZDgXr78tr-HsZrn9EI9AkWBNQ,3091
|
|
77
79
|
pydantic_ai/providers/openrouter.py,sha256=NXjNdnlXIBrBMMqbzcWQnowXOuZh4NHikXenBn5h3mc,4061
|
|
78
80
|
pydantic_ai/providers/together.py,sha256=zFVSMSm5jXbpkNouvBOTjWrPmlPpCp6sQS5LMSyVjrQ,3482
|
|
79
|
-
pydantic_ai_slim-0.4.
|
|
80
|
-
pydantic_ai_slim-0.4.
|
|
81
|
-
pydantic_ai_slim-0.4.
|
|
82
|
-
pydantic_ai_slim-0.4.
|
|
83
|
-
pydantic_ai_slim-0.4.
|
|
81
|
+
pydantic_ai_slim-0.4.3.dist-info/METADATA,sha256=QVhjCkzpDVNZRgtXCo4VCcuHM0gq6KhCPyPqbgH1EbM,3935
|
|
82
|
+
pydantic_ai_slim-0.4.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
83
|
+
pydantic_ai_slim-0.4.3.dist-info/entry_points.txt,sha256=kbKxe2VtDCYS06hsI7P3uZGxcVC08-FPt1rxeiMpIps,50
|
|
84
|
+
pydantic_ai_slim-0.4.3.dist-info/licenses/LICENSE,sha256=vA6Jc482lEyBBuGUfD1pYx-cM7jxvLYOxPidZ30t_PQ,1100
|
|
85
|
+
pydantic_ai_slim-0.4.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|