pydantic-ai 0.2.3__tar.gz → 0.2.4__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.
Files changed (194) hide show
  1. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/PKG-INFO +3 -3
  2. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/pyproject.toml +1 -1
  3. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_cli.py +71 -48
  4. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/.gitignore +0 -0
  5. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/LICENSE +0 -0
  6. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/Makefile +0 -0
  7. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/README.md +0 -0
  8. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/__init__.py +0 -0
  9. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/assets/dummy.pdf +0 -0
  10. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/assets/kiwi.png +0 -0
  11. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/assets/marcelo.mp3 +0 -0
  12. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/assets/small_video.mp4 +0 -0
  13. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_agent_with_stdio_server.yaml +0 -0
  14. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_tool_returning_dict.yaml +0 -0
  15. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_tool_returning_error.yaml +0 -0
  16. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_tool_returning_image.yaml +0 -0
  17. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_tool_returning_image_resource.yaml +0 -0
  18. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_tool_returning_multiple_items.yaml +0 -0
  19. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_tool_returning_none.yaml +0 -0
  20. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_tool_returning_str.yaml +0 -0
  21. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_mcp/test_tool_returning_text_resource.yaml +0 -0
  22. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_settings/test_stop_settings[anthropic].yaml +0 -0
  23. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_settings/test_stop_settings[bedrock].yaml +0 -0
  24. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_settings/test_stop_settings[cohere].yaml +0 -0
  25. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_settings/test_stop_settings[gemini].yaml +0 -0
  26. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_settings/test_stop_settings[groq].yaml +0 -0
  27. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_settings/test_stop_settings[mistral].yaml +0 -0
  28. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/cassettes/test_settings/test_stop_settings[openai].yaml +0 -0
  29. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/conftest.py +0 -0
  30. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/__init__.py +0 -0
  31. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_dataset.py +0 -0
  32. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_evaluator_base.py +0 -0
  33. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_evaluator_common.py +0 -0
  34. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_evaluator_context.py +0 -0
  35. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_evaluator_spec.py +0 -0
  36. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_evaluators.py +0 -0
  37. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_llm_as_a_judge.py +0 -0
  38. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_otel.py +0 -0
  39. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_render_numbers.py +0 -0
  40. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_reporting.py +0 -0
  41. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_reports.py +0 -0
  42. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/test_utils.py +0 -0
  43. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/evals/utils.py +0 -0
  44. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/example_modules/README.md +0 -0
  45. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/example_modules/bank_database.py +0 -0
  46. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/example_modules/fake_database.py +0 -0
  47. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/example_modules/weather_service.py +0 -0
  48. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/fasta2a/__init__.py +0 -0
  49. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/graph/__init__.py +0 -0
  50. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/graph/test_file_persistence.py +0 -0
  51. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/graph/test_graph.py +0 -0
  52. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/graph/test_mermaid.py +0 -0
  53. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/graph/test_persistence.py +0 -0
  54. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/graph/test_state.py +0 -0
  55. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/graph/test_utils.py +0 -0
  56. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/import_examples.py +0 -0
  57. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/json_body_serializer.py +0 -0
  58. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/mcp_server.py +0 -0
  59. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/__init__.py +0 -0
  60. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_anthropic_model_instructions.yaml +0 -0
  61. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_document_binary_content_input.yaml +0 -0
  62. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_document_url_input.yaml +0 -0
  63. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_extra_headers.yaml +0 -0
  64. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_image_as_binary_content_tool_response.yaml +0 -0
  65. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_image_url_input.yaml +0 -0
  66. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_image_url_input_invalid_mime_type.yaml +0 -0
  67. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_multiple_parallel_tool_calls.yaml +0 -0
  68. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_anthropic/test_text_document_url_input.yaml +0 -0
  69. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_empty_system_prompt.yaml +0 -0
  70. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model.yaml +0 -0
  71. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_anthropic_model_without_tools.yaml +0 -0
  72. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_guardrail_config.yaml +0 -0
  73. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_instructions.yaml +0 -0
  74. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_iter_stream.yaml +0 -0
  75. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_max_tokens.yaml +0 -0
  76. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_other_parameters.yaml +0 -0
  77. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_performance_config.yaml +0 -0
  78. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_retry.yaml +0 -0
  79. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_stream.yaml +0 -0
  80. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_structured_response.yaml +0 -0
  81. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_model_top_p.yaml +0 -0
  82. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_bedrock_multiple_documents_in_history.yaml +0 -0
  83. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_document_url_input.yaml +0 -0
  84. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_image_as_binary_content_input.yaml +0 -0
  85. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_image_url_input.yaml +0 -0
  86. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_text_as_binary_content_input.yaml +0 -0
  87. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_text_document_url_input.yaml +0 -0
  88. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_video_as_binary_content_input.yaml +0 -0
  89. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_bedrock/test_video_url_input.yaml +0 -0
  90. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_cohere/test_cohere_model_instructions.yaml +0 -0
  91. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_cohere/test_request_simple_success_with_vcr.yaml +0 -0
  92. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_document_url_input.yaml +0 -0
  93. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_gemini_additional_properties_is_false.yaml +0 -0
  94. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_gemini_additional_properties_is_true.yaml +0 -0
  95. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_gemini_drop_exclusive_maximum.yaml +0 -0
  96. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_gemini_exclusive_minimum_and_maximum.yaml +0 -0
  97. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_gemini_model_instructions.yaml +0 -0
  98. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_image_as_binary_content_input.yaml +0 -0
  99. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_image_as_binary_content_tool_response.yaml +0 -0
  100. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_image_url_input.yaml +0 -0
  101. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_video_as_binary_content_input.yaml +0 -0
  102. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_gemini/test_video_url_input.yaml +0 -0
  103. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_groq/test_extra_headers.yaml +0 -0
  104. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_groq/test_groq_model_instructions.yaml +0 -0
  105. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_groq/test_image_as_binary_content_input.yaml +0 -0
  106. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_groq/test_image_as_binary_content_tool_response.yaml +0 -0
  107. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_groq/test_image_url_input.yaml +0 -0
  108. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_mistral/test_image_as_binary_content_tool_response.yaml +0 -0
  109. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_mistral/test_mistral_model_instructions.yaml +0 -0
  110. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_audio_as_binary_content_input.yaml +0 -0
  111. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_document_as_binary_content_input.yaml +0 -0
  112. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_document_url_input.yaml +0 -0
  113. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_extra_headers.yaml +0 -0
  114. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_image_as_binary_content_input.yaml +0 -0
  115. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_image_as_binary_content_tool_response.yaml +0 -0
  116. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_image_url_tool_response.yaml +0 -0
  117. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_max_completion_tokens[gpt-4.5-preview].yaml +0 -0
  118. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_max_completion_tokens[gpt-4o-mini].yaml +0 -0
  119. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_max_completion_tokens[o3-mini].yaml +0 -0
  120. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_multiple_agent_tool_calls.yaml +0 -0
  121. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_openai_audio_url_input.yaml +0 -0
  122. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_openai_instructions.yaml +0 -0
  123. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_openai_instructions_with_tool_calls_keep_instructions.yaml +0 -0
  124. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_openai_model_without_system_prompt.yaml +0 -0
  125. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_openai_o1_mini_system_role[developer].yaml +0 -0
  126. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_openai_o1_mini_system_role[system].yaml +0 -0
  127. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai/test_user_id.yaml +0 -0
  128. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_audio_as_binary_content_input.yaml +0 -0
  129. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_image_as_binary_content_input.yaml +0 -0
  130. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_image_as_binary_content_tool_response.yaml +0 -0
  131. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_document_as_binary_content_input.yaml +0 -0
  132. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_document_url_input.yaml +0 -0
  133. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_image_url_input.yaml +0 -0
  134. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_model_builtin_tools.yaml +0 -0
  135. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_model_http_error.yaml +0 -0
  136. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_model_instructions.yaml +0 -0
  137. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_model_retry.yaml +0 -0
  138. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_model_simple_response.yaml +0 -0
  139. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_model_simple_response_with_tool_call.yaml +0 -0
  140. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_output_type.yaml +0 -0
  141. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_reasoning_effort.yaml +0 -0
  142. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_reasoning_generate_summary.yaml +0 -0
  143. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_stream.yaml +0 -0
  144. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_system_prompt.yaml +0 -0
  145. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/cassettes/test_openai_responses/test_openai_responses_text_document_url_input.yaml +0 -0
  146. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/mock_async_stream.py +0 -0
  147. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_anthropic.py +0 -0
  148. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_bedrock.py +0 -0
  149. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_cohere.py +0 -0
  150. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_fallback.py +0 -0
  151. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_gemini.py +0 -0
  152. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_groq.py +0 -0
  153. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_instrumented.py +0 -0
  154. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_mistral.py +0 -0
  155. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_model.py +0 -0
  156. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_model_function.py +0 -0
  157. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_model_names.py +0 -0
  158. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_model_request_parameters.py +0 -0
  159. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_model_test.py +0 -0
  160. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_openai.py +0 -0
  161. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/models/test_openai_responses.py +0 -0
  162. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/__init__.py +0 -0
  163. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/cassettes/test_azure/test_azure_provider_call.yaml +0 -0
  164. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/cassettes/test_google_vertex/test_vertexai_provider.yaml +0 -0
  165. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_anthropic.py +0 -0
  166. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_azure.py +0 -0
  167. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_bedrock.py +0 -0
  168. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_cohere.py +0 -0
  169. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_deepseek.py +0 -0
  170. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_google_gla.py +0 -0
  171. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_google_vertex.py +0 -0
  172. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_groq.py +0 -0
  173. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_mistral.py +0 -0
  174. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_openai.py +0 -0
  175. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/providers/test_provider_names.py +0 -0
  176. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_a2a.py +0 -0
  177. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_agent.py +0 -0
  178. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_deps.py +0 -0
  179. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_direct.py +0 -0
  180. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_examples.py +0 -0
  181. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_format_as_xml.py +0 -0
  182. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_json_body_serializer.py +0 -0
  183. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_live.py +0 -0
  184. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_logfire.py +0 -0
  185. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_mcp.py +0 -0
  186. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_messages.py +0 -0
  187. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_parts_manager.py +0 -0
  188. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_settings.py +0 -0
  189. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_streaming.py +0 -0
  190. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_tools.py +0 -0
  191. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_usage_limits.py +0 -0
  192. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/test_utils.py +0 -0
  193. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/typed_agent.py +0 -0
  194. {pydantic_ai-0.2.3 → pydantic_ai-0.2.4}/tests/typed_graph.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydantic-ai
