simple-agents-py 0.1.14__tar.gz → 0.2.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.
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/Cargo.lock +124 -12
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/Cargo.toml +4 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/PKG-INFO +64 -19
- {simple_agents_py-0.1.14/crates/simple-agents-py → simple_agents_py-0.2.0}/README.md +63 -18
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-cache/Cargo.toml +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/Cargo.toml +4 -4
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/README.md +21 -4
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/examples/basic_client.rs +10 -2
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/src/client.rs +74 -9
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/src/lib.rs +13 -3
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/tests/client_integration.rs +49 -7
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/Cargo.toml +2 -2
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/src/coercion.rs +26 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/src/parser.rs +3 -3
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-macros/Cargo.toml +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/Cargo.toml +5 -5
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/openai/mod.rs +4 -9
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/openrouter/mod.rs +2 -6
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/Cargo.toml +6 -6
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0/crates/simple-agents-py}/README.md +63 -18
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/examples/client_builder_demo.py +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/examples/healing_demo.py +6 -3
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/examples/streaming_demo.py +25 -5
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/examples/structured_streaming_demo.py +44 -19
- simple_agents_py-0.2.0/crates/simple-agents-py/simple_agents_py.pyi +181 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/src/lib.rs +553 -670
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_client.py +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_client_builder.py +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_direct_healing.py +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_healing.py +7 -5
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_integration_openai.py +34 -12
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_routing_config.py +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_streaming.py +7 -7
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_streaming_parser.py +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/tests/test_structured_streaming.py +26 -14
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/uv.lock +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/Cargo.toml +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/src/fallback.rs +5 -2
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/src/latency.rs +2 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/pyproject.toml +1 -1
- simple_agents_py-0.2.0/simple_agents_py.pyi +181 -0
- simple_agents_py-0.1.14/crates/simple-agents-py/simple_agents_py.pyi +0 -45
- simple_agents_py-0.1.14/simple_agents_py.pyi +0 -45
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/Cargo.toml +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/README.md +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/TEST_GUIDE.md +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/TODO.md +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/examples/basic_usage.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/examples/mock_provider.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/cache.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/coercion.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/config.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/error.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/lib.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/message.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/provider.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/request.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/response.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/router.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/tool.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/src/validation.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agent-type/tests/integration_test.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-cache/src/lib.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-cache/src/memory.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-cache/src/noop.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/src/healing.rs +2 -2
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/src/middleware.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-core/src/routing.rs +3 -3
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/README.md +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/benches/parser_benchmarks.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/examples/basic_healing.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/examples/coercion_demo.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/examples/streaming_annotations.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/examples/streaming_partial_types.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/src/lib.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/src/schema.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/src/streaming.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/src/string_utils.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/tests/parser_tests.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/tests/property_tests.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/tests/stream_annotations_tests.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-healing/tests/streaming_tests.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-macros/README.md +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-macros/src/lib.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-macros/src/partial.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-macros/tests/partial_type_tests.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/README.md +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/anthropic_basic.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/anthropic_structured_output.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/cache_usage.rs +2 -2
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/custom_api.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/healing_fallback.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/openai_basic.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/openai_structured_output.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/openrouter_basic.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/retry_demo.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/streaming.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/streaming_structured.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/streaming_with_healing.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/test_local_api.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/examples/test_reqwest.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/run_integration_tests.sh +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/anthropic/error.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/anthropic/mod.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/anthropic/models.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/anthropic/streaming.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/common/error.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/common/http_client.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/common/mod.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/healing_integration.rs +2 -2
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/lib.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/metrics.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/openai/error.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/openai/models.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/openai/streaming.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/rate_limit.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/retry.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/schema_converter.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/streaming_structured.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/src/utils.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/tests/README.md +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/tests/healing_integration_tests.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-providers/tests/openai_integration.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/examples/direct_healing_demo.py +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/examples/routing_config_demo.py +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/examples/streaming_parser_demo.py +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-py/py.typed +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/examples/round_robin_router.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/src/circuit_breaker.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/src/cost.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/src/health.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/src/lib.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/src/retry.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/src/round_robin.rs +0 -0
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/crates/simple-agents-router/tests/health_tracker_integration.rs +1 -1
- {simple_agents_py-0.1.14 → simple_agents_py-0.2.0}/py.typed +0 -0
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
# It is not intended for manual editing.
|
|
3
3
|
version = 3
|
|
4
4
|
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "adler2"
|
|
7
|
+
version = "2.0.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
|
10
|
+
|
|
5
11
|
[[package]]
|
|
6
12
|
name = "ahash"
|
|
7
13
|
version = "0.8.12"
|
|
@@ -23,6 +29,21 @@ dependencies = [
|
|
|
23
29
|
"memchr",
|
|
24
30
|
]
|
|
25
31
|
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "alloc-no-stdlib"
|
|
34
|
+
version = "2.0.4"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3"
|
|
37
|
+
|
|
38
|
+
[[package]]
|
|
39
|
+
name = "alloc-stdlib"
|
|
40
|
+
version = "0.2.2"
|
|
41
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
42
|
+
checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece"
|
|
43
|
+
dependencies = [
|
|
44
|
+
"alloc-no-stdlib",
|
|
45
|
+
]
|
|
46
|
+
|
|
26
47
|
[[package]]
|
|
27
48
|
name = "anes"
|
|
28
49
|
version = "0.1.6"
|
|
@@ -91,6 +112,18 @@ version = "0.7.6"
|
|
|
91
112
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
92
113
|
checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
|
|
93
114
|
|
|
115
|
+
[[package]]
|
|
116
|
+
name = "async-compression"
|
|
117
|
+
version = "0.4.37"
|
|
118
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
119
|
+
checksum = "d10e4f991a553474232bc0a31799f6d24b034a84c0971d80d2e2f78b2e576e40"
|
|
120
|
+
dependencies = [
|
|
121
|
+
"compression-codecs",
|
|
122
|
+
"compression-core",
|
|
123
|
+
"pin-project-lite",
|
|
124
|
+
"tokio",
|
|
125
|
+
]
|
|
126
|
+
|
|
94
127
|
[[package]]
|
|
95
128
|
name = "async-trait"
|
|
96
129
|
version = "0.1.89"
|
|
@@ -177,6 +210,27 @@ dependencies = [
|
|
|
177
210
|
"cpufeatures",
|
|
178
211
|
]
|
|
179
212
|
|
|
213
|
+
[[package]]
|
|
214
|
+
name = "brotli"
|
|
215
|
+
version = "8.0.2"
|
|
216
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
217
|
+
checksum = "4bd8b9603c7aa97359dbd97ecf258968c95f3adddd6db2f7e7a5bef101c84560"
|
|
218
|
+
dependencies = [
|
|
219
|
+
"alloc-no-stdlib",
|
|
220
|
+
"alloc-stdlib",
|
|
221
|
+
"brotli-decompressor",
|
|
222
|
+
]
|
|
223
|
+
|
|
224
|
+
[[package]]
|
|
225
|
+
name = "brotli-decompressor"
|
|
226
|
+
version = "5.0.0"
|
|
227
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
228
|
+
checksum = "874bb8112abecc98cbd6d81ea4fa7e94fb9449648c93cc89aa40c81c24d7de03"
|
|
229
|
+
dependencies = [
|
|
230
|
+
"alloc-no-stdlib",
|
|
231
|
+
"alloc-stdlib",
|
|
232
|
+
]
|
|
233
|
+
|
|
180
234
|
[[package]]
|
|
181
235
|
name = "bumpalo"
|
|
182
236
|
version = "3.19.1"
|
|
@@ -295,6 +349,24 @@ version = "1.0.4"
|
|
|
295
349
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
296
350
|
checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75"
|
|
297
351
|
|
|
352
|
+
[[package]]
|
|
353
|
+
name = "compression-codecs"
|
|
354
|
+
version = "0.4.36"
|
|
355
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
356
|
+
checksum = "00828ba6fd27b45a448e57dbfe84f1029d4c9f26b368157e9a448a5f49a2ec2a"
|
|
357
|
+
dependencies = [
|
|
358
|
+
"brotli",
|
|
359
|
+
"compression-core",
|
|
360
|
+
"flate2",
|
|
361
|
+
"memchr",
|
|
362
|
+
]
|
|
363
|
+
|
|
364
|
+
[[package]]
|
|
365
|
+
name = "compression-core"
|
|
366
|
+
version = "0.4.31"
|
|
367
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
368
|
+
checksum = "75984efb6ed102a0d42db99afb6c1948f0380d1d91808d5529916e6c08b49d8d"
|
|
369
|
+
|
|
298
370
|
[[package]]
|
|
299
371
|
name = "constant_time_eq"
|
|
300
372
|
version = "0.4.2"
|
|
@@ -345,6 +417,15 @@ dependencies = [
|
|
|
345
417
|
"libc",
|
|
346
418
|
]
|
|
347
419
|
|
|
420
|
+
[[package]]
|
|
421
|
+
name = "crc32fast"
|
|
422
|
+
version = "1.5.0"
|
|
423
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
424
|
+
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
|
425
|
+
dependencies = [
|
|
426
|
+
"cfg-if",
|
|
427
|
+
]
|
|
428
|
+
|
|
348
429
|
[[package]]
|
|
349
430
|
name = "criterion"
|
|
350
431
|
version = "0.5.1"
|
|
@@ -501,6 +582,16 @@ version = "0.1.8"
|
|
|
501
582
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
502
583
|
checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db"
|
|
503
584
|
|
|
585
|
+
[[package]]
|
|
586
|
+
name = "flate2"
|
|
587
|
+
version = "1.1.8"
|
|
588
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
589
|
+
checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369"
|
|
590
|
+
dependencies = [
|
|
591
|
+
"crc32fast",
|
|
592
|
+
"miniz_oxide",
|
|
593
|
+
]
|
|
594
|
+
|
|
504
595
|
[[package]]
|
|
505
596
|
name = "fnv"
|
|
506
597
|
version = "1.0.7"
|
|
@@ -1165,6 +1256,16 @@ version = "0.3.17"
|
|
|
1165
1256
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1166
1257
|
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
|
|
1167
1258
|
|
|
1259
|
+
[[package]]
|
|
1260
|
+
name = "miniz_oxide"
|
|
1261
|
+
version = "0.8.9"
|
|
1262
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1263
|
+
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
|
1264
|
+
dependencies = [
|
|
1265
|
+
"adler2",
|
|
1266
|
+
"simd-adler32",
|
|
1267
|
+
]
|
|
1268
|
+
|
|
1168
1269
|
[[package]]
|
|
1169
1270
|
name = "mio"
|
|
1170
1271
|
version = "1.1.1"
|
|
@@ -2033,9 +2134,15 @@ dependencies = [
|
|
|
2033
2134
|
"libc",
|
|
2034
2135
|
]
|
|
2035
2136
|
|
|
2137
|
+
[[package]]
|
|
2138
|
+
name = "simd-adler32"
|
|
2139
|
+
version = "0.3.8"
|
|
2140
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2141
|
+
checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2"
|
|
2142
|
+
|
|
2036
2143
|
[[package]]
|
|
2037
2144
|
name = "simple-agent-type"
|
|
2038
|
-
version = "0.
|
|
2145
|
+
version = "0.2.0"
|
|
2039
2146
|
dependencies = [
|
|
2040
2147
|
"async-trait",
|
|
2041
2148
|
"blake3",
|
|
@@ -2050,7 +2157,7 @@ dependencies = [
|
|
|
2050
2157
|
|
|
2051
2158
|
[[package]]
|
|
2052
2159
|
name = "simple-agents-cache"
|
|
2053
|
-
version = "0.
|
|
2160
|
+
version = "0.2.0"
|
|
2054
2161
|
dependencies = [
|
|
2055
2162
|
"async-trait",
|
|
2056
2163
|
"simple-agent-type",
|
|
@@ -2059,7 +2166,7 @@ dependencies = [
|
|
|
2059
2166
|
|
|
2060
2167
|
[[package]]
|
|
2061
2168
|
name = "simple-agents-cli"
|
|
2062
|
-
version = "0.
|
|
2169
|
+
version = "0.2.0"
|
|
2063
2170
|
dependencies = [
|
|
2064
2171
|
"clap",
|
|
2065
2172
|
"serde",
|
|
@@ -2076,7 +2183,7 @@ dependencies = [
|
|
|
2076
2183
|
|
|
2077
2184
|
[[package]]
|
|
2078
2185
|
name = "simple-agents-core"
|
|
2079
|
-
version = "0.
|
|
2186
|
+
version = "0.2.0"
|
|
2080
2187
|
dependencies = [
|
|
2081
2188
|
"async-trait",
|
|
2082
2189
|
"futures-core",
|
|
@@ -2091,7 +2198,7 @@ dependencies = [
|
|
|
2091
2198
|
|
|
2092
2199
|
[[package]]
|
|
2093
2200
|
name = "simple-agents-examples"
|
|
2094
|
-
version = "0.
|
|
2201
|
+
version = "0.2.0"
|
|
2095
2202
|
dependencies = [
|
|
2096
2203
|
"dotenv",
|
|
2097
2204
|
"futures-util",
|
|
@@ -2104,7 +2211,7 @@ dependencies = [
|
|
|
2104
2211
|
|
|
2105
2212
|
[[package]]
|
|
2106
2213
|
name = "simple-agents-ffi"
|
|
2107
|
-
version = "0.
|
|
2214
|
+
version = "0.2.0"
|
|
2108
2215
|
dependencies = [
|
|
2109
2216
|
"async-trait",
|
|
2110
2217
|
"simple-agent-type",
|
|
@@ -2115,7 +2222,7 @@ dependencies = [
|
|
|
2115
2222
|
|
|
2116
2223
|
[[package]]
|
|
2117
2224
|
name = "simple-agents-healing"
|
|
2118
|
-
version = "0.
|
|
2225
|
+
version = "0.2.0"
|
|
2119
2226
|
dependencies = [
|
|
2120
2227
|
"criterion",
|
|
2121
2228
|
"proptest",
|
|
@@ -2131,7 +2238,7 @@ dependencies = [
|
|
|
2131
2238
|
|
|
2132
2239
|
[[package]]
|
|
2133
2240
|
name = "simple-agents-macros"
|
|
2134
|
-
version = "0.
|
|
2241
|
+
version = "0.2.0"
|
|
2135
2242
|
dependencies = [
|
|
2136
2243
|
"proc-macro2",
|
|
2137
2244
|
"quote",
|
|
@@ -2143,7 +2250,7 @@ dependencies = [
|
|
|
2143
2250
|
|
|
2144
2251
|
[[package]]
|
|
2145
2252
|
name = "simple-agents-napi"
|
|
2146
|
-
version = "0.
|
|
2253
|
+
version = "0.2.0"
|
|
2147
2254
|
dependencies = [
|
|
2148
2255
|
"napi",
|
|
2149
2256
|
"napi-derive",
|
|
@@ -2155,7 +2262,7 @@ dependencies = [
|
|
|
2155
2262
|
|
|
2156
2263
|
[[package]]
|
|
2157
2264
|
name = "simple-agents-providers"
|
|
2158
|
-
version = "0.
|
|
2265
|
+
version = "0.2.0"
|
|
2159
2266
|
dependencies = [
|
|
2160
2267
|
"async-trait",
|
|
2161
2268
|
"bytes",
|
|
@@ -2183,7 +2290,7 @@ dependencies = [
|
|
|
2183
2290
|
|
|
2184
2291
|
[[package]]
|
|
2185
2292
|
name = "simple-agents-py"
|
|
2186
|
-
version = "0.
|
|
2293
|
+
version = "0.2.0"
|
|
2187
2294
|
dependencies = [
|
|
2188
2295
|
"async-trait",
|
|
2189
2296
|
"futures-util",
|
|
@@ -2202,7 +2309,7 @@ dependencies = [
|
|
|
2202
2309
|
|
|
2203
2310
|
[[package]]
|
|
2204
2311
|
name = "simple-agents-router"
|
|
2205
|
-
version = "0.
|
|
2312
|
+
version = "0.2.0"
|
|
2206
2313
|
dependencies = [
|
|
2207
2314
|
"async-trait",
|
|
2208
2315
|
"futures-core",
|
|
@@ -2552,13 +2659,18 @@ version = "0.6.8"
|
|
|
2552
2659
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2553
2660
|
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
|
|
2554
2661
|
dependencies = [
|
|
2662
|
+
"async-compression",
|
|
2555
2663
|
"bitflags",
|
|
2556
2664
|
"bytes",
|
|
2665
|
+
"futures-core",
|
|
2557
2666
|
"futures-util",
|
|
2558
2667
|
"http",
|
|
2559
2668
|
"http-body",
|
|
2669
|
+
"http-body-util",
|
|
2560
2670
|
"iri-string",
|
|
2561
2671
|
"pin-project-lite",
|
|
2672
|
+
"tokio",
|
|
2673
|
+
"tokio-util",
|
|
2562
2674
|
"tower",
|
|
2563
2675
|
"tower-layer",
|
|
2564
2676
|
"tower-service",
|
|
@@ -3,7 +3,7 @@ members = ["crates/*"]
|
|
|
3
3
|
resolver = "2"
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.2.0"
|
|
7
7
|
edition = "2021"
|
|
8
8
|
rust-version = "1.75"
|
|
9
9
|
authors = ["SimpleAgents Contributors"]
|
|
@@ -28,3 +28,6 @@ futures-util = "0.3"
|
|
|
28
28
|
metrics = "0.23"
|
|
29
29
|
metrics-exporter-prometheus = "0.15"
|
|
30
30
|
governor = "0.6"
|
|
31
|
+
simple-agent-type = { version = "0.2.0", path = "crates/simple-agent-type" }
|
|
32
|
+
simple-agents-healing = { version = "0.2.0", path = "crates/simple-agents-healing" }
|
|
33
|
+
simple-agents-providers = { version = "0.2.0", path = "crates/simple-agents-providers" }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simple-agents-py
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
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
|
|
@@ -69,7 +69,7 @@ from simple_agents_py import Client
|
|
|
69
69
|
|
|
70
70
|
client = Client("openai")
|
|
71
71
|
messages = [{"role": "user", "content": "Say hello in one sentence."}]
|
|
72
|
-
for chunk in client.
|
|
72
|
+
for chunk in client.complete("gpt-4o-mini", messages, max_tokens=64, stream=True):
|
|
73
73
|
if chunk.content:
|
|
74
74
|
print(chunk.content, end="", flush=True)
|
|
75
75
|
print()
|
|
@@ -91,10 +91,42 @@ schema = {
|
|
|
91
91
|
"required": ["name", "age"],
|
|
92
92
|
}
|
|
93
93
|
messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
|
|
94
|
-
json_text = client.
|
|
94
|
+
json_text = client.complete(
|
|
95
|
+
"gpt-4o-mini",
|
|
96
|
+
messages,
|
|
97
|
+
schema=schema,
|
|
98
|
+
schema_name="person",
|
|
99
|
+
)
|
|
95
100
|
print(json.loads(json_text))
|
|
96
101
|
```
|
|
97
102
|
|
|
103
|
+
Pydantic models are accepted too:
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from pydantic import BaseModel
|
|
107
|
+
from simple_agents_py import Client
|
|
108
|
+
|
|
109
|
+
class Person(BaseModel):
|
|
110
|
+
name: str
|
|
111
|
+
age: int
|
|
112
|
+
|
|
113
|
+
client = Client("openai")
|
|
114
|
+
messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
|
|
115
|
+
json_text = client.complete(
|
|
116
|
+
"gpt-4o-mini",
|
|
117
|
+
messages,
|
|
118
|
+
schema=Person,
|
|
119
|
+
schema_name="person",
|
|
120
|
+
)
|
|
121
|
+
print(json_text)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Healing for Structured Outputs**: Healing is enabled by default for structured outputs, automatically fixing malformed JSON, type mismatches, and missing fields. To disable healing:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
client = Client("openai", healing=False)
|
|
128
|
+
```
|
|
129
|
+
|
|
98
130
|
### Structured Streaming
|
|
99
131
|
|
|
100
132
|
```python
|
|
@@ -107,7 +139,13 @@ schema = {
|
|
|
107
139
|
"required": ["name", "age"],
|
|
108
140
|
}
|
|
109
141
|
messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
|
|
110
|
-
for event in client.
|
|
142
|
+
for event in client.complete(
|
|
143
|
+
"gpt-4o-mini",
|
|
144
|
+
messages,
|
|
145
|
+
schema=schema,
|
|
146
|
+
max_tokens=64,
|
|
147
|
+
stream=True,
|
|
148
|
+
):
|
|
111
149
|
if event.is_partial:
|
|
112
150
|
print("partial:", event.partial_value)
|
|
113
151
|
else:
|
|
@@ -121,9 +159,16 @@ from simple_agents_py import Client
|
|
|
121
159
|
|
|
122
160
|
client = Client("openai")
|
|
123
161
|
messages = [{"role": "user", "content": "Return JSON: {\"name\":\"Sam\",\"age\":30}"}]
|
|
124
|
-
healed = client.
|
|
162
|
+
healed = client.complete(
|
|
163
|
+
"gpt-4o-mini",
|
|
164
|
+
messages,
|
|
165
|
+
max_tokens=64,
|
|
166
|
+
response_format="json",
|
|
167
|
+
heal=True,
|
|
168
|
+
)
|
|
125
169
|
print(healed.content)
|
|
126
170
|
print(healed.was_healed, healed.confidence)
|
|
171
|
+
print(healed.usage.get("total_tokens"))
|
|
127
172
|
```
|
|
128
173
|
|
|
129
174
|
### Tool Calling
|
|
@@ -150,7 +195,7 @@ tools = [
|
|
|
150
195
|
}
|
|
151
196
|
]
|
|
152
197
|
messages = [{"role": "user", "content": "What's the weather in Tokyo?"}]
|
|
153
|
-
response = client.
|
|
198
|
+
response = client.complete("gpt-4o-mini", messages, tools=tools)
|
|
154
199
|
print(response.tool_calls)
|
|
155
200
|
```
|
|
156
201
|
|
|
@@ -172,7 +217,7 @@ builder = (
|
|
|
172
217
|
.add_middleware(TimingMiddleware())
|
|
173
218
|
)
|
|
174
219
|
client = builder.build()
|
|
175
|
-
print(client.complete("gpt-4o-mini", "Give me one idea."))
|
|
220
|
+
print(client.complete("gpt-4o-mini", "Give me one idea.").content)
|
|
176
221
|
```
|
|
177
222
|
|
|
178
223
|
## Examples
|
|
@@ -183,8 +228,8 @@ OpenAI with a short prompt:
|
|
|
183
228
|
from simple_agents_py import Client
|
|
184
229
|
|
|
185
230
|
client = Client("openai")
|
|
186
|
-
|
|
187
|
-
print(
|
|
231
|
+
response = client.complete("gpt-4o-mini", "Summarize this in one sentence.")
|
|
232
|
+
print(response.content)
|
|
188
233
|
```
|
|
189
234
|
|
|
190
235
|
Anthropic with custom tokens and temperature:
|
|
@@ -193,13 +238,13 @@ Anthropic with custom tokens and temperature:
|
|
|
193
238
|
from simple_agents_py import Client
|
|
194
239
|
|
|
195
240
|
client = Client("anthropic")
|
|
196
|
-
|
|
241
|
+
response = client.complete(
|
|
197
242
|
"claude-3-5-sonnet-20240620",
|
|
198
243
|
"Write a friendly welcome message for a new user.",
|
|
199
244
|
max_tokens=120,
|
|
200
245
|
temperature=0.5,
|
|
201
246
|
)
|
|
202
|
-
print(
|
|
247
|
+
print(response.content)
|
|
203
248
|
```
|
|
204
249
|
|
|
205
250
|
OpenRouter with a specific model:
|
|
@@ -208,8 +253,8 @@ OpenRouter with a specific model:
|
|
|
208
253
|
from simple_agents_py import Client
|
|
209
254
|
|
|
210
255
|
client = Client("openrouter")
|
|
211
|
-
|
|
212
|
-
print(
|
|
256
|
+
response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
|
|
257
|
+
print(response.content)
|
|
213
258
|
```
|
|
214
259
|
|
|
215
260
|
OpenRouter with explicit API base and key:
|
|
@@ -222,8 +267,8 @@ client = Client(
|
|
|
222
267
|
api_base="https://openrouter.ai/api/v1",
|
|
223
268
|
api_key="sk-your-openrouter-key",
|
|
224
269
|
)
|
|
225
|
-
|
|
226
|
-
print(
|
|
270
|
+
response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
|
|
271
|
+
print(response.content)
|
|
227
272
|
```
|
|
228
273
|
|
|
229
274
|
OpenAI with a custom gateway:
|
|
@@ -236,8 +281,8 @@ client = Client(
|
|
|
236
281
|
api_base="http://localhost:4000/v1",
|
|
237
282
|
api_key="sk-your-openai-key",
|
|
238
283
|
)
|
|
239
|
-
|
|
240
|
-
print(
|
|
284
|
+
response = client.complete("gpt-4o-mini", "Say hello from a local proxy.")
|
|
285
|
+
print(response.content)
|
|
241
286
|
```
|
|
242
287
|
|
|
243
288
|
Basic error handling:
|
|
@@ -247,7 +292,7 @@ from simple_agents_py import Client
|
|
|
247
292
|
|
|
248
293
|
try:
|
|
249
294
|
client = Client("openai")
|
|
250
|
-
print(client.complete("gpt-4o-mini", "Hello!"))
|
|
295
|
+
print(client.complete("gpt-4o-mini", "Hello!").content)
|
|
251
296
|
except RuntimeError as exc:
|
|
252
297
|
print(f"Request failed: {exc}")
|
|
253
298
|
```
|
|
@@ -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
|
|
@@ -54,7 +54,7 @@ from simple_agents_py import Client
|
|
|
54
54
|
|
|
55
55
|
client = Client("openai")
|
|
56
56
|
messages = [{"role": "user", "content": "Say hello in one sentence."}]
|
|
57
|
-
for chunk in client.
|
|
57
|
+
for chunk in client.complete("gpt-4o-mini", messages, max_tokens=64, stream=True):
|
|
58
58
|
if chunk.content:
|
|
59
59
|
print(chunk.content, end="", flush=True)
|
|
60
60
|
print()
|
|
@@ -76,10 +76,42 @@ schema = {
|
|
|
76
76
|
"required": ["name", "age"],
|
|
77
77
|
}
|
|
78
78
|
messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
|
|
79
|
-
json_text = client.
|
|
79
|
+
json_text = client.complete(
|
|
80
|
+
"gpt-4o-mini",
|
|
81
|
+
messages,
|
|
82
|
+
schema=schema,
|
|
83
|
+
schema_name="person",
|
|
84
|
+
)
|
|
80
85
|
print(json.loads(json_text))
|
|
81
86
|
```
|
|
82
87
|
|
|
88
|
+
Pydantic models are accepted too:
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
from pydantic import BaseModel
|
|
92
|
+
from simple_agents_py import Client
|
|
93
|
+
|
|
94
|
+
class Person(BaseModel):
|
|
95
|
+
name: str
|
|
96
|
+
age: int
|
|
97
|
+
|
|
98
|
+
client = Client("openai")
|
|
99
|
+
messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
|
|
100
|
+
json_text = client.complete(
|
|
101
|
+
"gpt-4o-mini",
|
|
102
|
+
messages,
|
|
103
|
+
schema=Person,
|
|
104
|
+
schema_name="person",
|
|
105
|
+
)
|
|
106
|
+
print(json_text)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Healing for Structured Outputs**: Healing is enabled by default for structured outputs, automatically fixing malformed JSON, type mismatches, and missing fields. To disable healing:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
client = Client("openai", healing=False)
|
|
113
|
+
```
|
|
114
|
+
|
|
83
115
|
### Structured Streaming
|
|
84
116
|
|
|
85
117
|
```python
|
|
@@ -92,7 +124,13 @@ schema = {
|
|
|
92
124
|
"required": ["name", "age"],
|
|
93
125
|
}
|
|
94
126
|
messages = [{"role": "user", "content": "Extract name and age: Alice is 28."}]
|
|
95
|
-
for event in client.
|
|
127
|
+
for event in client.complete(
|
|
128
|
+
"gpt-4o-mini",
|
|
129
|
+
messages,
|
|
130
|
+
schema=schema,
|
|
131
|
+
max_tokens=64,
|
|
132
|
+
stream=True,
|
|
133
|
+
):
|
|
96
134
|
if event.is_partial:
|
|
97
135
|
print("partial:", event.partial_value)
|
|
98
136
|
else:
|
|
@@ -106,9 +144,16 @@ from simple_agents_py import Client
|
|
|
106
144
|
|
|
107
145
|
client = Client("openai")
|
|
108
146
|
messages = [{"role": "user", "content": "Return JSON: {\"name\":\"Sam\",\"age\":30}"}]
|
|
109
|
-
healed = client.
|
|
147
|
+
healed = client.complete(
|
|
148
|
+
"gpt-4o-mini",
|
|
149
|
+
messages,
|
|
150
|
+
max_tokens=64,
|
|
151
|
+
response_format="json",
|
|
152
|
+
heal=True,
|
|
153
|
+
)
|
|
110
154
|
print(healed.content)
|
|
111
155
|
print(healed.was_healed, healed.confidence)
|
|
156
|
+
print(healed.usage.get("total_tokens"))
|
|
112
157
|
```
|
|
113
158
|
|
|
114
159
|
### Tool Calling
|
|
@@ -135,7 +180,7 @@ tools = [
|
|
|
135
180
|
}
|
|
136
181
|
]
|
|
137
182
|
messages = [{"role": "user", "content": "What's the weather in Tokyo?"}]
|
|
138
|
-
response = client.
|
|
183
|
+
response = client.complete("gpt-4o-mini", messages, tools=tools)
|
|
139
184
|
print(response.tool_calls)
|
|
140
185
|
```
|
|
141
186
|
|
|
@@ -157,7 +202,7 @@ builder = (
|
|
|
157
202
|
.add_middleware(TimingMiddleware())
|
|
158
203
|
)
|
|
159
204
|
client = builder.build()
|
|
160
|
-
print(client.complete("gpt-4o-mini", "Give me one idea."))
|
|
205
|
+
print(client.complete("gpt-4o-mini", "Give me one idea.").content)
|
|
161
206
|
```
|
|
162
207
|
|
|
163
208
|
## Examples
|
|
@@ -168,8 +213,8 @@ OpenAI with a short prompt:
|
|
|
168
213
|
from simple_agents_py import Client
|
|
169
214
|
|
|
170
215
|
client = Client("openai")
|
|
171
|
-
|
|
172
|
-
print(
|
|
216
|
+
response = client.complete("gpt-4o-mini", "Summarize this in one sentence.")
|
|
217
|
+
print(response.content)
|
|
173
218
|
```
|
|
174
219
|
|
|
175
220
|
Anthropic with custom tokens and temperature:
|
|
@@ -178,13 +223,13 @@ Anthropic with custom tokens and temperature:
|
|
|
178
223
|
from simple_agents_py import Client
|
|
179
224
|
|
|
180
225
|
client = Client("anthropic")
|
|
181
|
-
|
|
226
|
+
response = client.complete(
|
|
182
227
|
"claude-3-5-sonnet-20240620",
|
|
183
228
|
"Write a friendly welcome message for a new user.",
|
|
184
229
|
max_tokens=120,
|
|
185
230
|
temperature=0.5,
|
|
186
231
|
)
|
|
187
|
-
print(
|
|
232
|
+
print(response.content)
|
|
188
233
|
```
|
|
189
234
|
|
|
190
235
|
OpenRouter with a specific model:
|
|
@@ -193,8 +238,8 @@ OpenRouter with a specific model:
|
|
|
193
238
|
from simple_agents_py import Client
|
|
194
239
|
|
|
195
240
|
client = Client("openrouter")
|
|
196
|
-
|
|
197
|
-
print(
|
|
241
|
+
response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
|
|
242
|
+
print(response.content)
|
|
198
243
|
```
|
|
199
244
|
|
|
200
245
|
OpenRouter with explicit API base and key:
|
|
@@ -207,8 +252,8 @@ client = Client(
|
|
|
207
252
|
api_base="https://openrouter.ai/api/v1",
|
|
208
253
|
api_key="sk-your-openrouter-key",
|
|
209
254
|
)
|
|
210
|
-
|
|
211
|
-
print(
|
|
255
|
+
response = client.complete("openai/gpt-4o-mini", "Give me three project ideas.")
|
|
256
|
+
print(response.content)
|
|
212
257
|
```
|
|
213
258
|
|
|
214
259
|
OpenAI with a custom gateway:
|
|
@@ -221,8 +266,8 @@ client = Client(
|
|
|
221
266
|
api_base="http://localhost:4000/v1",
|
|
222
267
|
api_key="sk-your-openai-key",
|
|
223
268
|
)
|
|
224
|
-
|
|
225
|
-
print(
|
|
269
|
+
response = client.complete("gpt-4o-mini", "Say hello from a local proxy.")
|
|
270
|
+
print(response.content)
|
|
226
271
|
```
|
|
227
272
|
|
|
228
273
|
Basic error handling:
|
|
@@ -232,7 +277,7 @@ from simple_agents_py import Client
|
|
|
232
277
|
|
|
233
278
|
try:
|
|
234
279
|
client = Client("openai")
|
|
235
|
-
print(client.complete("gpt-4o-mini", "Hello!"))
|
|
280
|
+
print(client.complete("gpt-4o-mini", "Hello!").content)
|
|
236
281
|
except RuntimeError as exc:
|
|
237
282
|
print(f"Request failed: {exc}")
|
|
238
283
|
```
|
|
@@ -11,7 +11,7 @@ documentation.workspace = true
|
|
|
11
11
|
description = "Caching utilities for SimpleAgents"
|
|
12
12
|
|
|
13
13
|
[dependencies]
|
|
14
|
-
simple-agent-type = {
|
|
14
|
+
simple-agent-type = { workspace = true }
|
|
15
15
|
tokio = { workspace = true, features = ["sync", "time"] }
|
|
16
16
|
async-trait.workspace = true
|
|
17
17
|
|
|
@@ -17,10 +17,10 @@ serde.workspace = true
|
|
|
17
17
|
serde_json.workspace = true
|
|
18
18
|
tokio.workspace = true
|
|
19
19
|
|
|
20
|
-
simple-agent-type = {
|
|
21
|
-
simple-agents-router = { path = "../simple-agents-router", version = "0.
|
|
22
|
-
simple-agents-cache = { path = "../simple-agents-cache", version = "0.
|
|
23
|
-
simple-agents-healing = { path = "../simple-agents-healing", version = "0.
|
|
20
|
+
simple-agent-type = { workspace = true }
|
|
21
|
+
simple-agents-router = { path = "../simple-agents-router", version = "0.2.0" }
|
|
22
|
+
simple-agents-cache = { path = "../simple-agents-cache", version = "0.2.0" }
|
|
23
|
+
simple-agents-healing = { path = "../simple-agents-healing", version = "0.2.0" }
|
|
24
24
|
futures-core = "0.3"
|
|
25
25
|
|
|
26
26
|
[dev-dependencies]
|