pyinferencemanager 1.2.0__tar.gz → 1.3.1__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.
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/Cargo.lock +2 -2
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/Cargo.toml +2 -2
- pyinferencemanager-1.3.1/LICENSE +202 -0
- pyinferencemanager-1.3.1/PKG-INFO +290 -0
- pyinferencemanager-1.3.1/README.md +254 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/backends/mod.rs +3 -1
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/backends/stub_backend.rs +9 -19
- pyinferencemanager-1.3.1/crates/pyinferencemanager-core/src/backends/vllm_backend.rs +158 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/engines/cloud_client.rs +2 -1
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/engines/mod.rs +2 -0
- pyinferencemanager-1.3.1/crates/pyinferencemanager-core/src/engines/provider_health.rs +501 -0
- pyinferencemanager-1.3.1/crates/pyinferencemanager-core/src/engines/vllm_client.rs +363 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/error.rs +3 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/observability/tracer.rs +7 -1
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/optimizer/budget_enforcer.rs +5 -1
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/optimizer/dynamic_router.rs +4 -1
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/optimizer/retry_strategy.rs +26 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/orchestrator/api_executor.rs +3 -1
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/orchestrator/mod.rs +222 -11
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/orchestrator/real_load_tester.rs +7 -2
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/types/config.rs +5 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/types/plan.rs +2 -1
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-py/src/lib.rs +57 -29
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/pyproject.toml +1 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/src/pyinferencemanager/_mcp_connector.py +32 -1
- pyinferencemanager-1.2.0/LICENSE +0 -22
- pyinferencemanager-1.2.0/PKG-INFO +0 -161
- pyinferencemanager-1.2.0/README.md +0 -126
- pyinferencemanager-1.2.0/crates/pyinferencemanager-core/src/engines/provider_health.rs +0 -303
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/Cargo.toml +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/analyzer/classifier.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/analyzer/complexity.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/analyzer/embedding_complexity.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/analyzer/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/backends/anthropic_backend.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/backends/colibri_backend.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/backends/gemini_backend.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/backends/ollama_backend.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/backends/openai_backend.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/cache/embedding_key.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/cache/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/cache/semantic_cache.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/cache/sqlite_store.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/engines/gemini_client.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/engines/ollama_client.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/engines/openai_client.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/error_classifier.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/hardware/memory_map.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/hardware/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/hardware/ollama_probe.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/hardware/profiler.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/lib.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/memory/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/memory/resource_monitor.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/observability/exporters/jaeger_exporter.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/observability/exporters/logging_exporter.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/observability/exporters/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/observability/exporters/prometheus_exporter.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/observability/logging.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/observability/metrics.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/observability/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/optimizer/cost_estimator.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/optimizer/cost_tracker.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/optimizer/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/orchestrator/executor.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/orchestrator/load_tester.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/orchestrator/provider_executor.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/orchestrator/provider_load_test.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/orchestrator/scenarios.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/planner/dag_builder.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/planner/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/planner/parallel.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/planner/templates.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/router/execution_router.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/router/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/router/multi_provider.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/types/cache.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/types/dag.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/types/hardware.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/types/mod.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-core/src/types/task.rs +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/crates/pyinferencemanager-py/Cargo.toml +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/src/pyinferencemanager/__init__.py +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/src/pyinferencemanager/_mcp_tools.py +0 -0
- {pyinferencemanager-1.2.0 → pyinferencemanager-1.3.1}/src/pyinferencemanager/py.typed +0 -0
|
@@ -1339,7 +1339,7 @@ checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94"
|
|
|
1339
1339
|
|
|
1340
1340
|
[[package]]
|
|
1341
1341
|
name = "pyinferencemanager"
|
|
1342
|
-
version = "1.
|
|
1342
|
+
version = "1.3.1"
|
|
1343
1343
|
dependencies = [
|
|
1344
1344
|
"chrono",
|
|
1345
1345
|
"pyinferencemanager-core",
|
|
@@ -1350,7 +1350,7 @@ dependencies = [
|
|
|
1350
1350
|
|
|
1351
1351
|
[[package]]
|
|
1352
1352
|
name = "pyinferencemanager-core"
|
|
1353
|
-
version = "1.
|
|
1353
|
+
version = "1.3.1"
|
|
1354
1354
|
dependencies = [
|
|
1355
1355
|
"anyhow",
|
|
1356
1356
|
"async-trait",
|
|
@@ -3,11 +3,11 @@ members = ["crates/pyinferencemanager-core", "crates/pyinferencemanager-py"]
|
|
|
3
3
|
resolver = "2"
|
|
4
4
|
|
|
5
5
|
[workspace.package]
|
|
6
|
-
version = "1.
|
|
6
|
+
version = "1.3.1"
|
|
7
7
|
edition = "2021"
|
|
8
8
|
rust-version = "1.82"
|
|
9
9
|
authors = ["Georgi Mammen Mullassery <mullassery@gmail.com>"]
|
|
10
|
-
license = "
|
|
10
|
+
license = "Apache-2.0"
|
|
11
11
|
repository = "https://github.com/Mullassery/pyinferencemanager"
|
|
12
12
|
|
|
13
13
|
[workspace.dependencies]
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Georgi Mullassery
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyinferencemanager
|
|
3
|
+
Version: 1.3.1
|
|
4
|
+
Classifier: Development Status :: 4 - Beta
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: Intended Audience :: Science/Research
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Rust
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: pytest>=7.0 ; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest-asyncio>=0.21 ; extra == 'dev'
|
|
20
|
+
Requires-Dist: maturin>=1.0 ; extra == 'dev'
|
|
21
|
+
Requires-Dist: ruff>=0.5.0 ; extra == 'dev'
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Summary: Intelligent AI workload orchestrator. Multi-provider routing, cost optimization, semantic caching, dynamic routing with budget enforcement. Production observability included.
|
|
25
|
+
Keywords: ai,orchestrator,llm,ollama,anthropic,openai,local-first,cost-optimization,caching,multi-provider,routing,inference,workload-orchestration,hardware-aware,semantic-caching,distributed-tracing,observability,budget-enforcement
|
|
26
|
+
Author-email: Georgi Mammen Mullassery <mullassery@gmail.com>
|
|
27
|
+
License-Expression: Apache-2.0
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
30
|
+
Project-URL: Changelog, https://github.com/Mullassery/pyinferencemanager/releases
|
|
31
|
+
Project-URL: Documentation, https://github.com/Mullassery/pyinferencemanager/blob/main/README.md
|
|
32
|
+
Project-URL: Homepage, https://github.com/Mullassery/pyinferencemanager
|
|
33
|
+
Project-URL: Issues, https://github.com/Mullassery/pyinferencemanager/issues
|
|
34
|
+
Project-URL: Repository, https://github.com/Mullassery/pyinferencemanager.git
|
|
35
|
+
|
|
36
|
+
# PyInferenceManager
|
|
37
|
+
|
|
38
|
+
**A multi-provider LLM inference orchestrator with cost/latency-aware routing, real retry + budget guardrails, and local-first execution.**
|
|
39
|
+
|
|
40
|
+
[](LICENSE)
|
|
41
|
+
[](https://pypi.org/project/pyinferencemanager/)
|
|
42
|
+
[](https://www.python.org)
|
|
43
|
+
[](https://github.com/Mullassery/PyInferenceManager/actions)
|
|
44
|
+
[](https://github.com/Graphify-Labs/graphify)
|
|
45
|
+
|
|
46
|
+
## What it is
|
|
47
|
+
|
|
48
|
+
The core (Rust, ~11k lines, PyO3 bindings) is a workload orchestrator: it builds a small
|
|
49
|
+
execution DAG for a task, profiles your local hardware, picks an engine (local Ollama model
|
|
50
|
+
vs. a cloud provider) based on complexity/privacy/cost, executes with real retry and budget
|
|
51
|
+
enforcement, and semantically caches results. Routes requests to Anthropic Claude, OpenAI
|
|
52
|
+
GPT, Google Gemini, or a local Ollama model based on task complexity, privacy, and observed
|
|
53
|
+
provider health — with real retry/backoff on failures and a real spend cap you configure.
|
|
54
|
+
|
|
55
|
+
The Python API surface is a single `Orchestrator` class. There is no `Manager.chat()`, no
|
|
56
|
+
streaming API, and no 11-provider marketplace — see [Providers](#providers) for the honest
|
|
57
|
+
list.
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- **Complexity/privacy/cost-aware routing** between local Ollama models and cloud providers.
|
|
62
|
+
- **Hard budget enforcement** checked on every real cloud call, with request-count caps and
|
|
63
|
+
alert thresholds.
|
|
64
|
+
- **Provider-health-aware retry** with configurable exponential backoff for retryable errors
|
|
65
|
+
(HTTP 429/408/5xx).
|
|
66
|
+
- **Semantic caching** and hardware profiling (memory tier, Apple Silicon/Metal, local
|
|
67
|
+
models).
|
|
68
|
+
- **Graceful degradation:** `run()` never raises on a bad backend; it returns a result whose
|
|
69
|
+
`output` says so.
|
|
70
|
+
- **MCP tools** exposing the same engine, and a hardware/synthetic load-test path.
|
|
71
|
+
|
|
72
|
+
## Who it's for
|
|
73
|
+
|
|
74
|
+
- **Teams routing tasks between a local Ollama model and cloud providers** based on
|
|
75
|
+
complexity/privacy/cost — `mode="local_first"` with `privacy="high"` forces local
|
|
76
|
+
execution regardless of mode, for anything that shouldn't leave the machine.
|
|
77
|
+
- **Anyone enforcing a real spend cap across multiple LLM providers** —
|
|
78
|
+
`configure_budget(max_cost_usd=..., enforce_hard_limit=True)` is checked on every real
|
|
79
|
+
cloud call, not just logged after the fact.
|
|
80
|
+
- **Pipelines that need to degrade gracefully when a provider is down**, rather than crash.
|
|
81
|
+
|
|
82
|
+
## What it is not
|
|
83
|
+
|
|
84
|
+
- **Not a broad provider marketplace.** There are 5 live backends (Anthropic, OpenAI,
|
|
85
|
+
Gemini, Ollama, vLLM); `tensorrt_llm`, `mlc_llm`, and `colibri` are cost-estimator-only
|
|
86
|
+
stubs with real estimation logic but no live inference.
|
|
87
|
+
- **Not async.** The Python API is sync-only; there is no `run()` async variant.
|
|
88
|
+
- **Not a proxy server or spend dashboard.** It's a library, narrower in scope than LiteLLM.
|
|
89
|
+
- **Not a substitute for the providers' own SDKs.** The Rust core makes HTTP calls directly;
|
|
90
|
+
no Python SDK dependencies are required.
|
|
91
|
+
|
|
92
|
+
## Project status
|
|
93
|
+
|
|
94
|
+
**Beta.** Version 1.3.0. Core routing, budget enforcement, retry, caching, and the 5 live
|
|
95
|
+
backends are real and tested; the three stub backends and the pre-existing lint/format debt
|
|
96
|
+
below are honest gaps. See [`ROADMAP_HONEST.md`](ROADMAP_HONEST.md) for the full, unhedged
|
|
97
|
+
status. Changes are tracked in [CHANGELOG.md](CHANGELOG.md).
|
|
98
|
+
|
|
99
|
+
## Installation
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pip install pyinferencemanager
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Requires Python 3.10+. PyPI currently carries a macOS ARM64 `abi3` wheel plus an sdist;
|
|
106
|
+
other platforms build the sdist from source (a Rust toolchain is required).
|
|
107
|
+
|
|
108
|
+
Set whichever provider keys you plan to use (none are required for local-only Ollama use):
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
112
|
+
export OPENAI_API_KEY=sk-...
|
|
113
|
+
export GEMINI_API_KEY=... # or GOOGLE_API_KEY
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
See [`.env.example`](.env.example).
|
|
117
|
+
|
|
118
|
+
## Quick start
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from pyinferencemanager import Orchestrator
|
|
122
|
+
|
|
123
|
+
orchestrator = Orchestrator(mode="local_first") # or "cloud_first"
|
|
124
|
+
|
|
125
|
+
result = orchestrator.run(task="question_answering", message="What is the capital of France?")
|
|
126
|
+
print(result.output)
|
|
127
|
+
print(f"Engines used: {result.engines_used}")
|
|
128
|
+
print(f"Cost: ${result.total_cost_usd:.4f} | Latency: {result.total_latency_ms}ms | Tokens: {result.total_tokens}")
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`mode="local_first"` runs on your local Ollama model when it's adequate for the task's
|
|
132
|
+
complexity and escalates to a cloud provider otherwise. `mode="cloud_first"` prefers a
|
|
133
|
+
cloud provider, falling back to local only for very low-complexity tasks. `privacy="high"`
|
|
134
|
+
on any call always forces local execution regardless of mode.
|
|
135
|
+
|
|
136
|
+
If the selected backend is unreachable or unauthenticated, `run()` doesn't raise — it
|
|
137
|
+
returns a result whose `output` says so (e.g. `"[cloud inference unavailable: ...]"`), so a
|
|
138
|
+
single bad provider doesn't crash your pipeline.
|
|
139
|
+
|
|
140
|
+
## Usage
|
|
141
|
+
|
|
142
|
+
### Core API
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
orchestrator = Orchestrator(mode="local_first")
|
|
146
|
+
|
|
147
|
+
# Execute a task — real inference against Ollama or a cloud provider.
|
|
148
|
+
result = orchestrator.run(task="...", file=None, message=None, privacy="low")
|
|
149
|
+
# result.output, .total_tokens, .total_cost_usd, .total_latency_ms, .engines_used, .cache_hits
|
|
150
|
+
|
|
151
|
+
# Estimate cost/latency without executing anything.
|
|
152
|
+
plan = orchestrator.plan("Summarize this document")
|
|
153
|
+
# plan.stages, .estimated_cost_usd, .estimated_latency_ms, .local_first
|
|
154
|
+
|
|
155
|
+
# Real-time provider health, from actually completed cloud calls.
|
|
156
|
+
orchestrator.provider_ranking() # [(provider_key, health_score), ...]
|
|
157
|
+
orchestrator.provider_performance() # {provider_key: {success_rate, avg_latency_ms, ...}}
|
|
158
|
+
|
|
159
|
+
# Cost guardrails, enforced on every real cloud call.
|
|
160
|
+
orchestrator.configure_budget(max_cost_usd=10.0, max_requests=1000,
|
|
161
|
+
alert_threshold_percent=80.0, enforce_hard_limit=True)
|
|
162
|
+
orchestrator.budget_status()
|
|
163
|
+
|
|
164
|
+
# Retry/backoff policy for retryable errors (HTTP 429/408/5xx).
|
|
165
|
+
orchestrator.configure_retry(max_attempts=3, backoff="exponential",
|
|
166
|
+
initial_ms=100, max_ms=5000)
|
|
167
|
+
|
|
168
|
+
# Synthetic load test exercising the same budget + dynamic-routing logic
|
|
169
|
+
# run() uses, at a volume impractical against live APIs. Latencies/costs
|
|
170
|
+
# here are simulated, not real network calls.
|
|
171
|
+
orchestrator.run_load_test(num_requests=200, budget_usd=5.0)
|
|
172
|
+
|
|
173
|
+
# Local hardware profile (memory tier, Apple Silicon/Metal, Ollama models).
|
|
174
|
+
orchestrator.profile_hardware()
|
|
175
|
+
orchestrator.available_backends()
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
See [`examples/`](examples/) for runnable scripts covering each of these.
|
|
179
|
+
|
|
180
|
+
### Providers
|
|
181
|
+
|
|
182
|
+
Real HTTP calls, with retry/backoff and cost tracking:
|
|
183
|
+
|
|
184
|
+
| Provider | Env var | Notes |
|
|
185
|
+
|---|---|---|
|
|
186
|
+
| Anthropic Claude | `ANTHROPIC_API_KEY` | `claude-haiku-4-5`, `claude-opus-4-1` |
|
|
187
|
+
| OpenAI | `OPENAI_API_KEY` | `gpt-4o-mini` |
|
|
188
|
+
| Google Gemini | `GEMINI_API_KEY` / `GOOGLE_API_KEY` | `gemini-1.5-flash` |
|
|
189
|
+
| Ollama (local) | — | whatever models you've pulled locally |
|
|
190
|
+
| vLLM (local) | — | OpenAI-compatible endpoint, default `localhost:8000` |
|
|
191
|
+
|
|
192
|
+
Additionally, `tensorrt_llm`, `mlc_llm`, and `colibri` exist as **cost-estimator-only
|
|
193
|
+
stubs** (real cost/latency estimation logic, but no live inference).
|
|
194
|
+
`orchestrator.available_backends()` lists all of these honestly, including the stubs.
|
|
195
|
+
|
|
196
|
+
Cloud execution dispatches through `BackendRegistry`/`RuntimeBackend`: `ProviderExecutor::execute`
|
|
197
|
+
maps a `CloudProvider` to its `BackendKind`, registers the one backend it needs (reading the
|
|
198
|
+
API key from the env vars above), and calls it through the same `RuntimeBackend::infer`
|
|
199
|
+
trait object every backend implements — so adding a new cloud provider is a new
|
|
200
|
+
`BackendKind`/backend plus one dispatch arm.
|
|
201
|
+
|
|
202
|
+
### MCP tools
|
|
203
|
+
|
|
204
|
+
`pyinferencemanager._mcp_tools.PyInferenceManagerMCPHandler` exposes 13 MCP-style tools
|
|
205
|
+
(`list_available_models`, `execute_inference`, `estimate_inference_cost`,
|
|
206
|
+
`get_provider_status`, etc.), all backed by a real `Orchestrator` instance — no hardcoded
|
|
207
|
+
responses. See [`examples/mcp_pyinferencemanager.py`](examples/mcp_pyinferencemanager.py).
|
|
208
|
+
|
|
209
|
+
The network connector (`_mcp_connector.InferenceManager.start_mcp_connector()`) binds to
|
|
210
|
+
`127.0.0.1` by default with scoped CORS and permissions; binding elsewhere requires passing
|
|
211
|
+
`allow_remote=True` explicitly.
|
|
212
|
+
|
|
213
|
+
### vs LiteLLM
|
|
214
|
+
|
|
215
|
+
[LiteLLM](https://github.com/BerriAI/litellm) is the closest OSS equivalent — a unified
|
|
216
|
+
interface over many LLM providers. It's a much broader, more mature project (100+ providers,
|
|
217
|
+
a proxy server, spend-tracking dashboard); PyInferenceManager is narrower but adds real
|
|
218
|
+
complexity-based local/cloud routing, hard budget enforcement, and provider-health-aware
|
|
219
|
+
retry on top of the call itself.
|
|
220
|
+
|
|
221
|
+
Measured 2026-09-22, both pointed at the same real, local Ollama model
|
|
222
|
+
(`qwen2.5:7b-instruct`) — genuine local inference latency, not a stand-in for cloud-provider
|
|
223
|
+
numbers:
|
|
224
|
+
|
|
225
|
+
| | PyInferenceManager (`Orchestrator.run`) | LiteLLM (`litellm.completion`) |
|
|
226
|
+
|---|---|---|
|
|
227
|
+
| 10 varied real prompts, sequential | 41.7s total · 2054ms median/call | 36.7s total · 2533ms median/call |
|
|
228
|
+
| Same 10 prompts, concurrent (`asyncio.gather`) | not exposed — Python API is sync-only | 38.1s total (no real speedup — this local Ollama install serializes inference requests) |
|
|
229
|
+
| Output quality | Correct, coherent answers on all 10 prompts | Same |
|
|
230
|
+
|
|
231
|
+
Neither tool is meaningfully "faster" here — both are bottlenecked by the same local model
|
|
232
|
+
doing the same real token generation; the gap either direction is orchestration overhead
|
|
233
|
+
around the same Ollama call. The real difference is scope: LiteLLM gives you the broadest
|
|
234
|
+
provider coverage and an async-first client; PyInferenceManager gives you routing decisions,
|
|
235
|
+
spend caps, and retry/health tracking as first-class, tested behavior.
|
|
236
|
+
|
|
237
|
+
### Testing
|
|
238
|
+
|
|
239
|
+
- Rust core: `cargo test --workspace` (350+ tests, including HTTP-mocked request/response
|
|
240
|
+
tests for every cloud client via [`wiremock`](https://docs.rs/wiremock)).
|
|
241
|
+
- Python: `pytest tests/` — covers `Orchestrator.run/plan/provider_ranking`, the MCP tool
|
|
242
|
+
handlers, budget/retry configuration, load testing, and MCP connector security defaults,
|
|
243
|
+
all without requiring live API keys.
|
|
244
|
+
|
|
245
|
+
## Documentation
|
|
246
|
+
|
|
247
|
+
- [ROADMAP_HONEST.md](ROADMAP_HONEST.md) — the full, unhedged status: what's built, what's
|
|
248
|
+
broken, what's untested, and concrete technical debt.
|
|
249
|
+
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) — module map and request-flow diagram.
|
|
250
|
+
- [CONTRIBUTING.md](CONTRIBUTING.md) — dev setup, PR expectations.
|
|
251
|
+
- [SECURITY.md](SECURITY.md) — how to report a vulnerability.
|
|
252
|
+
- [CHANGELOG.md](CHANGELOG.md) — release history.
|
|
253
|
+
|
|
254
|
+
## Known issues
|
|
255
|
+
|
|
256
|
+
- `tensorrt_llm`, `mlc_llm`, and `colibri` backends are cost-estimator-only stubs (see
|
|
257
|
+
[Providers](#providers)) — they do not make live inference calls yet. `vllm` was a stub in
|
|
258
|
+
1.2.0 but is now a real backend.
|
|
259
|
+
- The circuit-breaker retry test intermittently observed 4 real HTTP calls in CI instead of
|
|
260
|
+
the 3 traced out on paper; after a 2026-09-13 investigation reproduced 0/8 failures
|
|
261
|
+
locally with no root cause found, the assertion now tolerates 3 or 4 calls while still
|
|
262
|
+
asserting the property that matters (the breaker intervenes well before the configured
|
|
263
|
+
`max_attempts=5`).
|
|
264
|
+
- `cargo clippy --workspace --all-targets` does not currently compile (3 pre-existing hard
|
|
265
|
+
errors in test code, masked by `continue-on-error: true` in CI) and `cargo fmt --check`
|
|
266
|
+
fails on 9 pre-existing files. See [ROADMAP_HONEST.md](ROADMAP_HONEST.md) for exact
|
|
267
|
+
file:line locations and the full technical-debt list.
|
|
268
|
+
|
|
269
|
+
## Contributing
|
|
270
|
+
|
|
271
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for dev setup and PR expectations, and
|
|
272
|
+
[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for community standards. Rust tests run with
|
|
273
|
+
`cargo test --workspace`; Python tests with `pytest tests/`.
|
|
274
|
+
|
|
275
|
+
## Related projects
|
|
276
|
+
|
|
277
|
+
Other tools from the same family, for adjacent parts of the LLM/AI stack:
|
|
278
|
+
|
|
279
|
+
- [PyTokenCalc](https://github.com/Mullassery/PyTokenCalc) — count tokens and estimate LLM costs across 20+ providers before you send a request.
|
|
280
|
+
- [OpenAnchor](https://github.com/Mullassery/OpenAnchor) — token intelligence middleware for multi-provider LLM usage: 6D attribution, pattern detection, recommendations, OTEL export.
|
|
281
|
+
- [PyVectorHound](https://github.com/Mullassery/PyVectorHound) — diagnostic engine for RAG retrieval failures: component-level analysis, root cause detection, and optimization recommendations.
|
|
282
|
+
- [PyStreamMCP](https://github.com/Mullassery/PyStreamMCP) — intelligence layer for AI agents: query planning, context discovery, and cost optimization.
|
|
283
|
+
- [PyStreamAI](https://github.com/Mullassery/PyStreamAI) — ML deployment toolkit: canary/A-B routing, cost tracking, request scheduling, hot model reload, and ONNX Runtime inference.
|
|
284
|
+
|
|
285
|
+
[Browse all projects →](https://github.com/Mullassery?tab=repositories)
|
|
286
|
+
|
|
287
|
+
## License
|
|
288
|
+
|
|
289
|
+
Apache License 2.0. See [LICENSE](LICENSE).
|
|
290
|
+
|