3
- Version: 0.2.3
3
+ Version: 0.2.4
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[a2a,anthropic,bedrock,cli,cohere,evals,groq,mcp,mistral,openai,vertexai]==0.2.3
31
+ Requires-Dist: pydantic-ai-slim[a2a,anthropic,bedrock,cli,cohere,evals,groq,mcp,mistral,openai,vertexai]==0.2.4
32
32
  Provides-Extra: examples
33
- Requires-Dist: pydantic-ai-examples==0.2.3; extra == 'examples'
33
+ Requires-Dist: pydantic-ai-examples==0.2.4; extra == 'examples'
34
34
  Provides-Extra: logfire
35
35
  Requires-Dist: logfire>=3.11.0; extra == 'logfire'
36
36
  Description-Content-Type: text/markdown
@@ -60,7 +60,7 @@ Documentation = "https://ai.pydantic.dev"
60
60
  Changelog = "https://github.com/pydantic/pydantic-ai/releases"
61
61
 
62
62
  [project.scripts]
63
- pai = "pydantic_ai._cli:cli_exit" # TODO remove this when clai has been out for a while
63
+ pai = "pydantic_ai._cli:cli_exit" # TODO remove this when clai has been out for a while
64
64
 
65
65
  [tool.uv.sources]
66
66
  pydantic-ai-slim = { workspace = true }
