inferencefit 0.1.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.
Files changed (73) hide show
  1. inferencefit-0.1.0/.gitignore +222 -0
  2. inferencefit-0.1.0/CHANGELOG.md +25 -0
  3. inferencefit-0.1.0/LICENSE +190 -0
  4. inferencefit-0.1.0/PKG-INFO +199 -0
  5. inferencefit-0.1.0/README.md +163 -0
  6. inferencefit-0.1.0/docs/architecture.md +11 -0
  7. inferencefit-0.1.0/docs/contracts.md +15 -0
  8. inferencefit-0.1.0/docs/e0.5-real-world-validation.md +107 -0
  9. inferencefit-0.1.0/docs/releases/0.1.0.md +64 -0
  10. inferencefit-0.1.0/docs/releasing.md +124 -0
  11. inferencefit-0.1.0/examples/basic/dataset.jsonl +3 -0
  12. inferencefit-0.1.0/examples/basic/eval.yaml +50 -0
  13. inferencefit-0.1.0/examples/basic/fixtures/cheap.jsonl +3 -0
  14. inferencefit-0.1.0/examples/basic/fixtures/strong.jsonl +3 -0
  15. inferencefit-0.1.0/examples/lead_semantic_units/README.md +33 -0
  16. inferencefit-0.1.0/examples/lead_semantic_units/dataset.jsonl +24 -0
  17. inferencefit-0.1.0/examples/lead_semantic_units/dataset.multilingual.jsonl +8 -0
  18. inferencefit-0.1.0/examples/lead_semantic_units/dataset.smoke.jsonl +4 -0
  19. inferencefit-0.1.0/examples/lead_semantic_units/eval.deepseek.smoke.yaml +57 -0
  20. inferencefit-0.1.0/examples/lead_semantic_units/eval.deepseek.yaml +57 -0
  21. inferencefit-0.1.0/examples/lead_semantic_units/eval.fireworks.smoke.yaml +76 -0
  22. inferencefit-0.1.0/examples/lead_semantic_units/eval.fireworks.yaml +76 -0
  23. inferencefit-0.1.0/examples/lead_semantic_units/eval.fixture.yaml +64 -0
  24. inferencefit-0.1.0/examples/lead_semantic_units/eval.multilingual.fixture.yaml +64 -0
  25. inferencefit-0.1.0/examples/lead_semantic_units/fixtures/cheap.jsonl +32 -0
  26. inferencefit-0.1.0/examples/lead_semantic_units/fixtures/strong.jsonl +32 -0
  27. inferencefit-0.1.0/pyproject.toml +100 -0
  28. inferencefit-0.1.0/scripts/audit_distribution.py +319 -0
  29. inferencefit-0.1.0/scripts/installed_distribution_smoke.py +181 -0
  30. inferencefit-0.1.0/scripts/verify_artifact_install.py +66 -0
  31. inferencefit-0.1.0/src/inferencefit/__init__.py +6 -0
  32. inferencefit-0.1.0/src/inferencefit/api/__init__.py +112 -0
  33. inferencefit-0.1.0/src/inferencefit/cli/__init__.py +39 -0
  34. inferencefit-0.1.0/src/inferencefit/cli/__main__.py +3 -0
  35. inferencefit-0.1.0/src/inferencefit/contracts/__init__.py +35 -0
  36. inferencefit-0.1.0/src/inferencefit/contracts/candidates.py +52 -0
  37. inferencefit-0.1.0/src/inferencefit/contracts/common.py +19 -0
  38. inferencefit-0.1.0/src/inferencefit/contracts/dataset.py +84 -0
  39. inferencefit-0.1.0/src/inferencefit/contracts/evaluation.py +86 -0
  40. inferencefit-0.1.0/src/inferencefit/contracts/execution.py +60 -0
  41. inferencefit-0.1.0/src/inferencefit/contracts/observations.py +44 -0
  42. inferencefit-0.1.0/src/inferencefit/contracts/optimization.py +78 -0
  43. inferencefit-0.1.0/src/inferencefit/contracts/results.py +80 -0
  44. inferencefit-0.1.0/src/inferencefit/contracts/validation.py +41 -0
  45. inferencefit-0.1.0/src/inferencefit/contracts/validators.py +64 -0
  46. inferencefit-0.1.0/src/inferencefit/core.py +178 -0
  47. inferencefit-0.1.0/src/inferencefit/credentials/__init__.py +40 -0
  48. inferencefit-0.1.0/src/inferencefit/dataset.py +61 -0
  49. inferencefit-0.1.0/src/inferencefit/errors.py +39 -0
  50. inferencefit-0.1.0/src/inferencefit/execution/__init__.py +5 -0
  51. inferencefit-0.1.0/src/inferencefit/execution/runner.py +133 -0
  52. inferencefit-0.1.0/src/inferencefit/json_pointer.py +89 -0
  53. inferencefit-0.1.0/src/inferencefit/metrics/__init__.py +52 -0
  54. inferencefit-0.1.0/src/inferencefit/optimization/__init__.py +183 -0
  55. inferencefit-0.1.0/src/inferencefit/providers/__init__.py +13 -0
  56. inferencefit-0.1.0/src/inferencefit/providers/base.py +29 -0
  57. inferencefit-0.1.0/src/inferencefit/providers/fixture.py +51 -0
  58. inferencefit-0.1.0/src/inferencefit/providers/openai_compatible.py +66 -0
  59. inferencefit-0.1.0/src/inferencefit/reporting/__init__.py +3 -0
  60. inferencefit-0.1.0/src/inferencefit/reporting/markdown.py +47 -0
  61. inferencefit-0.1.0/src/inferencefit/spec.py +58 -0
  62. inferencefit-0.1.0/src/inferencefit/storage/__init__.py +5 -0
  63. inferencefit-0.1.0/src/inferencefit/storage/filesystem.py +62 -0
  64. inferencefit-0.1.0/src/inferencefit/validators/__init__.py +105 -0
  65. inferencefit-0.1.0/tests/test_ci_workflows.py +428 -0
  66. inferencefit-0.1.0/tests/test_completeness.py +219 -0
  67. inferencefit-0.1.0/tests/test_dataset.py +201 -0
  68. inferencefit-0.1.0/tests/test_distribution_audit.py +434 -0
  69. inferencefit-0.1.0/tests/test_engine.py +341 -0
  70. inferencefit-0.1.0/tests/test_evaluation_spec.py +274 -0
  71. inferencefit-0.1.0/tests/test_json_pointer.py +84 -0
  72. inferencefit-0.1.0/tests/test_release_metadata.py +84 -0
  73. inferencefit-0.1.0/tests/test_release_smoke.py +262 -0
