simple-agents-py 0.1.14__tar.gz → 0.1.15__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 (136) hide show
  1. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/Cargo.lock +11 -11
  2. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/Cargo.toml +1 -1
  3. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/PKG-INFO +37 -14
  4. {simple_agents_py-0.1.14/crates/simple-agents-py → simple_agents_py-0.1.15}/README.md +36 -13
  5. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/Cargo.toml +3 -3
  6. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/Cargo.toml +1 -1
  7. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/src/coercion.rs +25 -0
  8. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/Cargo.toml +3 -3
  9. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/Cargo.toml +5 -5
  10. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15/crates/simple-agents-py}/README.md +36 -13
  11. simple_agents_py-0.1.15/crates/simple-agents-py/simple_agents_py.pyi +240 -0
  12. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/src/lib.rs +131 -87
  13. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_integration_openai.py +11 -12
  14. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_structured_streaming.py +9 -1
  15. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/uv.lock +1 -1
  16. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/pyproject.toml +1 -1
  17. simple_agents_py-0.1.15/simple_agents_py.pyi +240 -0
  18. simple_agents_py-0.1.14/crates/simple-agents-py/simple_agents_py.pyi +0 -45
  19. simple_agents_py-0.1.14/simple_agents_py.pyi +0 -45
  20. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/Cargo.toml +0 -0
  21. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/README.md +0 -0
  22. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/TEST_GUIDE.md +0 -0
  23. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/TODO.md +0 -0
  24. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/examples/basic_usage.rs +0 -0
  25. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/examples/mock_provider.rs +0 -0
  26. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/cache.rs +0 -0
  27. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/coercion.rs +0 -0
  28. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/config.rs +0 -0
  29. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/error.rs +0 -0
  30. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/lib.rs +0 -0
  31. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/message.rs +0 -0
  32. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/provider.rs +0 -0
  33. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/request.rs +0 -0
  34. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/response.rs +0 -0
  35. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/router.rs +0 -0
  36. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/tool.rs +0 -0
  37. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/src/validation.rs +0 -0
  38. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agent-type/tests/integration_test.rs +0 -0
  39. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-cache/Cargo.toml +0 -0
  40. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-cache/src/lib.rs +0 -0
  41. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-cache/src/memory.rs +0 -0
  42. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-cache/src/noop.rs +0 -0
  43. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/README.md +0 -0
  44. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/examples/basic_client.rs +0 -0
  45. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/src/client.rs +0 -0
  46. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/src/healing.rs +0 -0
  47. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/src/lib.rs +0 -0
  48. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/src/middleware.rs +0 -0
  49. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/src/routing.rs +0 -0
  50. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-core/tests/client_integration.rs +0 -0
  51. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/README.md +0 -0
  52. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/benches/parser_benchmarks.rs +0 -0
  53. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/examples/basic_healing.rs +0 -0
  54. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/examples/coercion_demo.rs +0 -0
  55. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/examples/streaming_annotations.rs +0 -0
  56. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/examples/streaming_partial_types.rs +0 -0
  57. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/src/lib.rs +0 -0
  58. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/src/parser.rs +0 -0
  59. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/src/schema.rs +0 -0
  60. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/src/streaming.rs +0 -0
  61. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/src/string_utils.rs +0 -0
  62. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/tests/parser_tests.rs +0 -0
  63. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/tests/property_tests.rs +0 -0
  64. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/tests/stream_annotations_tests.rs +0 -0
  65. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-healing/tests/streaming_tests.rs +0 -0
  66. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-macros/Cargo.toml +0 -0
  67. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-macros/README.md +0 -0
  68. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-macros/src/lib.rs +0 -0
  69. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-macros/src/partial.rs +0 -0
  70. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-macros/tests/partial_type_tests.rs +0 -0
  71. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/README.md +0 -0
  72. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/anthropic_basic.rs +0 -0
  73. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/anthropic_structured_output.rs +0 -0
  74. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/cache_usage.rs +0 -0
  75. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/custom_api.rs +0 -0
  76. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/healing_fallback.rs +0 -0
  77. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/openai_basic.rs +0 -0
  78. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/openai_structured_output.rs +0 -0
  79. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/openrouter_basic.rs +0 -0
  80. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/retry_demo.rs +0 -0
  81. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/streaming.rs +0 -0
  82. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/streaming_structured.rs +0 -0
  83. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/streaming_with_healing.rs +0 -0
  84. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/test_local_api.rs +0 -0
  85. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/examples/test_reqwest.rs +0 -0
  86. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/run_integration_tests.sh +0 -0
  87. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/anthropic/error.rs +0 -0
  88. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/anthropic/mod.rs +0 -0
  89. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/anthropic/models.rs +0 -0
  90. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/anthropic/streaming.rs +0 -0
  91. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/common/error.rs +0 -0
  92. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/common/http_client.rs +0 -0
  93. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/common/mod.rs +0 -0
  94. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/healing_integration.rs +0 -0
  95. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/lib.rs +0 -0
  96. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/metrics.rs +0 -0
  97. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/openai/error.rs +0 -0
  98. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/openai/mod.rs +0 -0
  99. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/openai/models.rs +0 -0
  100. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/openai/streaming.rs +0 -0
  101. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/openrouter/mod.rs +0 -0
  102. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/rate_limit.rs +0 -0
  103. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/retry.rs +0 -0
  104. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/schema_converter.rs +0 -0
  105. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/streaming_structured.rs +0 -0
  106. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/src/utils.rs +0 -0
  107. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/tests/README.md +0 -0
  108. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/tests/healing_integration_tests.rs +0 -0
  109. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-providers/tests/openai_integration.rs +0 -0
  110. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/examples/client_builder_demo.py +0 -0
  111. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/examples/direct_healing_demo.py +0 -0
  112. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/examples/healing_demo.py +0 -0
  113. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/examples/routing_config_demo.py +0 -0
  114. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/examples/streaming_demo.py +0 -0
  115. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/examples/streaming_parser_demo.py +0 -0
  116. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/examples/structured_streaming_demo.py +0 -0
  117. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/py.typed +0 -0
  118. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_client.py +0 -0
  119. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_client_builder.py +0 -0
  120. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_direct_healing.py +0 -0
  121. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_healing.py +0 -0
  122. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_routing_config.py +0 -0
  123. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_streaming.py +0 -0
  124. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-py/tests/test_streaming_parser.py +0 -0
  125. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/Cargo.toml +0 -0
  126. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/examples/round_robin_router.rs +0 -0
  127. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/src/circuit_breaker.rs +0 -0
  128. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/src/cost.rs +0 -0
  129. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/src/fallback.rs +0 -0
  130. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/src/health.rs +0 -0
  131. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/src/latency.rs +0 -0
  132. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/src/lib.rs +0 -0
  133. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/src/retry.rs +0 -0
  134. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/src/round_robin.rs +0 -0
  135. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/crates/simple-agents-router/tests/health_tracker_integration.rs +0 -0
  136. {simple_agents_py-0.1.14 → simple_agents_py-0.1.15}/py.typed +0 -0