@@ -1,6 +1,7 @@
1
1
  import sys
2
+ import types
2
3
  from io import StringIO
3
- from typing import Any
4
+ from typing import Any, Callable
4
5
 
5
6
  import pytest
6
7
  from dirty_equals import IsInstance, IsStr
@@ -16,11 +17,13 @@ from pydantic_ai.models.test import TestModel
16
17
  from .conftest import TestEnv, try_import
17
18
 
18
19
  with try_import() as imports_successful:
20
+ from openai import OpenAIError
19
21
  from prompt_toolkit.input import create_pipe_input
20
22
  from prompt_toolkit.output import DummyOutput
21
23
  from prompt_toolkit.shortcuts import PromptSession
22
24
 
23
25
  from pydantic_ai._cli import cli, cli_agent, handle_slash_command
26
+ from pydantic_ai.models.openai import OpenAIModel
24
27
 
25
28
  pytestmark = pytest.mark.skipif(not imports_successful(), reason='install cli extras to run cli tests')
26
29
 
@@ -32,70 +35,90 @@ def test_cli_version(capfd: CaptureFixture[str]):
32
35
 
33
36
  def test_invalid_model(capfd: CaptureFixture[str]):
34
37
  assert cli(['--model', 'potato']) == 1
35
- assert capfd.readouterr().out.splitlines() == snapshot(
36
- [IsStr(), 'Error initializing potato:', 'Unknown model: potato']
37
- )
38
+ assert capfd.readouterr().out.splitlines() == snapshot(['Error initializing potato:', 'Unknown model: potato'])
38
39
 
