pydantic-ai-examples 1.0.0b1__tar.gz → 1.0.2__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.0.0b1 → pydantic_ai_examples-1.0.2}/PKG-INFO +4 -4
  2. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/bank_support.py +9 -6
  3. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/weather_agent_gradio.py +6 -3
  4. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pyproject.toml +1 -1
  5. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/.gitignore +0 -0
  6. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/LICENSE +0 -0
  7. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/README.md +0 -0
  8. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/__main__.py +0 -0
  9. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/__init__.py +0 -0
  10. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/__main__.py +0 -0
  11. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/api/__init__.py +0 -0
  12. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/api/agentic_chat.py +0 -0
  13. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/api/agentic_generative_ui.py +0 -0
  14. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/api/human_in_the_loop.py +0 -0
  15. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/api/predictive_state_updates.py +0 -0
  16. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/api/shared_state.py +0 -0
  17. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/ag_ui/api/tool_based_generative_ui.py +0 -0
  18. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/chat_app.html +0 -0
  19. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/chat_app.py +0 -0
  20. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/chat_app.ts +0 -0
  21. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/data_analyst.py +0 -0
  22. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/__init__.py +0 -0
  23. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/agent.py +0 -0
  24. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/custom_evaluators.py +0 -0
  25. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/datasets/time_range_v1.yaml +0 -0
  26. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/datasets/time_range_v1_schema.json +0 -0
  27. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/datasets/time_range_v2.yaml +0 -0
  28. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/datasets/time_range_v2_schema.json +0 -0
  29. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/example_01_generate_dataset.py +0 -0
  30. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/example_02_add_custom_evaluators.py +0 -0
  31. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/example_03_unit_testing.py +0 -0
  32. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/example_04_compare_models.py +0 -0
  33. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/evals/models.py +0 -0
  34. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/flight_booking.py +0 -0
  35. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/py.typed +0 -0
  36. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/pydantic_model.py +0 -0
  37. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/question_graph.py +0 -0
  38. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/rag.py +0 -0
  39. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/roulette_wheel.py +0 -0
  40. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/slack_lead_qualifier/__init__.py +0 -0
  41. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/slack_lead_qualifier/agent.py +0 -0
  42. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/slack_lead_qualifier/app.py +0 -0
  43. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/slack_lead_qualifier/functions.py +0 -0
  44. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/slack_lead_qualifier/modal.py +0 -0
  45. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/slack_lead_qualifier/models.py +0 -0
  46. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/slack_lead_qualifier/slack.py +0 -0
  47. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/slack_lead_qualifier/store.py +0 -0
  48. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/sql_gen.py +0 -0
  49. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/stream_markdown.py +0 -0
  50. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/stream_whales.py +0 -0
  51. {pydantic_ai_examples-1.0.0b1 → pydantic_ai_examples-1.0.2}/pydantic_ai_examples/weather_agent.py +0 -0
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai-examples
3
- Version: 1.0.0b1
3
+ Version: 1.0.2
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
7
7
  License-File: LICENSE
8
- Classifier: Development Status :: 4 - Beta
8
+ Classifier: Development Status :: 5 - Production/Stable
9
9
  Classifier: Environment :: Console
10
10
  Classifier: Environment :: MacOS X
11
11
  Classifier: Intended Audience :: Developers
@@ -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.0.0b1
38
- Requires-Dist: pydantic-evals==1.0.0b1
37
+ Requires-Dist: pydantic-ai-slim[ag-ui,anthropic,groq,openai,vertexai]==1.0.2
38
+ Requires-Dist: pydantic-evals==1.0.2
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 @@ Run with:
7
7
 
8
8
  from dataclasses import dataclass
9
9
 
10
- from pydantic import BaseModel, Field
10
+ from pydantic import BaseModel
11
11
 
12
12
  from pydantic_ai import Agent, RunContext
13
13
 
@@ -42,16 +42,19 @@ class SupportDependencies:
42
42
 
43
43
 
44
44
  class SupportOutput(BaseModel):
45
- support_advice: str = Field(description='Advice returned to the customer')
46
- block_card: bool = Field(description='Whether to block their card or not')
47
- risk: int = Field(description='Risk level of query', ge=0, le=10)
45
+ support_advice: str
46
+ """Advice returned to the customer"""
47
+ block_card: bool
48
+ """Whether to block their card or not"""
49
+ risk: int
50
+ """Risk level of query"""
48
51
 
49
52
 
50
53
  support_agent = Agent(
51
54
  'openai:gpt-4o',
52
55
  deps_type=SupportDependencies,
53
56
  output_type=SupportOutput,
54
- system_prompt=(
57
+ instructions=(
55
58
  'You are a support agent in our bank, give the '
56
59
  'customer support and judge the risk level of their query. '
57
60
  "Reply using the customer's name."
@@ -59,7 +62,7 @@ support_agent = Agent(
59
62
  )
60
63
 
61
64
 
62
- @support_agent.system_prompt
65
+ @support_agent.instructions
63
66
  async def add_customer_name(ctx: RunContext[SupportDependencies]) -> str:
64
67
  customer_name = await ctx.deps.db.customer_name(id=ctx.deps.customer_id)
65
68
  return f"The customer's name is {customer_name!r}"
@@ -3,6 +3,7 @@ from __future__ import annotations as _annotations
3
3
  import json
4
4
 
5
5
  from httpx import AsyncClient
6
+ from pydantic import BaseModel
6
7
 
7
8
  from pydantic_ai.messages import ToolCallPart, ToolReturnPart
8
9
  from pydantic_ai_examples.weather_agent import Deps, weather_agent
@@ -48,9 +49,11 @@ async def stream_from_agent(prompt: str, chatbot: list[dict], past_messages: lis
48
49
  gr_message.get('metadata', {}).get('id', '')
49
50
  == call.tool_call_id
50
51
  ):
51
- gr_message['content'] += (
52
- f'\nOutput: {json.dumps(call.content)}'
53
- )
52
+ if isinstance(call.content, BaseModel):
53
+ json_content = call.content.model_dump_json()
54
+ else:
55
+ json_content = json.dumps(call.content)
56
+ gr_message['content'] += f'\nOutput: {json_content}'
54
57
  yield gr.skip(), chatbot, gr.skip()
55
58
  chatbot.append({'role': 'assistant', 'content': ''})
56
59
  async for message in result.stream_text():
@@ -24,7 +24,7 @@ authors = [
24
24
  license = "MIT"
25
25
  readme = "README.md"
26
26
  classifiers = [
27
- "Development Status :: 4 - Beta",
27
+ "Development Status :: 5 - Production/Stable",
28
28
  "Programming Language :: Python",
29
29
  "Programming Language :: Python :: 3",
30
30
  "Programming Language :: Python :: 3 :: Only",