simllms 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 (53) hide show
  1. simllms-0.1.0/CHANGELOG.md +155 -0
  2. simllms-0.1.0/LICENSE-APACHE +202 -0
  3. simllms-0.1.0/LICENSE-MIT +25 -0
  4. simllms-0.1.0/PKG-INFO +95 -0
  5. simllms-0.1.0/README.en.md +75 -0
  6. simllms-0.1.0/THIRD-PARTY-NOTICES.md +19 -0
  7. simllms-0.1.0/pyproject.toml +65 -0
  8. simllms-0.1.0/python/simllms/__init__.py +162 -0
  9. simllms-0.1.0/python/simllms/_core.pyi +107 -0
  10. simllms-0.1.0/python/simllms/py.typed +0 -0
  11. simllms-0.1.0/simllms/CHANGELOG.md +155 -0
  12. simllms-0.1.0/simllms/Cargo.toml +47 -0
  13. simllms-0.1.0/simllms/LICENSE-APACHE +202 -0
  14. simllms-0.1.0/simllms/LICENSE-MIT +25 -0
  15. simllms-0.1.0/simllms/README.en.md +75 -0
  16. simllms-0.1.0/simllms/THIRD-PARTY-NOTICES.md +19 -0
  17. simllms-0.1.0/simllms/examples/chat_stream.rs +75 -0
  18. simllms-0.1.0/simllms/examples/custom_gateway.rs +40 -0
  19. simllms-0.1.0/simllms/examples/deepseek_chat.rs +48 -0
  20. simllms-0.1.0/simllms/examples/generate_image.rs +62 -0
  21. simllms-0.1.0/simllms/examples/structured_output.rs +78 -0
  22. simllms-0.1.0/simllms/src/capabilities.rs +167 -0
  23. simllms-0.1.0/simllms/src/catalog.rs +208 -0
  24. simllms-0.1.0/simllms/src/catalog_data.rs +4672 -0
  25. simllms-0.1.0/simllms/src/client.rs +2213 -0
  26. simllms-0.1.0/simllms/src/dialect.rs +150 -0
  27. simllms-0.1.0/simllms/src/error.rs +138 -0
  28. simllms-0.1.0/simllms/src/gate.rs +330 -0
  29. simllms-0.1.0/simllms/src/image.rs +332 -0
  30. simllms-0.1.0/simllms/src/lib.rs +39 -0
  31. simllms-0.1.0/simllms/src/message.rs +57 -0
  32. simllms-0.1.0/simllms/src/options.rs +82 -0
  33. simllms-0.1.0/simllms/src/provider.rs +104 -0
  34. simllms-0.1.0/simllms/src/refresh.rs +232 -0
  35. simllms-0.1.0/simllms/src/reply.rs +14 -0
  36. simllms-0.1.0/simllms/src/stream.rs +363 -0
  37. simllms-0.1.0/simllms-python/.gitignore +2 -0
  38. simllms-0.1.0/simllms-python/CHANGELOG.md +155 -0
  39. simllms-0.1.0/simllms-python/Cargo.lock +1687 -0
  40. simllms-0.1.0/simllms-python/Cargo.toml +22 -0
  41. simllms-0.1.0/simllms-python/LICENSE-APACHE +202 -0
  42. simllms-0.1.0/simllms-python/LICENSE-MIT +25 -0
  43. simllms-0.1.0/simllms-python/README.en.md +75 -0
  44. simllms-0.1.0/simllms-python/THIRD-PARTY-NOTICES.md +19 -0
  45. simllms-0.1.0/simllms-python/examples/_mock.py +123 -0
  46. simllms-0.1.0/simllms-python/examples/chat.py +34 -0
  47. simllms-0.1.0/simllms-python/examples/chat_stream.py +41 -0
  48. simllms-0.1.0/simllms-python/examples/generate_image.py +42 -0
  49. simllms-0.1.0/simllms-python/examples/structured_output.py +56 -0
  50. simllms-0.1.0/simllms-python/src/lib.rs +593 -0
  51. simllms-0.1.0/simllms-python/tests/test_client.py +587 -0
  52. simllms-0.1.0/simllms-python/tests/test_package_inventory.py +281 -0
  53. simllms-0.1.0/simllms-python/tests/test_release_artifacts.py +167 -0