39
40
 
40
- def test_agent_flag(capfd: CaptureFixture[str], mocker: MockerFixture, env: TestEnv):
41
- env.set('OPENAI_API_KEY', 'test')
41
+ @pytest.fixture
42
+ def create_test_module():
43
+ def _create_test_module(**namespace: Any) -> None:
44
+ assert 'test_module' not in sys.modules
42
45
 
43
- # Create a dynamic module using types.ModuleType
44
- import types
46
+ test_module = types.ModuleType('test_module')
47
+ for key, value in namespace.items():
48
+ setattr(test_module, key, value)
45
49
 
46
- test_module = types.ModuleType('test_module')
50
+ sys.modules['test_module'] = test_module
47
51
 
48
- # Create and add agent to the module
49
- test_agent = Agent()
50
- test_agent.model = TestModel(custom_output_text='Hello from custom agent')
51
- setattr(test_module, 'custom_agent', test_agent)
52
+ try:
53
+ yield _create_test_module
54
+ finally:
55
+ if 'test_module' in sys.modules:
56
+ del sys.modules['test_module']
52
57
 
53
- # Register the module in sys.modules
54
- sys.modules['test_module'] = test_module
55
58
 
56
- try:
57
- # Mock ask_agent to avoid actual execution but capture the agent
58
- mock_ask = mocker.patch('pydantic_ai._cli.ask_agent')
59
+ def test_agent_flag(
60
+ capfd: CaptureFixture[str],
61
+ mocker: MockerFixture,
62
+ env: TestEnv,
63
+ create_test_module: Callable[..., None],
64
+ ):
65
+ env.remove('OPENAI_API_KEY')
59
66
 
60
- # Test CLI with custom agent
61
- assert cli(['--agent', 'test_module:custom_agent', 'hello']) == 0
67
+ test_agent = Agent(TestModel(custom_output_text='Hello from custom agent'))
68
+ create_test_module(custom_agent=test_agent)
62
69
 
63
- # Verify the output contains the custom agent message
64
- assert 'Using custom agent: test_module:custom_agent' in capfd.readouterr().out
70
+ # Mock ask_agent to avoid actual execution but capture the agent
71
+ mock_ask = mocker.patch('pydantic_ai._cli.ask_agent')
65
72
 
66
- # Verify ask_agent was called with our custom agent
67
- mock_ask.assert_called_once()
68
- assert mock_ask.call_args[0][0] is test_agent
73
+ # Test CLI with custom agent
74
+ assert cli(['--agent', 'test_module:custom_agent', 'hello']) == 0
69
75
 
70
- finally:
71
- # Clean up by removing the module from sys.modules
72
- if 'test_module' in sys.modules:
73
- del sys.modules['test_module']
76
+ # Verify the output contains the custom agent message
77
+ assert 'using custom agent test_module:custom_agent' in capfd.readouterr().out
74
78
 