@@ -2035,7 +2035,7 @@ dependencies = [
2035
2035
 
2036
2036
  [[package]]
2037
2037
  name = "simple-agent-type"
2038
- version = "0.1.14"
2038
+ version = "0.1.15"
2039
2039
  dependencies = [
2040
2040
  "async-trait",
2041
2041
  "blake3",
@@ -2050,7 +2050,7 @@ dependencies = [
2050
2050
 
2051
2051
  [[package]]
2052
2052
  name = "simple-agents-cache"
2053
- version = "0.1.14"
2053
+ version = "0.1.15"
2054
2054
  dependencies = [
2055
2055
  "async-trait",
2056
2056
  "simple-agent-type",
@@ -2059,7 +2059,7 @@ dependencies = [
2059
2059
 
2060
2060
  [[package]]
2061
2061
  name = "simple-agents-cli"
2062
- version = "0.1.14"
2062
+ version = "0.1.15"
2063
2063
  dependencies = [
2064
2064
  "clap",
2065
2065
  "serde",
@@ -2076,7 +2076,7 @@ dependencies = [
2076
2076
 
2077
2077
  [[package]]
2078
2078
  name = "simple-agents-core"
2079
- version = "0.1.14"
2079
+ version = "0.1.15"
2080
2080
  dependencies = [
2081
2081
  "async-trait",
2082
2082
  "futures-core",
@@ -2104,7 +2104,7 @@ dependencies = [
2104
2104
 
2105
2105
  [[package]]
2106
2106
  name = "simple-agents-ffi"
2107
- version = "0.1.14"
2107
+ version = "0.1.15"
2108
2108
  dependencies = [
2109
2109
  "async-trait",
2110
2110
  "simple-agent-type",
@@ -2115,7 +2115,7 @@ dependencies = [
2115
2115
 
2116
2116
  [[package]]
2117
2117
  name = "simple-agents-healing"
2118
- version = "0.1.14"
2118
+ version = "0.1.15"
2119
2119
  dependencies = [
2120
2120
  "criterion",
2121
2121
  "proptest",
@@ -2131,7 +2131,7 @@ dependencies = [
2131
2131
 
2132
2132
  [[package]]
2133
2133
  name = "simple-agents-macros"
2134
- version = "0.1.14"
2134
+ version = "0.1.15"
2135
2135
  dependencies = [
2136
2136
  "proc-macro2",
2137
2137
  "quote",
@@ -2143,7 +2143,7 @@ dependencies = [
2143
2143
 
2144
2144
  [[package]]
2145
2145
  name = "simple-agents-napi"
2146
- version = "0.1.14"
2146
+ version = "0.1.15"
2147
2147
  dependencies = [
2148
2148
  "napi",
2149
2149
  "napi-derive",
@@ -2155,7 +2155,7 @@ dependencies = [
2155
2155
 
2156
2156
  [[package]]
2157
2157
  name = "simple-agents-providers"
2158
- version = "0.1.14"
2158
+ version = "0.1.15"
2159
2159
  dependencies = [
2160
2160
  "async-trait",
2161
2161
  "bytes",
@@ -2183,7 +2183,7 @@ dependencies = [
2183
2183
 
2184
2184
  [[package]]
2185
2185
  name = "simple-agents-py"
2186
- version = "0.1.14"
2186
+ version = "0.1.15"
2187
2187
  dependencies = [
2188
2188
  "async-trait",
2189
2189
  "futures-util",
@@ -2202,7 +2202,7 @@ dependencies = [
2202
2202
 
2203
2203
  [[package]]
2204
2204
  name = "simple-agents-router"
2205
- version = "0.1.14"
2205
+ version = "0.1.15"
2206
2206
  dependencies = [
2207
2207
  "async-trait",
2208
2208
  "futures-core",
@@ -3,7 +3,7 @@ members = ["crates/*"]
3
3
  resolver = "2"
4
4
 
5
5
  [workspace.package]
6
- version = "0.1.14"
6
+ version = "0.1.15"
7
7
  edition = "2021"
8
8
  rust-version = "1.75"
9
9
  authors = ["SimpleAgents Contributors"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: simple-agents-py
3
- Version: 0.1.14
3
+ Version: 0.1.15
4
4
  Classifier: Programming Language :: Python :: 3
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: License :: OSI Approved :: MIT License
@@ -57,7 +57,7 @@ from simple_agents_py import Client
57
57
 
58
58
  client = Client("openai")
59
59
  response = client.complete("gpt-4", "Hello from Python!", max_tokens=128, temperature=0.7)
60
- print(response)
60
+ print(response.content)
61
61
  ```
62
62
 
63
63
  ## Feature Guide
@@ -95,6 +95,28 @@ json_text = client.complete_json_schema("gpt-4o-mini", messages, schema, "person
95
95
  print(json.loads(json_text))
96
96
  ```
97
97
 
98
+ Pydantic models are accepted too:
99
+
100
+ ```python
101
+ from pydantic import BaseModel
102
+ from simple_agents_py import Client
103
+
104
+ class Person(BaseModel):
105
+ name: str
106
+ age: int
107
+
108
+ client = Client("openai")
109
+ messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
110
+ json_text = client.complete_json_schema("gpt-4o-mini", messages, Person, "person")
111
+ print(json_text)
112
+ ```
113
+
114
+ **Healing for Structured Outputs**: Healing is enabled by default for structured outputs, automatically fixing malformed JSON, type mismatches, and missing fields. To disable healing:
115
+
116
+ ```python
117
+ client = Client("openai", healing=False)
118
+ ```
119
+
98
120
  ### Structured Streaming
99
121
 
100
122
  ```python
@@ -124,6 +146,7 @@ messages = [{"role": "user", "content": "Return JSON: {\"name\":\"Sam\",\"age\":
124
146
  healed = client.complete_json_healed("gpt-4o-mini", messages, max_tokens=64)
125
147
  print(healed.content)
126
148
  print(healed.was_healed, healed.confidence)
149
+ print(healed.usage.get("total_tokens"))
127
150
  ```
128
151
 
129
152
  ### Tool Calling
@@ -172,7 +195,7 @@ builder = (
172
195
  .add_middleware(TimingMiddleware())
173
196
  )
174
197
  client = builder.build()
175
- print(client.complete("gpt-4o-mini", "Give me one idea."))
198
+ print(client.complete("gpt-4o-mini", "Give me one idea.").content)
176
199
  ```
177
200
 
178
201
  ## Examples
@@ -183,8 +206,8 @@ OpenAI with a short prompt:
183
206
  from simple_agents_py import Client
184
207
 
185
208
  client = Client("openai")
186
- text = client.complete("gpt-4o-mini", "Summarize this in one sentence.")
187
- print(text)
209
+ response = client.complete("gpt-4o-mini", "Summarize this in one sentence.")
210
+ print(response.content)
188
211
  ```
189
212
 
190
213
  Anthropic with custom tokens and temperature:
@@ -193,13 +216,13 @@ Anthropic with custom tokens and temperature:
193
216
  from simple_agents_py import Client
194
217
 
195
218
  client = Client("anthropic")
196
- text = client.complete(
219
+ response = client.complete(
197
220
  "claude-3-5-sonnet-20240620",
198
221
  "Write a friendly welcome message for a new user.",
199
222
  max_tokens=120,
200
223
  temperature=0.5,
201
224
  )
202
- print(text)
225
+ print(response.content)
203
226
  ```
204
227
 
205
228
  OpenRouter with a specific model:
@@ -208,8 +231,8 @@ OpenRouter with a specific model:
208
231
  from simple_agents_py import Client
209
232
 
210
233
  client = Client("openrouter")
211
- text = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
212
- print(text)
234
+ response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
235
+ print(response.content)
213
236
  ```
214
237
 
215
238
  OpenRouter with explicit API base and key:
@@ -222,8 +245,8 @@ client = Client(
222
245
  api_base="https://openrouter.ai/api/v1",
223
246
  api_key="sk-your-openrouter-key",
224
247
  )
225
- text = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
226
- print(text)
248
+ response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
249
+ print(response.content)
227
250
  ```
228
251
 
229
252
  OpenAI with a custom gateway:
@@ -236,8 +259,8 @@ client = Client(
236
259
  api_base="http://localhost:4000/v1",
237
260
  api_key="sk-your-openai-key",
238
261
  )
239
- text = client.complete("gpt-4o-mini", "Say hello from a local proxy.")
240
- print(text)
262
+ response = client.complete("gpt-4o-mini", "Say hello from a local proxy.")
263
+ print(response.content)
241
264
  ```
242
265
 
243
266
  Basic error handling:
@@ -247,7 +270,7 @@ from simple_agents_py import Client
247
270
 
248
271
  try:
249
272
  client = Client("openai")
250
- print(client.complete("gpt-4o-mini", "Hello!"))
273
+ print(client.complete("gpt-4o-mini", "Hello!").content)
251
274
  except RuntimeError as exc:
252
275
  print(f"Request failed: {exc}")
253
276
  ```
@@ -42,7 +42,7 @@ from simple_agents_py import Client
42
42
 
43
43
  client = Client("openai")
44
44
  response = client.complete("gpt-4", "Hello from Python!", max_tokens=128, temperature=0.7)
45
- print(response)
45
+ print(response.content)
46
46
  ```
47
47
 
48
48
  ## Feature Guide
@@ -80,6 +80,28 @@ json_text = client.complete_json_schema("gpt-4o-mini", messages, schema, "person
80
80
  print(json.loads(json_text))
81
81
  ```
82
82
 
83
+ Pydantic models are accepted too:
84
+
85
+ ```python
86
+ from pydantic import BaseModel
87
+ from simple_agents_py import Client
88
+
89
+ class Person(BaseModel):
90
+ name: str
91
+ age: int
92
+
93
+ client = Client("openai")
94
+ messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
95
+ json_text = client.complete_json_schema("gpt-4o-mini", messages, Person, "person")
96
+ print(json_text)
97
+ ```
98
+
99
+ **Healing for Structured Outputs**: Healing is enabled by default for structured outputs, automatically fixing malformed JSON, type mismatches, and missing fields. To disable healing:
100
+
101
+ ```python
102
+ client = Client("openai", healing=False)
103
+ ```
104
+
83
105
  ### Structured Streaming
84
106
 
85
107
  ```python
@@ -109,6 +131,7 @@ messages = [{"role": "user", "content": "Return JSON: {\"name\":\"Sam\",\"age\":
109
131
  healed = client.complete_json_healed("gpt-4o-mini", messages, max_tokens=64)
110
132
  print(healed.content)
111
133
  print(healed.was_healed, healed.confidence)
134
+ print(healed.usage.get("total_tokens"))
112
135
  ```
113
136
 
114
137
  ### Tool Calling
@@ -157,7 +180,7 @@ builder = (
157
180
  .add_middleware(TimingMiddleware())
158
181
  )
159
182
  client = builder.build()
160
- print(client.complete("gpt-4o-mini", "Give me one idea."))
183
+ print(client.complete("gpt-4o-mini", "Give me one idea.").content)
161
184
  ```
162
185
 
163
186
  ## Examples
@@ -168,8 +191,8 @@ OpenAI with a short prompt:
168
191
  from simple_agents_py import Client
169
192
 
170
193
  client = Client("openai")
171
- text = client.complete("gpt-4o-mini", "Summarize this in one sentence.")
172
- print(text)
194
+ response = client.complete("gpt-4o-mini", "Summarize this in one sentence.")
195
+ print(response.content)
173
196
  ```
174
197
 
175
198
  Anthropic with custom tokens and temperature:
@@ -178,13 +201,13 @@ Anthropic with custom tokens and temperature:
178
201
  from simple_agents_py import Client
179
202
 
180
203
  client = Client("anthropic")
181
- text = client.complete(
204
+ response = client.complete(
182
205
  "claude-3-5-sonnet-20240620",
183
206
  "Write a friendly welcome message for a new user.",
184
207
  max_tokens=120,
185
208
  temperature=0.5,
186
209
  )
187
- print(text)
210
+ print(response.content)
188
211
  ```
189
212
 
190
213
  OpenRouter with a specific model:
@@ -193,8 +216,8 @@ OpenRouter with a specific model:
193
216
  from simple_agents_py import Client
194
217
 
195
218
  client = Client("openrouter")
196
- text = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
197
- print(text)
219
+ response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
220
+ print(response.content)
198
221
  ```
199
222
 
200
223
  OpenRouter with explicit API base and key:
@@ -207,8 +230,8 @@ client = Client(
207
230
  api_base="https://openrouter.ai/api/v1",
208
231
  api_key="sk-your-openrouter-key",
209
232
  )
210
- text = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
211
- print(text)
233
+ response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
234
+ print(response.content)
212
235
  ```
213
236
 
214
237
  OpenAI with a custom gateway:
@@ -221,8 +244,8 @@ client = Client(
221
244
  api_base="http://localhost:4000/v1",
222
245
  api_key="sk-your-openai-key",
223
246
  )
224
- text = client.complete("gpt-4o-mini", "Say hello from a local proxy.")
225
- print(text)
247
+ response = client.complete("gpt-4o-mini", "Say hello from a local proxy.")
248
+ print(response.content)
226
249
  ```
227
250
 
228
251
  Basic error handling:
@@ -232,7 +255,7 @@ from simple_agents_py import Client
232
255
 
233
256
  try:
234
257
  client = Client("openai")
235
- print(client.complete("gpt-4o-mini", "Hello!"))
258
+ print(client.complete("gpt-4o-mini", "Hello!").content)
236
259
  except RuntimeError as exc:
237
260
  print(f"Request failed: {exc}")
238
261
  ```
@@ -18,9 +18,9 @@ serde_json.workspace = true
18
18
  tokio.workspace = true
19
19
 
20
20
  simple-agent-type = { path = "../simple-agent-type", version = "0.1.0" }
21
- simple-agents-router = { path = "../simple-agents-router", version = "0.1.14" }
22
- simple-agents-cache = { path = "../simple-agents-cache", version = "0.1.14" }
23
- simple-agents-healing = { path = "../simple-agents-healing", version = "0.1.14" }
21
+ simple-agents-router = { path = "../simple-agents-router", version = "0.1.15" }
22
+ simple-agents-cache = { path = "../simple-agents-cache", version = "0.1.15" }
23
+ simple-agents-healing = { path = "../simple-agents-healing", version = "0.1.15" }
24
24
  futures-core = "0.3"
25
25
 
26
26
  [dev-dependencies]
@@ -32,7 +32,7 @@ regex-support = ["regex"]
32
32
  tokio = { version = "1.41", features = ["full"] }
33
33
  proptest = "1.5"
34
34
  criterion = { version = "0.5", features = ["html_reports"] }
35
- simple-agents-macros = { path = "../simple-agents-macros", version = "0.1.14" }
35
+ simple-agents-macros = { path = "../simple-agents-macros", version = "0.1.15" }
36
36
 
37
37
  [[test]]
38
38
  name = "parser_tests"
@@ -163,6 +163,24 @@ impl CoercionEngine {
163
163
  (Value::Number(n), Schema::UInt) if n.is_f64() => {
164
164
  self.coerce_float_to_uint(n.as_f64().unwrap(), flags, confidence)
165
165
  }
166
+ // Int to Float coercion (integers are valid numbers in JSON Schema)
167
+ (Value::Number(n), Schema::Float) if n.is_i64() || n.is_u64() => {
168
+ // Convert integer to float - this is lossless for most practical values
169
+ let float_val = if let Some(i) = n.as_i64() {
170
+ i as f64
171
+ } else if let Some(u) = n.as_u64() {
172
+ u as f64
173
+ } else {
174
+ unreachable!()
175
+ };
176
+ Ok(Value::Number(
177
+ serde_json::Number::from_f64(float_val)
178
+ .ok_or_else(|| HealingError::ParseError {
179
+ input: format!("{}", n),
180
+ expected_type: "float".to_string(),
181
+ })?,
182
+ ))
183
+ }
166
184
 
167
185
  // Array coercion
168
186
  (Value::Array(arr), Schema::Array(elem_schema)) => {
@@ -427,6 +445,13 @@ impl CoercionEngine {
427
445
  });
428
446
  *confidence *= 0.9;
429
447
  result.insert(field.name.clone(), default.clone());
448
+ } else if flags.contains(&CoercionFlag::TruncatedJson) {
449
+ // If response was truncated, allow missing required fields by injecting null
450
+ flags.push(CoercionFlag::UsedDefaultValue {
451
+ field: field.name.clone(),
452
+ });
453
+ *confidence *= 0.7; // Lower confidence for missing required field
454
+ result.insert(field.name.clone(), Value::Null);
430
455
  } else {
431
456
  return Err(HealingError::MissingField {
432
457
  field: field.name.clone(),
@@ -10,7 +10,7 @@ readme = "README.md"
10
10
 
11
11
  [dependencies]
12
12
  simple-agent-type = { path = "../simple-agent-type", version = "0.1.0" }
13
- simple-agents-healing = { path = "../simple-agents-healing", version = "0.1.14" }
13
+ simple-agents-healing = { path = "../simple-agents-healing", version = "0.1.15" }
14
14
  reqwest = { version = "0.12", features = ["json", "stream"] }
15
15
  tokio = { version = "1.42", features = ["full"] }
16
16
  futures = "0.3"
@@ -34,6 +34,6 @@ prometheus = ["dep:metrics-exporter-prometheus"]
34
34
  [dev-dependencies]
35
35
  tokio-test = "0.4"
36
36
  tracing-subscriber = "0.3"
37
- simple-agents-cache = { path = "../simple-agents-cache", version = "0.1.14" }
38
- simple-agents-macros = { path = "../simple-agents-macros", version = "0.1.14" }
37
+ simple-agents-cache = { path = "../simple-agents-cache", version = "0.1.15" }
38
+ simple-agents-macros = { path = "../simple-agents-macros", version = "0.1.15" }
39
39
  dotenv = "0.15"
@@ -18,9 +18,9 @@ serde_json = { workspace = true }
18
18
  futures-util = "0.3"
19
19
  async-trait = "0.1"
20
20
 
21
- simple-agents-core = { path = "../simple-agents-core", version = "0.1.14" }
22
- simple-agents-providers = { path = "../simple-agents-providers", version = "0.1.14" }
23
- simple-agents-cache = { path = "../simple-agents-cache", version = "0.1.14" }
24
- simple-agents-router = { path = "../simple-agents-router", version = "0.1.14" }
21
+ simple-agents-core = { path = "../simple-agents-core", version = "0.1.15" }
22
+ simple-agents-providers = { path = "../simple-agents-providers", version = "0.1.15" }
23
+ simple-agents-cache = { path = "../simple-agents-cache", version = "0.1.15" }
24
+ simple-agents-router = { path = "../simple-agents-router", version = "0.1.15" }
25
25
  simple-agent-type = { path = "../simple-agent-type", version = "0.1.0" }
26
- simple-agents-healing = { path = "../simple-agents-healing", version = "0.1.14" }
26
+ simple-agents-healing = { path = "../simple-agents-healing", version = "0.1.15" }
@@ -42,7 +42,7 @@ from simple_agents_py import Client
42
42
 
43
43
  client = Client("openai")
44
44
  response = client.complete("gpt-4", "Hello from Python!", max_tokens=128, temperature=0.7)
45
- print(response)
45
+ print(response.content)
46
46
  ```
47
47
 
48
48
  ## Feature Guide
@@ -80,6 +80,28 @@ json_text = client.complete_json_schema("gpt-4o-mini", messages, schema, "person
80
80
  print(json.loads(json_text))
81
81
  ```
82
82
 
83
+ Pydantic models are accepted too:
84
+
85
+ ```python
86
+ from pydantic import BaseModel
87
+ from simple_agents_py import Client
88
+
89
+ class Person(BaseModel):
90
+ name: str
91
+ age: int
92
+
93
+ client = Client("openai")
94
+ messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
95
+ json_text = client.complete_json_schema("gpt-4o-mini", messages, Person, "person")
96
+ print(json_text)
97
+ ```
98
+
99
+ **Healing for Structured Outputs**: Healing is enabled by default for structured outputs, automatically fixing malformed JSON, type mismatches, and missing fields. To disable healing:
100
+
101
+ ```python
102
+ client = Client("openai", healing=False)
103
+ ```
104
+
83
105
  ### Structured Streaming
84
106
 
85
107
  ```python
@@ -109,6 +131,7 @@ messages = [{"role": "user", "content": "Return JSON: {\"name\":\"Sam\",\"age\":
109
131
  healed = client.complete_json_healed("gpt-4o-mini", messages, max_tokens=64)
110
132
  print(healed.content)
111
133
  print(healed.was_healed, healed.confidence)
134
+ print(healed.usage.get("total_tokens"))
112
135
  ```
113
136
 
114
137
  ### Tool Calling
@@ -157,7 +180,7 @@ builder = (
157
180
  .add_middleware(TimingMiddleware())
158
181
  )
159
182
  client = builder.build()
160
- print(client.complete("gpt-4o-mini", "Give me one idea."))
183
+ print(client.complete("gpt-4o-mini", "Give me one idea.").content)
161
184
  ```
162
185
 
163
186
  ## Examples
@@ -168,8 +191,8 @@ OpenAI with a short prompt:
168
191
  from simple_agents_py import Client
169
192
 
170
193
  client = Client("openai")
171
- text = client.complete("gpt-4o-mini", "Summarize this in one sentence.")
172
- print(text)
194
+ response = client.complete("gpt-4o-mini", "Summarize this in one sentence.")
195
+ print(response.content)
173
196
  ```
174
197
 
175
198
  Anthropic with custom tokens and temperature:
@@ -178,13 +201,13 @@ Anthropic with custom tokens and temperature:
178
201
  from simple_agents_py import Client
179
202
 
180
203
  client = Client("anthropic")
181
- text = client.complete(
204
+ response = client.complete(
182
205
  "claude-3-5-sonnet-20240620",
183
206
  "Write a friendly welcome message for a new user.",
184
207
  max_tokens=120,
185
208
  temperature=0.5,
186
209
  )
187
- print(text)
210
+ print(response.content)
188
211
  ```
189
212
 
190
213
  OpenRouter with a specific model:
@@ -193,8 +216,8 @@ OpenRouter with a specific model:
193
216
  from simple_agents_py import Client
194
217
 
195
218
  client = Client("openrouter")
196
- text = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
197
- print(text)
219
+ response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
220
+ print(response.content)
198
221
  ```
199
222
 
200
223
  OpenRouter with explicit API base and key:
@@ -207,8 +230,8 @@ client = Client(
207
230
  api_base="https://openrouter.ai/api/v1",
208
231
  api_key="sk-your-openrouter-key",
209
232
  )
210
- text = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
211
- print(text)
233
+ response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
234
+ print(response.content)
212
235
  ```
213
236
 
214
237
  OpenAI with a custom gateway:
@@ -221,8 +244,8 @@ client = Client(
221
244
  api_base="http://localhost:4000/v1",
222
245
  api_key="sk-your-openai-key",
223
246
  )
224
- text = client.complete("gpt-4o-mini", "Say hello from a local proxy.")
225
- print(text)
247
+ response = client.complete("gpt-4o-mini", "Say hello from a local proxy.")
248
+ print(response.content)
226
249
  ```
227
250
 
228
251
  Basic error handling:
@@ -232,7 +255,7 @@ from simple_agents_py import Client
232
255
 
233
256
  try:
234
257
  client = Client("openai")
235
- print(client.complete("gpt-4o-mini", "Hello!"))
258
+ print(client.complete("gpt-4o-mini", "Hello!").content)
236
259
  except RuntimeError as exc:
237
260
  print(f"Request failed: {exc}")
238
261
  ```