@@ -0,0 +1,222 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .env*
26
+ !.env.example
27
+ /.vs
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py.cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ # Pipfile.lock
99
+
100
+ # UV
101
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ # uv.lock
105
+
106
+ # poetry
107
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
109
+ # commonly ignored for libraries.
110
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111
+ # poetry.lock
112
+ # poetry.toml
113
+
114
+ # pdm
115
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
116
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
117
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
118
+ # pdm.lock
119
+ # pdm.toml
120
+ .pdm-python
121
+ .pdm-build/
122
+
123
+ # pixi
124
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
125
+ # pixi.lock
126
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
127
+ # in the .venv directory. It is recommended not to include this directory in version control.
128
+ .pixi
129
+
130
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
131
+ __pypackages__/
132
+
133
+ # Celery stuff
134
+ celerybeat-schedule
135
+ celerybeat.pid
136
+
137
+ # Redis
138
+ *.rdb
139
+ *.aof
140
+ *.pid
141
+
142
+ # RabbitMQ
143
+ mnesia/
144
+ rabbitmq/
145
+ rabbitmq-data/
146
+
147
+ # ActiveMQ
148
+ activemq-data/
149
+
150
+ # SageMath parsed files
151
+ *.sage.py
152
+
153
+ # Environments
154
+ .env
155
+ .envrc
156
+ .venv
157
+ .inferencefit/
158
+ env/
159
+ venv/
160
+ ENV/
161
+ env.bak/
162
+ venv.bak/
163
+
164
+ # Spyder project settings
165
+ .spyderproject
166
+ .spyproject
167
+
168
+ # Rope project settings
169
+ .ropeproject
170
+
171
+ # mkdocs documentation
172
+ /site
173
+
174
+ # mypy
175
+ .mypy_cache/
176
+ .dmypy.json
177
+ dmypy.json
178
+
179
+ # Pyre type checker
180
+ .pyre/
181
+
182
+ # pytype static type analyzer
183
+ .pytype/
184
+
185
+ # Cython debug symbols
186
+ cython_debug/
187
+
188
+ # PyCharm
189
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
190
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
191
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
192
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
193
+ # .idea/
194
+
195
+ # Abstra
196
+ # Abstra is an AI-powered process automation framework.
197
+ # Ignore directories containing user credentials, local state, and settings.
198
+ # Learn more at https://abstra.io/docs
199
+ .abstra/
200
+
201
+ # Visual Studio Code
202
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
203
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
204
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
205
+ # you could uncomment the following to ignore the entire vscode folder
206
+ # .vscode/
207
+ # Temporary file for partial code execution
208
+ tempCodeRunnerFile.py
209
+
210
+ # Ruff stuff:
211
+ .ruff_cache/
212
+
213
+ # PyPI configuration file
214
+ .pypirc
215
+
216
+ # Marimo
217
+ marimo/_static/
218
+ marimo/_lsp/
219
+ __marimo__/
220
+
221
+ # Streamlit
222
+ .streamlit/secrets.toml
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ All notable changes to InferenceFit are documented in this file.
4
+
5
+ ## 0.1.0
6
+
7
+ Initial public release.
8
+
9
+ - Evaluate LLM configurations against workload-specific, file-based datasets and
10
+ `EvaluationSpec` files.
11
+ - Use the deterministic offline fixture provider or the non-streaming OpenAI-compatible
12
+ provider architecture. Fireworks and DeepSeek integrations have been validated against
13
+ their real APIs.
14
+ - Score responses with declarative exact, regular-expression, enum, JSON Schema, numeric,
15
+ contains, and local Python validators.
16
+ - Measure quality, cost, latency, and reliability, then apply hard constraints and expose the
17
+ Pareto frontier.
18
+ - Select eligible configurations with deterministic optimization objectives, including a
19
+ documented balanced heuristic.
20
+ - Produce a runtime-valid two-stage fallback cascade that reacts only to provider errors and
21
+ runtime-capable validation gates.
22
+ - Persist resumable filesystem runs with provenance, observations, result summaries, and an
23
+ open `routing-policy.yaml` artifact.
24
+ - Run the same benchmark core through the `inferencefit` CLI, the async Python API, or a local
25
+ FastAPI daemon.
@@ -0,0 +1,190 @@
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
+ Copyright 2026 Eugene Kamaev
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,199 @@
1
+ Metadata-Version: 2.5
2
+ Name: inferencefit
3
+ Version: 0.1.0
4
+ Summary: Local-first, workload-specific evaluation and deterministic optimization for LLM configurations.
5
+ Project-URL: Homepage, https://github.com/Jauhenka/InferenceFit
6
+ Project-URL: Repository, https://github.com/Jauhenka/InferenceFit
7
+ Project-URL: Issues, https://github.com/Jauhenka/InferenceFit/issues
8
+ Project-URL: Documentation, https://github.com/Jauhenka/InferenceFit/tree/main/docs
9
+ Author: InferenceFit contributors
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: benchmarking,evaluation,llm,optimization,routing
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: fastapi>=0.115
21
+ Requires-Dist: httpx>=0.27
22
+ Requires-Dist: jsonschema>=4.21
23
+ Requires-Dist: pydantic>=2.7
24
+ Requires-Dist: pyyaml>=6.0
25
+ Requires-Dist: typer>=0.12
26
+ Requires-Dist: uvicorn>=0.30
27
+ Provides-Extra: dev
28
+ Requires-Dist: build>=1.2; extra == 'dev'
29
+ Requires-Dist: httpx>=0.27; extra == 'dev'
30
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
31
+ Requires-Dist: pytest>=8.0; extra == 'dev'
32
+ Requires-Dist: respx>=0.21; extra == 'dev'
33
+ Requires-Dist: ruff>=0.5; extra == 'dev'
34
+ Requires-Dist: twine>=5.1; extra == 'dev'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # InferenceFit
38
+
39
+ InferenceFit is a local-first toolkit for evaluating and selecting LLM configurations for a
40
+ specific workload. Instead of asking which model is universally "best," it runs your versioned
41
+ test cases against candidate providers and models, measures quality, reliability, latency, token
42
+ use, and cost, applies your hard constraints, and produces a deterministic recommendation and an
43
+ open routing policy.
44
+
45
+ InferenceFit 0.1.0 is a pre-1.0 release. Public APIs and serialized schemas may change before 1.0.
46
+
47
+ ## Installation
48
+
49
+ InferenceFit requires Python 3.11 or newer.
50
+
51
+ ```bash
52
+ pip install inferencefit
53
+ ```
54
+
55
+ ## Offline quick start
56
+
57
+ The repository includes a deterministic fixture workload that needs no API key and makes no
58
+ network requests. From a source checkout, run:
59
+
60
+ ```bash
61
+ inferencefit validate examples/basic/eval.yaml
62
+ inferencefit benchmark examples/basic/eval.yaml
63
+ ```
64
+
65
+ The example compares two fixtures and evaluates a schema-gated fallback cascade. The benchmark
66
+ prints the run ID, recommendation, and artifact directory under `.inferencefit/runs/`.
67
+
68
+ The same benchmark entry point is available from Python:
69
+
70
+ ```python
71
+ import asyncio
72
+
73
+ from inferencefit import benchmark
74
+
75
+ result = asyncio.run(benchmark("examples/basic/eval.yaml"))
76
+ print(result.recommendation)
77
+ ```
78
+
79
+ ## Opt-in provider examples
80
+
81
+ Live examples are intentionally separate from the offline quick start. They make network requests
82
+ and can spend provider credits. Set the named environment variable in your shell, then explicitly
83
+ run the corresponding smoke spec:
84
+
85
+ ```bash
86
+ # Requires FIREWORKS_API_KEY
87
+ inferencefit benchmark examples/lead_semantic_units/eval.fireworks.smoke.yaml
88
+
89
+ # Requires DEEPSEEK_API_KEY
90
+ inferencefit benchmark examples/lead_semantic_units/eval.deepseek.smoke.yaml
91
+ ```
92
+
93
+ These specs use synthetic lead-extraction cases. See the
94
+ [example guide](examples/lead_semantic_units/README.md) and the
95
+ [E0.5 validation report](docs/e0.5-real-world-validation.md) for their contract, pricing snapshots,
96
+ and observed results.
97
+
98
+ ## How evaluation works
99
+
100
+ An `EvaluationSpec` YAML file connects a JSONL dataset to candidates, validators, hard constraints,
101
+ an optimization objective, and bounded execution settings. Candidate pricing is an explicit
102
+ snapshot in USD per million input and output tokens; InferenceFit does not fetch prices.
103
+
104
+ Built-in validators cover exact values, regular expressions, enums, JSON Schema, numeric values,
105
+ containment, and local Python callables. Exact, numeric, and Python validators can use hidden
106
+ evaluation answers and are evaluation-only. Runtime routing gates must use runtime-capable checks,
107
+ such as JSON Schema. Local Python validators execute with the current process permissions and are
108
+ not sandboxed, so do not run untrusted validator code.
109
+
110
+ Each candidate is summarized with end-to-end success, provider reliability, p50/p95 latency,
111
+ input/output tokens, and configured cost. Hard constraints can exclude configurations by success,
112
+ error rate, latency, or cost. Remaining candidates appear on a Pareto frontier and are ranked by
113
+ `min_cost`, `min_latency`, `max_quality`, `max_reliability`, or the versioned `balanced` objective.
114
+
115
+ E0 also simulates one two-stage cascade. Fallback occurs only after a provider error or failure of a
116
+ runtime-capable routing gate; hidden expected answers are never production routing signals. If no
117
+ configuration satisfies the constraints, the result is explicitly non-routable.
118
+
119
+ ## Results, artifacts, and resume
120
+
121
+ The Python API returns a `ResultBundle`. Every completed CLI or Python run also writes a versioned
122
+ run-artifact directory at `.inferencefit/runs/<run-id>/` with:
123
+
124
+ - `manifest.json` — provenance, settings, and lifecycle state;
125
+ - `spec.yaml` and `dataset.jsonl` — exact input snapshots;
126
+ - `observations.jsonl` — one flushed terminal record per planned evaluation;
127
+ - `result.json` — metrics, constraints, Pareto frontier, ranking, and recommendation;
128
+ - `summary.md` — a human-readable result summary;
129
+ - `routing-policy.yaml` — a single, fallback, or explicitly non-routable policy.
130
+
131
+ Interrupted compatible runs can reuse completed observations:
132
+
133
+ ```bash
134
+ inferencefit benchmark examples/basic/eval.yaml --resume <run-id>
135
+ ```
136
+
137
+ Resume checks the spec and dataset hashes before skipping completed
138
+ `(case, candidate, repetition)` identities.
139
+
140
+ ## Providers and credentials
141
+
142
+ The `fixture` provider is deterministic and offline. The generic, non-streaming OpenAI-compatible
143
+ adapter accepts an explicit base URL and includes endpoint presets for Fireworks, DeepSeek,
144
+ OpenRouter, Ollama, and vLLM. It uses the providers' chat-completions-shaped HTTP interface without
145
+ vendor SDKs.
146
+
147
+ Credentials are resolved from opaque references. For example, `credential_ref: fireworks-main`
148
+ checks `INFERENCEFIT_CREDENTIAL_FIREWORKS_MAIN` and then `FIREWORKS_API_KEY`; DeepSeek similarly
149
+ falls back to `DEEPSEEK_API_KEY`, and OpenRouter to `OPENROUTER_API_KEY`. Secret values are not
150
+ written to run artifacts.
151
+
152
+ ## Local daemon
153
+
154
+ ```bash
155
+ inferencefit serve
156
+ ```
157
+
158
+ The daemon defaults to `127.0.0.1:8787` and exposes health, run creation, status, result, and
159
+ cancellation endpoints. It has no authentication and is intended only for trusted localhost use;
160
+ do not expose it to a network.
161
+
162
+ ## Current limitations
163
+
164
+ Version 0.1.0 uses a local process job manager and filesystem artifact store. It supports
165
+ non-streaming chat completions, a single two-stage fallback, and Python only. Pricing is static
166
+ configuration rather than provider billing data. Exact validators intentionally do not provide
167
+ semantic-equivalence scoring. There is no hosted Cloud/SaaS service, account system, traffic proxy,
168
+ browser UI, distributed worker system, learned routing, or model training.
169
+
170
+ ## Roadmap (not available in 0.1.0)
171
+
172
+ Potential post-0.1 work includes richer request modalities, more provider-specific metadata,
173
+ scalable artifact-store adapters, and additional language SDKs. These are directions, not current
174
+ features or commitments.
175
+
176
+ ## Development and documentation
177
+
178
+ For an editable development install:
179
+
180
+ ```bash
181
+ python -m venv .venv
182
+ pip install -e ".[dev]"
183
+ pytest
184
+ ruff check .
185
+ ruff format --check .
186
+ ```
187
+
188
+ Normal tests use fixtures and do not spend provider credits. Live provider testing is opt-in; run
189
+ it only explicitly, with the required credential configured and awareness of provider charges.
190
+
191
+ Detailed references:
192
+
193
+ - [Architecture](docs/architecture.md)
194
+ - [Serialized contracts](docs/contracts.md)
195
+ - [E0.5 real-world validation](docs/e0.5-real-world-validation.md)
196
+
197
+ ## License
198
+
199
+ InferenceFit is licensed under the [Apache License 2.0](LICENSE) (`Apache-2.0`).