pydantic-ai 0.0.25__tar.gz → 0.0.27__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 might be problematic. Click here for more details.
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/PKG-INFO +3 -3
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/pyproject.toml +3 -3
- pydantic_ai-0.0.27/tests/assets/kiwi.png +0 -0
- pydantic_ai-0.0.27/tests/assets/marcelo.mp3 +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/conftest.py +50 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/graph/test_history.py +1 -1
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/graph/test_state.py +1 -1
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/json_body_serializer.py +1 -1
- pydantic_ai-0.0.27/tests/models/cassettes/test_anthropic/test_image_url_input.yaml +662 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/cassettes/test_anthropic/test_multiple_parallel_tool_calls.yaml +22 -22
- pydantic_ai-0.0.27/tests/models/cassettes/test_gemini/test_image_as_binary_content_input.yaml +85 -0
- pydantic_ai-0.0.27/tests/models/cassettes/test_gemini/test_image_url_input.yaml +6903 -0
- pydantic_ai-0.0.27/tests/models/cassettes/test_groq/test_image_as_binary_content_input.yaml +74 -0
- pydantic_ai-0.0.27/tests/models/cassettes/test_groq/test_image_url_input.yaml +84 -0
- pydantic_ai-0.0.27/tests/models/cassettes/test_openai/test_audio_as_binary_content_input.yaml +85 -0
- pydantic_ai-0.0.27/tests/models/cassettes/test_openai/test_image_as_binary_content_input.yaml +82 -0
- pydantic_ai-0.0.27/tests/models/cassettes/test_openai/test_openai_o1_mini_system_role[developer].yaml +59 -0
- pydantic_ai-0.0.27/tests/models/cassettes/test_openai/test_openai_o1_mini_system_role[system].yaml +61 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/mock_async_stream.py +5 -1
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_anthropic.py +76 -20
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_cohere.py +52 -11
- pydantic_ai-0.0.27/tests/models/test_fallback.py +207 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_gemini.py +38 -12
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_groq.py +97 -19
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_mistral.py +138 -86
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_model_function.py +23 -21
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_model_test.py +2 -2
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_openai.py +127 -27
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_agent.py +18 -18
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_examples.py +34 -4
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_streaming.py +8 -8
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/.gitignore +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/LICENSE +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/Makefile +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/README.md +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/__init__.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/example_modules/README.md +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/example_modules/bank_database.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/example_modules/fake_database.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/example_modules/weather_service.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/graph/__init__.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/graph/test_graph.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/graph/test_mermaid.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/import_examples.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/__init__.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_instrumented.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_model.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_model_names.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/models/test_vertexai.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_deps.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_format_as_xml.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_json_body_serializer.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_live.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_logfire.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_parts_manager.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_tools.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_usage_limits.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/test_utils.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/typed_agent.py +0 -0
- {pydantic_ai-0.0.25 → pydantic_ai-0.0.27}/tests/typed_graph.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pydantic-ai
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.27
|
|
4
4
|
Summary: Agent Framework / shim to use Pydantic with LLMs
|
|
5
5
|
Project-URL: Homepage, https://ai.pydantic.dev
|
|
6
6
|
Project-URL: Source, https://github.com/pydantic/pydantic-ai
|
|
@@ -28,9 +28,9 @@ Classifier: Topic :: Internet
|
|
|
28
28
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
29
29
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
30
30
|
Requires-Python: >=3.9
|
|
31
|
-
Requires-Dist: pydantic-ai-slim[anthropic,cohere,groq,mistral,openai,vertexai]==0.0.
|
|
31
|
+
Requires-Dist: pydantic-ai-slim[anthropic,cohere,groq,mistral,openai,vertexai]==0.0.27
|
|
32
32
|
Provides-Extra: examples
|
|
33
|
-
Requires-Dist: pydantic-ai-examples==0.0.
|
|
33
|
+
Requires-Dist: pydantic-ai-examples==0.0.27; extra == 'examples'
|
|
34
34
|
Provides-Extra: logfire
|
|
35
35
|
Requires-Dist: logfire>=2.3; extra == 'logfire'
|
|
36
36
|
Description-Content-Type: text/markdown
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pydantic-ai"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.27"
|
|
8
8
|
description = "Agent Framework / shim to use Pydantic with LLMs"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Samuel Colvin", email = "samuel@pydantic.dev" },
|
|
@@ -33,7 +33,7 @@ classifiers = [
|
|
|
33
33
|
]
|
|
34
34
|
requires-python = ">=3.9"
|
|
35
35
|
|
|
36
|
-
dependencies = ["pydantic-ai-slim[openai,vertexai,groq,anthropic,mistral,cohere]==0.0.
|
|
36
|
+
dependencies = ["pydantic-ai-slim[openai,vertexai,groq,anthropic,mistral,cohere]==0.0.27"]
|
|
37
37
|
|
|
38
38
|
[project.urls]
|
|
39
39
|
Homepage = "https://ai.pydantic.dev"
|
|
@@ -42,7 +42,7 @@ Documentation = "https://ai.pydantic.dev"
|
|
|
42
42
|
Changelog = "https://github.com/pydantic/pydantic-ai/releases"
|
|
43
43
|
|
|
44
44
|
[project.optional-dependencies]
|
|
45
|
-
examples = ["pydantic-ai-examples==0.0.
|
|
45
|
+
examples = ["pydantic-ai-examples==0.0.27"]
|
|
46
46
|
logfire = ["logfire>=2.3"]
|
|
47
47
|
|
|
48
48
|
[tool.uv.sources]
|
|
Binary file
|
|
Binary file
|
|
@@ -20,6 +20,8 @@ from typing_extensions import TypeAlias
|
|
|
20
20
|
from vcr import VCR
|
|
21
21
|
|
|
22
22
|
import pydantic_ai.models
|
|
23
|
+
from pydantic_ai.messages import BinaryContent
|
|
24
|
+
from pydantic_ai.models import cached_async_http_client
|
|
23
25
|
|
|
24
26
|
__all__ = 'IsDatetime', 'IsFloat', 'IsNow', 'IsStr', 'TestEnv', 'ClientWithHandler', 'try_import'
|
|
25
27
|
|
|
@@ -184,6 +186,11 @@ def set_event_loop() -> Iterator[None]:
|
|
|
184
186
|
new_loop.close()
|
|
185
187
|
|
|
186
188
|
|
|
189
|
+
def raise_if_exception(e: Any) -> None:
|
|
190
|
+
if isinstance(e, Exception):
|
|
191
|
+
raise e
|
|
192
|
+
|
|
193
|
+
|
|
187
194
|
def pytest_recording_configure(config: Any, vcr: VCR):
|
|
188
195
|
from . import json_body_serializer
|
|
189
196
|
|
|
@@ -197,3 +204,46 @@ def vcr_config():
|
|
|
197
204
|
'filter_headers': ['authorization', 'x-api-key'],
|
|
198
205
|
'decode_compressed_response': True,
|
|
199
206
|
}
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
@pytest.fixture(autouse=True)
|
|
210
|
+
async def close_cached_httpx_client() -> AsyncIterator[None]:
|
|
211
|
+
yield
|
|
212
|
+
await cached_async_http_client().aclose()
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
@pytest.fixture(scope='session')
|
|
216
|
+
def assets_path() -> Path:
|
|
217
|
+
return Path(__file__).parent / 'assets'
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
@pytest.fixture(scope='session')
|
|
221
|
+
def audio_content(assets_path: Path) -> BinaryContent:
|
|
222
|
+
audio_bytes = assets_path.joinpath('marcelo.mp3').read_bytes()
|
|
223
|
+
return BinaryContent(data=audio_bytes, media_type='audio/mpeg')
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
@pytest.fixture(scope='session')
|
|
227
|
+
def image_content(assets_path: Path) -> BinaryContent:
|
|
228
|
+
image_bytes = assets_path.joinpath('kiwi.png').read_bytes()
|
|
229
|
+
return BinaryContent(data=image_bytes, media_type='image/png')
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@pytest.fixture(scope='session')
|
|
233
|
+
def openai_api_key() -> str:
|
|
234
|
+
return os.getenv('OPENAI_API_KEY', 'mock-api-key')
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@pytest.fixture(scope='session')
|
|
238
|
+
def gemini_api_key() -> str:
|
|
239
|
+
return os.getenv('GEMINI_API_KEY', 'mock-api-key')
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
@pytest.fixture(scope='session')
|
|
243
|
+
def groq_api_key() -> str:
|
|
244
|
+
return os.getenv('GROQ_API_KEY', 'mock-api-key')
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@pytest.fixture(scope='session')
|
|
248
|
+
def anthropic_api_key() -> str:
|
|
249
|
+
return os.getenv('ANTHROPIC_API_KEY', 'mock-api-key')
|
|
@@ -53,7 +53,7 @@ async def test_dump_load_history(graph: Graph[MyState, None, int]):
|
|
|
53
53
|
[
|
|
54
54
|
NodeStep(state=MyState(x=2, y=''), node=Foo(), start_ts=IsNow(tz=timezone.utc), duration=IsFloat()),
|
|
55
55
|
NodeStep(state=MyState(x=2, y='y'), node=Bar(), start_ts=IsNow(tz=timezone.utc), duration=IsFloat()),
|
|
56
|
-
EndStep(result=End(4), ts=IsNow(tz=timezone.utc)),
|
|
56
|
+
EndStep(result=End(data=4), ts=IsNow(tz=timezone.utc)),
|
|
57
57
|
]
|
|
58
58
|
)
|
|
59
59
|
history_json = graph.dump_history(result.history)
|
|
@@ -52,7 +52,7 @@ async def test_run_graph():
|
|
|
52
52
|
start_ts=IsNow(tz=timezone.utc),
|
|
53
53
|
duration=IsFloat(),
|
|
54
54
|
),
|
|
55
|
-
EndStep(result=End('x=2 y=y'), ts=IsNow(tz=timezone.utc)),
|
|
55
|
+
EndStep(result=End(data='x=2 y=y'), ts=IsNow(tz=timezone.utc)),
|
|
56
56
|
]
|
|
57
57
|
)
|
|
58
58
|
assert state == MyState(x=2, y='y')
|
|
@@ -13,7 +13,7 @@ else:
|
|
|
13
13
|
from yaml import Dumper, Loader
|
|
14
14
|
|
|
15
15
|
FILTERED_HEADER_PREFIXES = ['anthropic-', 'cf-', 'x-']
|
|
16
|
-
FILTERED_HEADERS = {'authorization', 'date', 'request-id', 'server', 'user-agent', 'via'}
|
|
16
|
+
FILTERED_HEADERS = {'authorization', 'date', 'request-id', 'server', 'user-agent', 'via', 'set-cookie'}
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class LiteralDumper(Dumper):
|