pydantic-ai-examples 1.7.0__tar.gz → 1.8.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-examples might be problematic. Click here for more details.

Files changed (51) hide show
  1. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/PKG-INFO +3 -3
  2. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/api/agentic_chat.py +1 -1
  3. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/api/agentic_generative_ui.py +1 -1
  4. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/api/human_in_the_loop.py +1 -1
  5. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/api/predictive_state_updates.py +1 -1
  6. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/api/shared_state.py +1 -1
  7. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/api/tool_based_generative_ui.py +1 -1
  8. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/bank_support.py +1 -1
  9. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/chat_app.py +1 -1
  10. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/data_analyst.py +1 -1
  11. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/agent.py +1 -1
  12. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/example_04_compare_models.py +2 -2
  13. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/flight_booking.py +3 -3
  14. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/pydantic_model.py +1 -1
  15. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/question_graph.py +2 -2
  16. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/rag.py +1 -1
  17. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/slack_lead_qualifier/agent.py +1 -1
  18. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/sql_gen.py +1 -1
  19. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/stream_markdown.py +2 -2
  20. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/weather_agent.py +1 -1
  21. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/.gitignore +0 -0
  22. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/LICENSE +0 -0
  23. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/README.md +0 -0
  24. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/__main__.py +0 -0
  25. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/__init__.py +0 -0
  26. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/__main__.py +0 -0
  27. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/ag_ui/api/__init__.py +0 -0
  28. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/chat_app.html +0 -0
  29. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/chat_app.ts +0 -0
  30. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/__init__.py +0 -0
  31. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/custom_evaluators.py +0 -0
  32. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/datasets/time_range_v1.yaml +0 -0
  33. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/datasets/time_range_v1_schema.json +0 -0
  34. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/datasets/time_range_v2.yaml +0 -0
  35. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/datasets/time_range_v2_schema.json +0 -0
  36. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/example_01_generate_dataset.py +0 -0
  37. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/example_02_add_custom_evaluators.py +0 -0
  38. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/example_03_unit_testing.py +0 -0
  39. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/evals/models.py +0 -0
  40. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/py.typed +0 -0
  41. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/roulette_wheel.py +0 -0
  42. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/slack_lead_qualifier/__init__.py +0 -0
  43. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/slack_lead_qualifier/app.py +0 -0
  44. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/slack_lead_qualifier/functions.py +0 -0
  45. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/slack_lead_qualifier/modal.py +0 -0
  46. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/slack_lead_qualifier/models.py +0 -0
  47. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/slack_lead_qualifier/slack.py +0 -0
  48. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/slack_lead_qualifier/store.py +0 -0
  49. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/stream_whales.py +0 -0
  50. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pydantic_ai_examples/weather_agent_gradio.py +0 -0
  51. {pydantic_ai_examples-1.7.0 → pydantic_ai_examples-1.8.0}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai-examples
3
- Version: 1.7.0
3
+ Version: 1.8.0
4
4
  Summary: Examples of how to use Pydantic AI and what it can do.
5
5
  Author-email: Samuel Colvin <samuel@pydantic.dev>, Marcelo Trylesinski <marcelotryle@gmail.com>, David Montague <david@pydantic.dev>, Alex Hall <alex@pydantic.dev>, Douwe Maan <douwe@pydantic.dev>
6
6
  License-Expression: MIT
@@ -34,8 +34,8 @@ Requires-Dist: logfire[asyncpg,fastapi,httpx,sqlite3]>=3.14.1
34
34
  Requires-Dist: mcp[cli]>=1.4.1
35
35
  Requires-Dist: modal>=1.0.4
36
36
  Requires-Dist: pandas>=2.2.3
37
- Requires-Dist: pydantic-ai-slim[ag-ui,anthropic,groq,openai,vertexai]==1.7.0
38
- Requires-Dist: pydantic-evals==1.7.0
37
+ Requires-Dist: pydantic-ai-slim[ag-ui,anthropic,groq,openai,vertexai]==1.8.0
38
+ Requires-Dist: pydantic-evals==1.8.0
39
39
  Requires-Dist: python-multipart>=0.0.17
40
40
  Requires-Dist: rich>=13.9.2
41
41
  Requires-Dist: uvicorn>=0.32.0
@@ -7,7 +7,7 @@ from zoneinfo import ZoneInfo
7
7
 
8
8
  from pydantic_ai import Agent
9
9
 
10
- agent = Agent('openai:gpt-4o-mini')
10
+ agent = Agent('openai:gpt-5-mini')
11
11
  app = agent.to_ag_ui()
12
12
 
13
13
 
