pydantic-ai 0.0.21__tar.gz → 0.0.22__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.

Files changed (44) hide show
  1. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/.gitignore +3 -1
  2. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/PKG-INFO +3 -3
  3. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/pyproject.toml +7 -4
  4. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_openai.py +14 -1
  5. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_examples.py +1 -1
  6. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/LICENSE +0 -0
  7. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/Makefile +0 -0
  8. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/README.md +0 -0
  9. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/__init__.py +0 -0
  10. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/conftest.py +0 -0
  11. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/example_modules/README.md +0 -0
  12. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/example_modules/bank_database.py +0 -0
  13. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/example_modules/fake_database.py +0 -0
  14. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/example_modules/weather_service.py +0 -0
  15. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/graph/__init__.py +0 -0
  16. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/graph/test_graph.py +0 -0
  17. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/graph/test_history.py +0 -0
  18. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/graph/test_mermaid.py +0 -0
  19. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/graph/test_state.py +0 -0
  20. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/import_examples.py +0 -0
  21. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/__init__.py +0 -0
  22. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/mock_async_stream.py +0 -0
  23. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_anthropic.py +0 -0
  24. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_cohere.py +0 -0
  25. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_gemini.py +0 -0
  26. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_groq.py +0 -0
  27. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_mistral.py +0 -0
  28. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_model.py +0 -0
  29. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_model_function.py +0 -0
  30. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_model_names.py +0 -0
  31. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_model_test.py +0 -0
  32. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/models/test_vertexai.py +0 -0
  33. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_agent.py +0 -0
  34. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_deps.py +0 -0
  35. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_format_as_xml.py +0 -0
  36. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_live.py +0 -0
  37. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_logfire.py +0 -0
  38. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_parts_manager.py +0 -0
  39. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_streaming.py +0 -0
  40. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_tools.py +0 -0
  41. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_usage_limits.py +0 -0
  42. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/test_utils.py +0 -0
  43. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/typed_agent.py +0 -0
  44. {pydantic_ai-0.0.21 → pydantic_ai-0.0.22}/tests/typed_graph.py +0 -0
@@ -3,7 +3,8 @@ site
3
3
  .venv
4
4
  dist
5
5
  __pycache__
6
- *.env
6
+ .env
7
+ .dev.vars
7
8
  /scratch/
8
9
  /.coverage
9
10
  env*/
@@ -14,3 +15,4 @@ examples/pydantic_ai_examples/.chat_app_messages.sqlite
14
15
  .cache/
15
16
  .vscode/
16
17
  /question_graph_history.json
18
+ /docs-site/.wrangler/
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai
3
- Version: 0.0.21
3
+ Version: 0.0.22
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
@@ -32,9 +32,9 @@ Classifier: Programming Language :: Python :: 3.13
32
32
  Classifier: Topic :: Internet
33
33
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
34
34
  Requires-Python: >=3.9
35
- Requires-Dist: pydantic-ai-slim[anthropic,cohere,graph,groq,mistral,openai,vertexai]==0.0.21
35
+ Requires-Dist: pydantic-ai-slim[anthropic,cohere,graph,groq,mistral,openai,vertexai]==0.0.22
36
36
  Provides-Extra: examples
37
- Requires-Dist: pydantic-ai-examples==0.0.21; extra == 'examples'
37
+ Requires-Dist: pydantic-ai-examples==0.0.22; extra == 'examples'
38
38
  Provides-Extra: logfire
39
39
  Requires-Dist: logfire>=2.3; extra == 'logfire'
40
40
  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.21"
7
+ version = "0.0.22"
8
8
  description = "Agent Framework / shim to use Pydantic with LLMs"
9
9
  authors = [
10
10
  { name = "Samuel Colvin", email = "samuel@pydantic.dev" },
@@ -37,7 +37,7 @@ classifiers = [
37
37
  ]
38
38
  requires-python = ">=3.9"
39
39
 
40
- dependencies = ["pydantic-ai-slim[graph,openai,vertexai,groq,anthropic,mistral,cohere]==0.0.21"]
40
+ dependencies = ["pydantic-ai-slim[graph,openai,vertexai,groq,anthropic,mistral,cohere]==0.0.22"]
41
41
 
42
42
  [project.urls]
43
43
  Homepage = "https://ai.pydantic.dev"
@@ -46,7 +46,7 @@ Documentation = "https://ai.pydantic.dev"
46
46
  Changelog = "https://github.com/pydantic/pydantic-ai/releases"
47
47
 
48
48
  [project.optional-dependencies]
49
- examples = ["pydantic-ai-examples==0.0.21"]
49
+ examples = ["pydantic-ai-examples==0.0.22"]
50
50
  logfire = ["logfire>=2.3"]
51
51
 
52
52
  [tool.uv.sources]
@@ -65,7 +65,6 @@ lint = [
65
65
  "ruff>=0.6.9",
66
66
  ]
67
67
  docs = [
68
- "algoliasearch>=4.12.0",
69
68
  "black>=24.10.0",
70
69
  "bs4>=0.0.2",
71
70
  "markdownify>=0.14.1",
@@ -74,6 +73,10 @@ docs = [
74
73
  "mkdocs-material[imaging]>=9.5.45",
75
74
  "mkdocstrings-python>=1.12.2",
76
75
  ]
76
+ docs-upload = [
77
+ "algoliasearch>=4.12.0",
78
+ "pydantic>=2.10.1",
79
+ ]
77
80
 
78
81
  [tool.hatch.build.targets.wheel]
79
82
  only-include = ["/README.md"]
@@ -29,7 +29,7 @@ from ..conftest import IsNow, try_import
29
29
  from .mock_async_stream import MockAsyncStream
30
30
 
31
31
  with try_import() as imports_successful:
32
- from openai import NOT_GIVEN, AsyncOpenAI
32
+ from openai import NOT_GIVEN, AsyncOpenAI, OpenAIError
33
33
  from openai.types import chat
34
34
  from openai.types.chat.chat_completion import Choice
35
35
  from openai.types.chat.chat_completion_chunk import (
@@ -65,6 +65,19 @@ def test_init_with_base_url():
65
65
  m.name()
66
66
 
67
67
 
68
+ def test_init_with_non_openai_model():
69
+ m = OpenAIModel('llama3.2-vision:latest', base_url='https://example.com/v1/')
70
+ m.name()
71
+
72
+
73
+ def test_init_of_openai_without_api_key_raises_error():
74
+ with pytest.raises(
75
+ OpenAIError,
76
+ match='^The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable$',
77
+ ):
78
+ OpenAIModel('gpt-4o')
79
+
80
+
68
81
  @dataclass
69
82
  class MockOpenAI:
70
83
  completions: chat.ChatCompletion | list[chat.ChatCompletion] | None = None
@@ -179,7 +179,7 @@ text_responses: dict[str, str | ToolCallPart] = {
179
179
  'The weather in West London is raining, while in Wiltshire it is sunny.'
180
180
  ),
181
181
  'Tell me a joke.': 'Did you hear about the toothpaste scandal? They called it Colgate.',
182
- 'Explain?': 'This is an excellent joke invent by Samuel Colvin, it needs no explanation.',
182
+ 'Explain?': 'This is an excellent joke invented by Samuel Colvin, it needs no explanation.',
183
183
  'What is the capital of France?': 'Paris',
184
184
  'What is the capital of Italy?': 'Rome',
185
185
  'What is the capital of the UK?': 'London',
File without changes
File without changes
File without changes