79
+ # Verify ask_agent was called with our custom agent
80
+ mock_ask.assert_called_once()
81
+ assert mock_ask.call_args[0][0] is test_agent
75
82
 
76
- def test_agent_flag_non_agent(capfd: CaptureFixture[str], mocker: MockerFixture, env: TestEnv):
77
- env.set('OPENAI_API_KEY', 'test')
78
83
 
79
- # Create a dynamic module using types.ModuleType
80
- import types
84
+ def test_agent_flag_no_model(env: TestEnv, create_test_module: Callable[..., None]):
85
+ env.remove('OPENAI_API_KEY')
86
+ test_agent = Agent()
87
+ create_test_module(custom_agent=test_agent)
81
88
 
82
- test_module = types.ModuleType('test_module')
89
+ msg = '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'
90
+ with pytest.raises(OpenAIError, match=msg):
91
+ cli(['--agent', 'test_module:custom_agent', 'hello'])
83
92
 
84
- # Create and add agent to the module
85
- test_agent = 'Not an Agent object'
86
- setattr(test_module, 'custom_agent', test_agent)
87
93
 
88
- # Register the module in sys.modules
89
- sys.modules['test_module'] = test_module
94
+ def test_agent_flag_set_model(
95
+ capfd: CaptureFixture[str],
96
+ mocker: MockerFixture,
97
+ env: TestEnv,
98
+ create_test_module: Callable[..., None],
99
+ ):
100
+ env.set('OPENAI_API_KEY', 'xxx')
90
101
 
91
- try:
92
- assert cli(['--agent', 'test_module:custom_agent', 'hello']) == 1
93
- assert 'is not an Agent' in capfd.readouterr().out
102
+ custom_agent = Agent(TestModel(custom_output_text='Hello from custom agent'))
103
+ create_test_module(custom_agent=custom_agent)
94
104
 
95
- finally:
96
- # Clean up by removing the module from sys.modules
97
- if 'test_module' in sys.modules:
98
- del sys.modules['test_module']
105
+ mocker.patch('pydantic_ai._cli.ask_agent')
106
+
107
+ assert cli(['--agent', 'test_module:custom_agent', '--model', 'gpt-4o', 'hello']) == 0
108
+
109
+ assert 'using custom agent test_module:custom_agent with openai:gpt-4o' in capfd.readouterr().out
110
+
111
+ assert isinstance(custom_agent.model, OpenAIModel)
112
+
113
+
114
+ def test_agent_flag_non_agent(
115
+ capfd: CaptureFixture[str], mocker: MockerFixture, create_test_module: Callable[..., None]
116
+ ):
117
+ test_agent = 'Not an Agent object'
118
+ create_test_module(custom_agent=test_agent)
119
+
120
+ assert cli(['--agent', 'test_module:custom_agent', 'hello']) == 1
121
+ assert 'is not an Agent' in capfd.readouterr().out
99
122
 
100
123
 
101
124
  def test_agent_flag_bad_module_variable_path(capfd: CaptureFixture[str], mocker: MockerFixture, env: TestEnv):
@@ -106,7 +129,7 @@ def test_agent_flag_bad_module_variable_path(capfd: CaptureFixture[str], mocker:
106
129
  def test_list_models(capfd: CaptureFixture[str]):
107
130
  assert cli(['--list-models']) == 0
108
131
  output = capfd.readouterr().out.splitlines()
109
- assert output[:2] == snapshot([IsStr(regex='pai - PydanticAI CLI .* using openai:gpt-4o'), 'Available models:'])
132
+ assert output[:3] == snapshot([IsStr(regex='pai - PydanticAI CLI .*'), '', 'Available models:'])
110
133
 
111
134
  providers = (
112
135
  'openai',
@@ -119,7 +142,7 @@ def test_list_models(capfd: CaptureFixture[str]):
119
142
  'cohere',
120
143
  'deepseek',
121
144
  )
122
- models = {line.strip().split(' ')[0] for line in output[2:]}
145
+ models = {line.strip().split(' ')[0] for line in output[3:]}
123
146
  for provider in providers:
124
147
  models = models - {model for model in models if model.startswith(provider)}
125
148
  assert models == set(), models
File without changes
File without changes
File without changes
File without changes