@@ -0,0 +1,155 @@
1
+ # Changelog
2
+
3
+ All notable changes to simllms are documented here. The docs site's
4
+ changelog page is a generated copy of this file — edit this one only.
5
+
6
+ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - **Both packages now describe themselves truthfully on their registry.**
13
+ `crates/simllms/Cargo.toml` and `crates/simllms-python/pyproject.toml` each
14
+ declare an explicit `include` whitelist, so a packed artifact holds what it
15
+ should and nothing else: for the crate, the source tree plus the English
16
+ README, both license files, the third-party attribution and this changelog;
17
+ for the Python distribution, those five beside the module the build backend
18
+ packs by itself.
19
+ - `cargo xtask sync-package` writes the per-package copies of those five files
20
+ (cargo and maturin both refuse to reference anything above the package
21
+ directory), and `cargo xtask check-package` proves they match the root
22
+ originals, that the manifests carry the SPDX license expression, the
23
+ provider keywords and a provider-agnostic one-sentence description, and —
24
+ given `cargo package --list` on stdin — that the packed crate holds exactly
25
+ the whitelist.
26
+ - `crates/simllms-python/tests/test_package_inventory.py` opens the built
27
+ `.crate`, wheel and sdist and asserts the same inventory from the artifact
28
+ side: the license files land in the wheel's `*.dist-info/licenses/`, the
29
+ sdist carries what PEP 639 demands, and no `__pycache__` leaks in. CI packs
30
+ all three artifacts and names them to those checks, so a run that skipped
31
+ them cannot report green.
32
+ - Links inside the English README now point at the repository rather than at
33
+ repository paths. A registry page renders the copy that sits inside the
34
+ package, where `docs/getting-started.md` and `crates/…/examples/…` are not
35
+ there to be found — and `cargo xtask check-package` now refuses any carried
36
+ file that links to something which does not travel with it.
37
+ - **The whole release line runs without publishing anything.**
38
+ `.github/workflows/release.yml` starts on a version tag or on a hand dispatch
39
+ whose `dry_run` input defaults to the rehearsal. The pull-request gate's family
40
+ runs again there; five wheels build from one abi3 extension each (manylinux
41
+ x86_64 and aarch64 from pinned `manylinux_2_28` images, the latter
42
+ cross-compiled rather than emulated, macOS x86_64 and arm64 as two separate
43
+ wheels, Windows amd64); the crate and the sdist come from their own packagers;
44
+ and only the `publish` job — behind the shared approval environment and an
45
+ explicit `dry_run` test — reaches a registry. A rehearsal skips it visibly
46
+ rather than leaving it out of the run.
47
+ - **Publication is one sequential act behind one approval.** The `publish` job
48
+ exchanges the runner's OpenID Connect identity for a one-shot Cargo token
49
+ (`rust-lang/crates-io-auth-action`), publishes the crate first, then the
50
+ wheels and the sdist through the registry's official action, then opens the
51
+ GitHub Release page. No long-lived registry credential is stored anywhere, no
52
+ reusable workflow stands in for the publication steps (a reusable workflow
53
+ cannot be a Trusted Publishing publisher — ADR-0006), and the crate step asks
54
+ `index.crates.io` whether the number is already there and skips loudly when it
55
+ is, because the first Release publishes the crate by hand before crates.io's
56
+ publisher binding can exist.
57
+ - `cargo xtask release-notes <tag>` composes the GitHub Release body from the
58
+ changelog's dated section and the vendored Catalog Snapshot's own metadata —
59
+ its date and upstream commit — plus the platform list the matrix owes a wheel
60
+ to, so the page is read from the repository instead of typed on release day.
61
+ - **The first Release is executed from a runbook, not from memory.**
62
+ `docs/releasing.md` walks the one-time setup in the order the registries force
63
+ it (verify the account email, create the approval environment, bind the
64
+ pending Python publisher, publish the crate once with a short-lived token,
65
+ revoke it, bind the crate's trusted publisher), then the tag procedure, the
66
+ Forward Fix policy, yank as human steps only, and the post-release restoration
67
+ of `[Unreleased]`. `cargo xtask check-workflow` holds the runbook to the
68
+ workflow: the approval environment is named in both, and the sections are
69
+ checked to exist in that order. The decisions behind publication are recorded
70
+ in ADR-0006 (trusted publishing) and ADR-0007 (the Authoritative Version).
71
+ - `cargo xtask check-release <tag>` refuses a tag with a pre-release or build
72
+ suffix, a tag whose number differs from the Authoritative Version, a tag on a
73
+ commit that has not landed on `main`, and a version the changelog holds no
74
+ dated section for — naming the rule that fired each time. `cargo xtask
75
+ release-tag` answers what tag this commit would become, which is the only
76
+ question a rehearsal can ask.
77
+ - `cargo xtask check-workflow` reads the release file and holds it to itself: the
78
+ triggers, the pinned base images, the absence of an emulator, one abi3 wheel
79
+ per platform, build and publish as separate jobs joined by artifacts, and every
80
+ gate the pull-request path runs. It also requires the release file to *run* the
81
+ verdicts that decide a release — `check-release` and `check-artifacts` — and to
82
+ hand the seam its tag, the wheel it installs, and the name of the environment it
83
+ installs into, because a deleted step leaves a file that is still well-formed and
84
+ a rule nobody invokes stops nothing.
85
+ `cargo xtask check-artifacts <dir> --tag <tag>` compares a built artifact set
86
+ against the intended platforms, so a missing platform and an unexpected extra
87
+ both go red.
88
+ - `crates/simllms-python/tests/test_release_artifacts.py` runs against an
89
+ installed wheel in a venv that never saw the checkout: the reported version is
90
+ the tag's, the version comes out of the compiled extension, the licenses and
91
+ the attribution sit where an installer looks, a Gate refusal raises the typed
92
+ capability error without a network call, and the request debugger renders an
93
+ outbound body with no credential in it. The release path fails the run if any
94
+ of those checks skipped.
95
+
96
+ ### Changed
97
+
98
+ - The crate's whitelist names `src/*.rs` and `examples/*.rs` rather than the two
99
+ directories. `cargo package` reaches into a listed directory without asking
100
+ version control, so a bare `src` would publish an ignored neighbour of the
101
+ sources — a stray `src/__pycache__/` or an editor's backup. `check-package`
102
+ refuses a directory entry, and the release job plants a marker inside every
103
+ ignored directory before packing, so the artifact checks prove it stayed out.
104
+ - The Python distribution declares `license = "MIT OR Apache-2.0"` as an SPDX
105
+ expression with `license-files` (PEP 639, `Metadata-Version: 2.4`) instead
106
+ of a `License ::` classifier, which PyPI deprecated. The wheels are built
107
+ with `maturin>=1.9.3`.
108
+ - crates.io accepts five keywords, so the crate carries `llm`,
109
+ `openai-compatible` and three provider names; PyPI has no such cap and
110
+ carries all twelve. `check-package` requires the crate's set to be a subset
111
+ of the Python one.
112
+
113
+ ## [0.1.0] - 2026-10-16
114
+
115
+ First working release: one request shape, one response shape, and a
116
+ per-model statement of what each model can actually do — checked locally,
117
+ before any network call.
118
+
119
+ ### Added
120
+
121
+ - **Unified chat client** for DeepSeek, Moonshot (Kimi), Qwen/DashScope,
122
+ Zhipu (GLM), Xiaomi MiMo, OpenRouter, and any OpenAI-compatible gateway
123
+ (`Provider::Custom`), as both a Rust crate and a Python package.
124
+ - **Capability Gate**: impossible requests are refused locally with the
125
+ missing capability named (and, when the catalog knows any, capable models
126
+ suggested). Unknown model ids warn and pass (ADR-0005).
127
+ - **Capability catalog** vendored from a filtered models.dev snapshot
128
+ (515 entries), regenerated by `cargo xtask refresh-catalog`; hand-
129
+ maintained image-generation overrides where providers publish nothing.
130
+ - **`refresh_models()`** (Rust only in this release) consults the provider's own model listing
131
+ (DeepSeek, Moonshot, DashScope, OpenRouter) and merges it under the
132
+ precedence user > provider > catalog.
133
+ - **Streaming** (`chat_stream`) normalized into text/reasoning deltas plus
134
+ a final chunk with finish reason and usage; first-token and idle
135
+ timeouts; drop cancels the request.
136
+ - **Structured output**, native-only (ADR-0004): the schema reaches the
137
+ provider as a constrained `response_format`, never as prompt text;
138
+ refusals surface locally with alternatives.
139
+ - **Image generation** across three provider wire shapes (Zhipu sync URL,
140
+ OpenRouter sync b64, DashScope submit-then-poll), normalized to a
141
+ bytes-or-URL result; unsupported parameters are refused with the
142
+ parameter and model named.
143
+ - **Retries** with exponential backoff and Retry-After support (429/5xx
144
+ and transport errors only), disabled per client when wanted.
145
+ - **Error layers** (`Capability` / `Config` / `Api` / `Transport`) with the
146
+ provider's `raw_body` preserved verbatim as evidence.
147
+ - **Python bindings** (pyo3, abi3-py310): `Client` with the same gating and
148
+ error mapping, `AsyncClient` as an executor-bound thread bridge, sync and
149
+ async streaming, `generate_image`, `debug_request`, and standard logging
150
+ under the fixed `"simllms"` logger.
151
+ - **CI**: hermetic PR gate (Rust + Python) with an offline generated-catalog
152
+ check, and a weekly workflow that opens a reviewable catalog-bump PR —
153
+ never auto-merged (ADR-0002).
154
+
155
+ [0.1.0]: https://github.com/SidneyLYZhang/simllms/releases/tag/v0.1.0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2026 Sidney Zhang
2
+
3
+ Permission is hereby granted, free of charge, to any
4
+ person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the
6
+ Software without restriction, including without
7
+ limitation the rights to use, copy, modify, merge,
8
+ publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software
10
+ is furnished to do so, subject to the following
11
+ conditions:
12
+
13
+ The above copyright notice and this permission notice
14
+ shall be included in all copies or substantial portions
15
+ of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
18
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
19
+ TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
20
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
21
+ SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
24
+ IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
simllms-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,95 @@
1
+ Metadata-Version: 2.4
2
+ Name: simllms
3
+ Version: 0.1.0
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: 3.10
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Programming Language :: Python :: 3.13
10
+ Classifier: Programming Language :: Python :: 3.14
11
+ License-File: LICENSE-APACHE
12
+ License-File: LICENSE-MIT
13
+ License-File: THIRD-PARTY-NOTICES.md
14
+ Summary: Unified client for multiple LLM providers
15
+ Keywords: llm,openai-compatible,deepseek,moonshot,kimi,qwen,dashscope,zhipu,glm,xiaomi,mimo,openrouter
16
+ License-Expression: MIT OR Apache-2.0
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
19
+
20
+ # SimLLMs
21
+
22
+ **One client shape for every major LLM provider — impossible requests are
23
+ refused locally, before you pay for them.**
24
+
25
+ simllms unifies DeepSeek, Moonshot (Kimi), Qwen/DashScope, Zhipu (GLM),
26
+ Xiaomi MiMo, OpenRouter, and any OpenAI-compatible gateway behind one
27
+ client: one `chat`, one `generate_image`, one streaming shape, and a
28
+ per-model statement of what that model can actually do. The capability
29
+ Gate refuses impossible requests before any network call and tells you
30
+ what is missing — and which models on the same provider can do it.
31
+
32
+ - 中文文档 / Chinese: [README.md](https://github.com/SidneyLYZhang/simllms/blob/main/README.md)。
33
+ - Full docs: [docs/getting-started.md](https://github.com/SidneyLYZhang/simllms/blob/main/docs/getting-started.md)
34
+ (also on GitHub Pages once published).
35
+
36
+ ```rust
37
+ let client = Client::new(Provider::DeepSeek, "deepseek-v4-pro", api_key);
38
+ let reply = client.chat(vec![Message::text("你好")]).await?;
39
+ ```
40
+
41
+ ```python
42
+ from simllms import Client
43
+
44
+ client = Client("deepseek", "deepseek-v4-pro", api_key)
45
+ reply = client.chat(["你好"])
46
+ ```
47
+
48
+ ## Runnable examples
49
+
50
+ Every example talks to a local mock service when no credentials are
51
+ present, and to the real provider when the matching API key is set.
52
+
53
+ | Topic | Rust (`crates/simllms/examples/`) | Python (`crates/simllms-python/examples/`) |
54
+ | --- | --- | --- |
55
+ | Chat | [`deepseek_chat.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/deepseek_chat.rs) | [`chat.py`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms-python/examples/chat.py) |
56
+ | Streaming | [`chat_stream.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/chat_stream.rs) | [`chat_stream.py`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms-python/examples/chat_stream.py) |
57
+ | Structured output | [`structured_output.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/structured_output.rs) | [`structured_output.py`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms-python/examples/structured_output.py) |
58
+ | Image generation | [`generate_image.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/generate_image.rs) | [`generate_image.py`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms-python/examples/generate_image.py) |
59
+ | Custom gateway | [`custom_gateway.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/custom_gateway.rs) | — |
60
+
61
+ Rust: `cargo run --example deepseek_chat` (same pattern for the rest).
62
+ Python: from `crates/simllms-python/`, run `uv run examples/chat.py`
63
+ (same pattern for the rest).
64
+
65
+ The examples cover DeepSeek, Moonshot, OpenRouter, and Zhipu; each
66
+ provider's API key is read from its environment variable
67
+ (`DEEPSEEK_API_KEY` etc.), falling back to the local mock when unset.
68
+
69
+ ## Install
70
+
71
+ ```bash
72
+ # Rust
73
+ cargo add simllms
74
+ ```
75
+
76
+ ```bash
77
+ # Python
78
+ pip install simllms # or: uv add simllms
79
+ ```
80
+
81
+ This release does not bind every client entry point on the Python side; the
82
+ list is in the "Rust-only for now" section of
83
+ [docs/getting-started.md](https://github.com/SidneyLYZhang/simllms/blob/main/docs/getting-started.md),
84
+ and Python coverage lands in a later minor release.
85
+
86
+ Docs: [docs/getting-started.md](https://github.com/SidneyLYZhang/simllms/blob/main/docs/getting-started.md) ·
87
+ topic guides live under `docs/` (chat / streaming / structured-output /
88
+ image-generation / capabilities / custom-gateway).
89
+
90
+ ## License
91
+
92
+ MIT OR Apache-2.0. The model capability snapshot comes from
93
+ [models.dev](https://models.dev) (MIT), see
94
+ [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md).
95
+
@@ -0,0 +1,75 @@
1
+ # SimLLMs
2
+
3
+ **One client shape for every major LLM provider — impossible requests are
4
+ refused locally, before you pay for them.**
5
+
6
+ simllms unifies DeepSeek, Moonshot (Kimi), Qwen/DashScope, Zhipu (GLM),
7
+ Xiaomi MiMo, OpenRouter, and any OpenAI-compatible gateway behind one
8
+ client: one `chat`, one `generate_image`, one streaming shape, and a
9
+ per-model statement of what that model can actually do. The capability
10
+ Gate refuses impossible requests before any network call and tells you
11
+ what is missing — and which models on the same provider can do it.
12
+
13
+ - 中文文档 / Chinese: [README.md](https://github.com/SidneyLYZhang/simllms/blob/main/README.md)。
14
+ - Full docs: [docs/getting-started.md](https://github.com/SidneyLYZhang/simllms/blob/main/docs/getting-started.md)
15
+ (also on GitHub Pages once published).
16
+
17
+ ```rust
18
+ let client = Client::new(Provider::DeepSeek, "deepseek-v4-pro", api_key);
19
+ let reply = client.chat(vec![Message::text("你好")]).await?;
20
+ ```
21
+
22
+ ```python
23
+ from simllms import Client
24
+
25
+ client = Client("deepseek", "deepseek-v4-pro", api_key)
26
+ reply = client.chat(["你好"])
27
+ ```
28
+
29
+ ## Runnable examples
30
+
31
+ Every example talks to a local mock service when no credentials are
32
+ present, and to the real provider when the matching API key is set.
33
+
34
+ | Topic | Rust (`crates/simllms/examples/`) | Python (`crates/simllms-python/examples/`) |
35
+ | --- | --- | --- |
36
+ | Chat | [`deepseek_chat.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/deepseek_chat.rs) | [`chat.py`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms-python/examples/chat.py) |
37
+ | Streaming | [`chat_stream.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/chat_stream.rs) | [`chat_stream.py`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms-python/examples/chat_stream.py) |
38
+ | Structured output | [`structured_output.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/structured_output.rs) | [`structured_output.py`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms-python/examples/structured_output.py) |
39
+ | Image generation | [`generate_image.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/generate_image.rs) | [`generate_image.py`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms-python/examples/generate_image.py) |
40
+ | Custom gateway | [`custom_gateway.rs`](https://github.com/SidneyLYZhang/simllms/blob/main/crates/simllms/examples/custom_gateway.rs) | — |
41
+
42
+ Rust: `cargo run --example deepseek_chat` (same pattern for the rest).
43
+ Python: from `crates/simllms-python/`, run `uv run examples/chat.py`
44
+ (same pattern for the rest).
45
+
46
+ The examples cover DeepSeek, Moonshot, OpenRouter, and Zhipu; each
47
+ provider's API key is read from its environment variable
48
+ (`DEEPSEEK_API_KEY` etc.), falling back to the local mock when unset.
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ # Rust
54
+ cargo add simllms
55
+ ```
56
+
57
+ ```bash
58
+ # Python
59
+ pip install simllms # or: uv add simllms
60
+ ```
61
+
62
+ This release does not bind every client entry point on the Python side; the
63
+ list is in the "Rust-only for now" section of
64
+ [docs/getting-started.md](https://github.com/SidneyLYZhang/simllms/blob/main/docs/getting-started.md),
65
+ and Python coverage lands in a later minor release.
66
+
67
+ Docs: [docs/getting-started.md](https://github.com/SidneyLYZhang/simllms/blob/main/docs/getting-started.md) ·
68
+ topic guides live under `docs/` (chat / streaming / structured-output /
69
+ image-generation / capabilities / custom-gateway).
70
+
71
+ ## License
72
+
73
+ MIT OR Apache-2.0. The model capability snapshot comes from
74
+ [models.dev](https://models.dev) (MIT), see
75
+ [THIRD-PARTY-NOTICES.md](THIRD-PARTY-NOTICES.md).
@@ -0,0 +1,19 @@
1
+ # Third-party notices
2
+
3
+ ## models.dev snapshot
4
+
5
+ The capability data in `catalog/modelsdev-snapshot.json` and the generated
6
+ file `crates/simllms/src/catalog_data.rs` is derived from
7
+ [models.dev](https://models.dev) ([anomalyco/models.dev](https://github.com/anomalyco/models.dev)),
8
+ copyright the models.dev contributors, licensed under the MIT License.
9
+ The snapshot records its exact upstream commit and date in `meta`.
10
+ Image-generation capability entries are **not** from models.dev; they are
11
+ hand-maintained in this repository.
12
+
13
+ ### MIT License (models.dev)
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,65 @@
1
+ [build-system]
2
+ # 1.9.3 is the first release that carries PEP 639 license files into a source
3
+ # distribution, which is what the two settings below ask for.
4
+ requires = ["maturin>=1.9.3,<2"]
5
+ build-backend = "maturin"
6
+
7
+ [project]
8
+ name = "simllms"
9
+ # The Authoritative Version is the root workspace manifest; this copy derives
10
+ # through the binding crate's Cargo.toml, which the build backend reads.
11
+ dynamic = ["version"]
12
+ description = "Unified client for multiple LLM providers"
13
+ requires-python = ">=3.10"
14
+ # PEP 639: an SPDX expression for the license, and the files themselves listed
15
+ # so they reach an installed distribution under `*.dist-info/licenses/`. The
16
+ # deprecated `license = { text = … }` table carried the words and nothing else.
17
+ license = "MIT OR Apache-2.0"
18
+ license-files = ["LICENSE-APACHE", "LICENSE-MIT", "THIRD-PARTY-NOTICES.md"]
19
+ # Registry pages render this file; the repository's default README is Chinese.
20
+ readme = "README.en.md"
21
+ # PyPI has no keyword ceiling, so this side names every provider; the crate is
22
+ # capped at five and picks the ones people search for.
23
+ keywords = [
24
+ "llm",
25
+ "openai-compatible",
26
+ "deepseek",
27
+ "moonshot",
28
+ "kimi",
29
+ "qwen",
30
+ "dashscope",
31
+ "zhipu",
32
+ "glm",
33
+ "xiaomi",
34
+ "mimo",
35
+ "openrouter",
36
+ ]
37
+ classifiers = [
38
+ "Programming Language :: Rust",
39
+ "Programming Language :: Python :: Implementation :: CPython",
40
+ "Programming Language :: Python :: 3.10",
41
+ "Programming Language :: Python :: 3.11",
42
+ "Programming Language :: Python :: 3.12",
43
+ "Programming Language :: Python :: 3.13",
44
+ "Programming Language :: Python :: 3.14",
45
+ ]
46
+
47
+ [tool.maturin]
48
+ module-name = "simllms._core"
49
+ bindings = "pyo3"
50
+ # The wheel is told about the licenses through `license-files` and about the
51
+ # README through `readme`, so only the source distribution needs them listed as
52
+ # files. Each path is a copy that `cargo xtask sync-package` writes: PEP 639
53
+ # forbids `..` here, so a root-level file cannot travel by reference.
54
+ include = [
55
+ { path = "CHANGELOG.md", format = "sdist" },
56
+ { path = "LICENSE-APACHE", format = "sdist" },
57
+ { path = "LICENSE-MIT", format = "sdist" },
58
+ { path = "README.en.md", format = "sdist" },
59
+ { path = "THIRD-PARTY-NOTICES.md", format = "sdist" },
60
+ ]
61
+ # Byte-compiled files from whoever built the wheel have no business travelling
62
+ # inside it; the wheel is the installed package, not a working directory.
63
+ exclude = ["**/__pycache__/**", "**/*.pyc"]
64
+ manifest-path = "simllms-python/Cargo.toml"
65
+ python-source = "python"