@@ -48,7 +48,7 @@ class JSONPatchOp(BaseModel):
48
48
 
49
49
 
50
50
  agent = Agent(
51
- 'openai:gpt-4o-mini',
51
+ 'openai:gpt-5-mini',
52
52
  instructions=dedent(
53
53
  """
54
54
  When planning use tools only, without any other messages.
@@ -10,7 +10,7 @@ from textwrap import dedent
10
10
  from pydantic_ai import Agent
11
11
 
12
12
  agent = Agent(
13
- 'openai:gpt-4o-mini',
13
+ 'openai:gpt-5-mini',
14
14
  instructions=dedent(
15
15
  """
16
16
  When planning tasks use tools only, without any other messages.
@@ -17,7 +17,7 @@ class DocumentState(BaseModel):
17
17
  document: str = ''
18
18
 
19
19
 
20
- agent = Agent('openai:gpt-4o-mini', deps_type=StateDeps[DocumentState])
20
+ agent = Agent('openai:gpt-5-mini', deps_type=StateDeps[DocumentState])
21
21
 
22
22
 
23
23
  # Tools which return AG-UI events will be sent to the client as part of the
@@ -84,7 +84,7 @@ class RecipeSnapshot(BaseModel):
84
84
  )
85
85
 
86
86
 
87
- agent = Agent('openai:gpt-4o-mini', deps_type=StateDeps[RecipeSnapshot])
87
+ agent = Agent('openai:gpt-5-mini', deps_type=StateDeps[RecipeSnapshot])
88
88
 
89
89
 
90
90
  @agent.tool_plain
@@ -7,5 +7,5 @@ from __future__ import annotations
7
7
 
8
8
  from pydantic_ai import Agent
9
9
 
10
- agent = Agent('openai:gpt-4o-mini')
10
+ agent = Agent('openai:gpt-5-mini')
11
11
  app = agent.to_ag_ui()
@@ -51,7 +51,7 @@ class SupportOutput(BaseModel):
51
51
 
52
52
 
53
53
  support_agent = Agent(
54
- 'openai:gpt-4o',
54
+ 'openai:gpt-5',
55
55
  deps_type=SupportDependencies,
56
56
  output_type=SupportOutput,
57
57
  instructions=(
@@ -40,7 +40,7 @@ from pydantic_ai import (
40
40
  logfire.configure(send_to_logfire='if-token-present')
41
41
  logfire.instrument_pydantic_ai()
42
42
 
43
- agent = Agent('openai:gpt-4o')
43
+ agent = Agent('openai:gpt-5')
44
44
  THIS_DIR = Path(__file__).parent
45
45
 
46
46
 
@@ -26,7 +26,7 @@ class AnalystAgentDeps:
26
26
 
27
27
 
28
28
  analyst_agent = Agent(
29
- 'openai:gpt-4o',
29
+ 'openai:gpt-5',
30
30
  deps_type=AnalystAgentDeps,
31
31
  instructions='You are a data analyst and your job is to analyze the data according to the user request.',
32
32
  )
@@ -21,7 +21,7 @@ class TimeRangeDeps:
21
21
 
22
22
 
23
23
  time_range_agent = Agent[TimeRangeDeps, TimeRangeResponse](
24
- 'gpt-4o',
24
+ 'gpt-5',
25
25
  output_type=TimeRangeResponse, # type: ignore # we can't yet annotate something as receiving a TypeForm
26
26
  deps_type=TimeRangeDeps,
27
27
  system_prompt="Convert the user's request into a structured time range.",
@@ -28,8 +28,8 @@ def compare_models():
28
28
  dataset_path, custom_evaluator_types=CUSTOM_EVALUATOR_TYPES
29
29
  )
30
30
  with logfire.span('Comparing different models for time_range_agent'):
31
- with time_range_agent.override(model='openai:gpt-4o'):
32
- dataset.evaluate_sync(infer_time_range, name='openai:gpt-4o')
31
+ with time_range_agent.override(model='openai:gpt-5'):
32
+ dataset.evaluate_sync(infer_time_range, name='openai:gpt-5')
33
33
  with time_range_agent.override(model='openai:o1'):
34
34
  dataset.evaluate_sync(infer_time_range, name='openai:o1')
35
35
 
@@ -49,7 +49,7 @@ class Deps:
49
49
 
50
50
  # This agent is responsible for controlling the flow of the conversation.
51
51
  search_agent = Agent[Deps, FlightDetails | NoFlightFound](
52
- 'openai:gpt-4o',
52
+ 'openai:gpt-5',
53
53
  output_type=FlightDetails | NoFlightFound, # type: ignore
54
54
  retries=4,
55
55
  system_prompt=(
@@ -60,7 +60,7 @@ search_agent = Agent[Deps, FlightDetails | NoFlightFound](
60
60
 
61
61
  # This agent is responsible for extracting flight details from web page text.
62
62
  extraction_agent = Agent(
63
- 'openai:gpt-4o',
63
+ 'openai:gpt-5',
64
64
  output_type=list[FlightDetails],
65
65
  system_prompt='Extract all the flight details from the given text.',
66
66
  )
@@ -112,7 +112,7 @@ class Failed(BaseModel):
112
112
 
113
113
  # This agent is responsible for extracting the user's seat selection
114
114
  seat_preference_agent = Agent[None, SeatPreference | Failed](
115
- 'openai:gpt-4o',
115
+ 'openai:gpt-5',
116
116
  output_type=SeatPreference | Failed,
117
117
  system_prompt=(
118
118
  "Extract the user's seat preference. "
@@ -22,7 +22,7 @@ class MyModel(BaseModel):
22
22
  country: str
23
23
 
24
24
 
25
- model = os.getenv('PYDANTIC_AI_MODEL', 'openai:gpt-4o')
25
+ model = os.getenv('PYDANTIC_AI_MODEL', 'openai:gpt-5')
26
26
  print(f'Using model: {model}')
27
27
  agent = Agent(model, output_type=MyModel)
28
28
 
@@ -26,7 +26,7 @@ from pydantic_graph.persistence.file import FileStatePersistence
26
26
  logfire.configure(send_to_logfire='if-token-present')
27
27
  logfire.instrument_pydantic_ai()
28
28
 
29
- ask_agent = Agent('openai:gpt-4o', output_type=str)
29
+ ask_agent = Agent('openai:gpt-5', output_type=str)
30
30
 
31
31
 
32
32
  @dataclass
@@ -65,7 +65,7 @@ class EvaluationOutput(BaseModel, use_attribute_docstrings=True):
65
65
 
66
66
 
67
67
  evaluate_agent = Agent(
68
- 'openai:gpt-4o',
68
+ 'openai:gpt-5',
69
69
  output_type=EvaluationOutput,
70
70
  system_prompt='Given a question and answer, evaluate if the answer is correct.',
71
71
  )
@@ -49,7 +49,7 @@ class Deps:
49
49
  pool: asyncpg.Pool
50
50
 
51
51
 
52
- agent = Agent('openai:gpt-4o', deps_type=Deps)
52
+ agent = Agent('openai:gpt-5', deps_type=Deps)
53
53
 
54
54
 
55
55
  @agent.tool
@@ -11,7 +11,7 @@ from .models import Analysis, Profile
11
11
 
12
12
  ### [agent]
13
13
  agent = Agent(
14
- 'openai:gpt-4o',
14
+ 'openai:gpt-5',
15
15
  instructions=dedent(
16
16
  """
17
17
  When a new person joins our public Slack, please put together a brief snapshot so we can be most useful to them.
@@ -92,7 +92,7 @@ class InvalidRequest(BaseModel):
92
92
 
93
93
  Response: TypeAlias = Success | InvalidRequest
94
94
  agent = Agent[Deps, Response](
95
- 'google-gla:gemini-1.5-flash',
95
+ 'google-gla:gemini-2.5-flash',
96
96
  # Type ignore while we wait for PEP-0747, nonetheless unions will work fine everywhere else
97
97
  output_type=Response, # type: ignore
98
98
  deps_type=Deps,
@@ -26,8 +26,8 @@ agent = Agent()
26
26
 
27
27
  # models to try, and the appropriate env var
28
28
  models: list[tuple[KnownModelName, str]] = [
29
- ('google-gla:gemini-2.0-flash', 'GEMINI_API_KEY'),
30
- ('openai:gpt-4o-mini', 'OPENAI_API_KEY'),
29
+ ('google-gla:gemini-2.5-flash', 'GEMINI_API_KEY'),
30
+ ('openai:gpt-5-mini', 'OPENAI_API_KEY'),
31
31
  ('groq:llama-3.3-70b-versatile', 'GROQ_API_KEY'),
32
32
  ]
33
33
 
@@ -32,7 +32,7 @@ class Deps:
32
32
 
33
33
 
34
34
  weather_agent = Agent(
35
- 'openai:gpt-4.1-mini',
35
+ 'openai:gpt-5-mini',
36
36
  # 'Be concise, reply with one sentence.' is enough for some models (like openai) to use
37
37
  # the below tools appropriately, but others like anthropic and gemini require a bit more direction.
38
38
  instructions='Be concise, reply with one sentence.',