pareta 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 (61) hide show
  1. pareta-0.1.0/.github/workflows/publish.yml +57 -0
  2. pareta-0.1.0/.gitignore +9 -0
  3. pareta-0.1.0/LICENSE +202 -0
  4. pareta-0.1.0/PKG-INFO +109 -0
  5. pareta-0.1.0/README.md +82 -0
  6. pareta-0.1.0/docs/README.md +78 -0
  7. pareta-0.1.0/docs/examples/README.md +41 -0
  8. pareta-0.1.0/docs/examples/concurrent-async.md +329 -0
  9. pareta-0.1.0/docs/examples/cost-and-metrics.md +189 -0
  10. pareta-0.1.0/docs/examples/deploy-and-infer.md +263 -0
  11. pareta-0.1.0/docs/examples/document-extraction.md +362 -0
  12. pareta-0.1.0/docs/examples/evaluate-on-your-data.md +318 -0
  13. pareta-0.1.0/docs/examples/find-and-deploy-best-model.md +416 -0
  14. pareta-0.1.0/docs/examples/migrate-from-openai.md +307 -0
  15. pareta-0.1.0/docs/examples/streaming-chat.md +206 -0
  16. pareta-0.1.0/docs/guide/README.md +23 -0
  17. pareta-0.1.0/docs/guide/async.md +387 -0
  18. pareta-0.1.0/docs/guide/configuration.md +348 -0
  19. pareta-0.1.0/docs/guide/core-concepts.md +341 -0
  20. pareta-0.1.0/docs/guide/deploying-endpoints.md +268 -0
  21. pareta-0.1.0/docs/guide/discovery.md +339 -0
  22. pareta-0.1.0/docs/guide/errors-and-retries.md +385 -0
  23. pareta-0.1.0/docs/guide/evaluation.md +278 -0
  24. pareta-0.1.0/docs/guide/inference.md +202 -0
  25. pareta-0.1.0/docs/guide/installation.md +174 -0
  26. pareta-0.1.0/docs/guide/quickstart.md +200 -0
  27. pareta-0.1.0/docs/llms-full.txt +8700 -0
  28. pareta-0.1.0/docs/llms.txt +45 -0
  29. pareta-0.1.0/docs/reference/README.md +29 -0
  30. pareta-0.1.0/docs/reference/chat.md +247 -0
  31. pareta-0.1.0/docs/reference/client.md +305 -0
  32. pareta-0.1.0/docs/reference/endpoints.md +287 -0
  33. pareta-0.1.0/docs/reference/evals.md +440 -0
  34. pareta-0.1.0/docs/reference/exceptions.md +335 -0
  35. pareta-0.1.0/docs/reference/http-api.md +645 -0
  36. pareta-0.1.0/docs/reference/models.md +147 -0
  37. pareta-0.1.0/docs/reference/tasks.md +335 -0
  38. pareta-0.1.0/docs/reference/types.md +452 -0
  39. pareta-0.1.0/pyproject.toml +46 -0
  40. pareta-0.1.0/scripts/build_llms.py +150 -0
  41. pareta-0.1.0/src/pareta/__init__.py +86 -0
  42. pareta-0.1.0/src/pareta/_client.py +371 -0
  43. pareta-0.1.0/src/pareta/_exceptions.py +113 -0
  44. pareta-0.1.0/src/pareta/_models.py +447 -0
  45. pareta-0.1.0/src/pareta/_version.py +7 -0
  46. pareta-0.1.0/src/pareta/py.typed +0 -0
  47. pareta-0.1.0/src/pareta/resources/__init__.py +1 -0
  48. pareta-0.1.0/src/pareta/resources/chat.py +80 -0
  49. pareta-0.1.0/src/pareta/resources/endpoints.py +165 -0
  50. pareta-0.1.0/src/pareta/resources/evals.py +296 -0
  51. pareta-0.1.0/src/pareta/resources/models.py +27 -0
  52. pareta-0.1.0/src/pareta/resources/tasks.py +59 -0
  53. pareta-0.1.0/tests/conftest.py +42 -0
  54. pareta-0.1.0/tests/test_async.py +48 -0
  55. pareta-0.1.0/tests/test_chat_and_models.py +69 -0
  56. pareta-0.1.0/tests/test_client.py +48 -0
  57. pareta-0.1.0/tests/test_endpoints.py +77 -0
  58. pareta-0.1.0/tests/test_errors_and_retries.py +126 -0
  59. pareta-0.1.0/tests/test_llms.py +17 -0
  60. pareta-0.1.0/tests/test_slice4_discovery.py +140 -0
  61. pareta-0.1.0/tests/test_tasks_and_evals.py +175 -0
@@ -0,0 +1,57 @@
1
+ # Publish `pareta` to PyPI on a GitHub Release, via PyPI Trusted Publishing
2
+ # (OIDC — no API tokens). The release-driven trigger means: cut a GitHub
3
+ # Release (e.g. v0.1.0) and this builds the sdist+wheel and publishes them.
4
+ #
5
+ # One-time PyPI setup (https://pypi.org/manage/account/publishing/):
6
+ # PyPI Project Name : pareta
7
+ # Owner : Pareta-AI
8
+ # Repository name : pareta
9
+ # Workflow name : publish.yml
10
+ # Environment name : pypi
11
+ name: Publish to PyPI
12
+
13
+ on:
14
+ release:
15
+ types: [published]
16
+
17
+ permissions:
18
+ contents: read
19
+
20
+ jobs:
21
+ build:
22
+ name: Build distributions
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.12"
29
+ - name: Build sdist + wheel
30
+ run: |
31
+ python -m pip install --upgrade build
32
+ python -m build
33
+ - name: Check metadata
34
+ run: |
35
+ python -m pip install --upgrade twine
36
+ python -m twine check dist/*
37
+ - uses: actions/upload-artifact@v4
38
+ with:
39
+ name: dist
40
+ path: dist/
41
+
42
+ publish:
43
+ name: Publish to PyPI
44
+ needs: build
45
+ runs-on: ubuntu-latest
46
+ environment:
47
+ name: pypi
48
+ url: https://pypi.org/p/pareta
49
+ permissions:
50
+ id-token: write # OIDC token for Trusted Publishing
51
+ steps:
52
+ - uses: actions/download-artifact@v4
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+ - name: Publish
57
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ .venv/
5
+ venv/
6
+ dist/
7
+ build/
8
+ *.egg-info/
9
+ .coverage
pareta-0.1.0/LICENSE ADDED
@@ -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 Pareta
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
+
pareta-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: pareta
3
+ Version: 0.1.0
4
+ Summary: Python client for Pareta — deploy open-weights endpoints, run metered inference, and eval models on your own data.
5
+ Project-URL: Homepage, https://pareta.ai
6
+ Project-URL: Documentation, https://docs.pareta.ai
7
+ Project-URL: Source, https://github.com/Pareta-AI/pareta
8
+ Project-URL: Issues, https://github.com/Pareta-AI/pareta/issues
9
+ Author: Pareta
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: evals,inference,llm,open-weights,openai,pareta
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Typing :: Typed
19
+ Requires-Python: >=3.10
20
+ Requires-Dist: httpx>=0.27
21
+ Requires-Dist: typing-extensions>=4.10; python_version < '3.12'
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
24
+ Requires-Dist: pytest>=8; extra == 'dev'
25
+ Requires-Dist: respx>=0.21; extra == 'dev'
26
+ Description-Content-Type: text/markdown
27
+
28
+ # pareta
29
+
30
+ Python client for [Pareta](https://pareta.ai) — deploy open-weights endpoints,
31
+ run metered inference, browse the benchmark catalog, and eval models on your own
32
+ data.
33
+
34
+ ```bash
35
+ pip install pareta # or: uv add pareta / poetry add pareta
36
+ ```
37
+
38
+ ```python
39
+ from pareta import Pareta
40
+
41
+ pa = Pareta.from_env() # reads PARETA_API_KEY
42
+ # or: Pareta(api_key="pareta_sk_…", base_url="https://api.pareta.ai")
43
+
44
+ # OpenAI-compatible inference against a deployed endpoint
45
+ resp = pa.chat.completions.create(
46
+ model="ep_…", # an endpoint id (see pa.models.list())
47
+ messages=[{"role": "user", "content": "Extract the total from this invoice: …"}],
48
+ )
49
+ print(resp.choices[0].message.content)
50
+
51
+ # Streaming
52
+ for chunk in pa.chat.completions.create(model="ep_…", messages=[...], stream=True):
53
+ print(chunk.choices[0].delta.content or "", end="")
54
+
55
+ # List the models (endpoints) your org can call
56
+ for m in pa.models.list():
57
+ print(m.id)
58
+ ```
59
+
60
+ Async mirrors the sync client:
61
+
62
+ ```python
63
+ from pareta import AsyncPareta
64
+
65
+ async with AsyncPareta.from_env() as pa:
66
+ resp = await pa.chat.completions.create(model="ep_…", messages=[...])
67
+ ```
68
+
69
+ ## Auth
70
+
71
+ Mint a `pareta_sk_` key in the dashboard (key management is browser-only) and
72
+ pass it as `api_key=` or via `PARETA_API_KEY`. The SDK only ever *consumes* a
73
+ key; it never creates, lists, or revokes them.
74
+
75
+ ## Inference is OpenAI-compatible
76
+
77
+ You don't even need this SDK to *call* a deployed endpoint — point the `openai`
78
+ client at `base_url` + your key:
79
+
80
+ ```python
81
+ from openai import OpenAI
82
+ client = OpenAI(api_key="pareta_sk_…", base_url="https://api.pareta.ai/v1")
83
+ ```
84
+
85
+ This SDK's unique value is the **control plane**: deploy, operate, and eval
86
+ models from code. Those land slice by slice — see `SDK_PLAN.md`.
87
+
88
+ ## Errors
89
+
90
+ All errors subclass `pareta.ParetaError`:
91
+
92
+ | Exception | When |
93
+ |---|---|
94
+ | `AuthenticationError` (401) | bad/missing key |
95
+ | `InsufficientCreditsError` (402) | org out of credit — top up in the dashboard |
96
+ | `NotFoundError` (404) | unknown endpoint |
97
+ | `EndpointNotReadyError` (503) | endpoint stopped / cold / provider down |
98
+ | `RateLimitError` (429) | throttled (auto-retried) |
99
+ | `BadRequestError` (400/422) | malformed request |
100
+ | `APIConnectionError` / `APITimeoutError` | transport failure (auto-retried) |
101
+
102
+ Idempotent GETs and 429/5xx/timeouts are retried with exponential backoff
103
+ (`max_retries`, default 2).
104
+
105
+ ## Status
106
+
107
+ Slice 1 (this release): core client, auth, retries, typed errors,
108
+ `chat.completions`, `models`. Endpoints, tasks, and evals land next
109
+ (`SDK_PLAN.md` §11).
pareta-0.1.0/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # pareta
2
+
3
+ Python client for [Pareta](https://pareta.ai) — deploy open-weights endpoints,
4
+ run metered inference, browse the benchmark catalog, and eval models on your own
5
+ data.
6
+
7
+ ```bash
8
+ pip install pareta # or: uv add pareta / poetry add pareta
9
+ ```
10
+
11
+ ```python
12
+ from pareta import Pareta
13
+
14
+ pa = Pareta.from_env() # reads PARETA_API_KEY
15
+ # or: Pareta(api_key="pareta_sk_…", base_url="https://api.pareta.ai")
16
+
17
+ # OpenAI-compatible inference against a deployed endpoint
18
+ resp = pa.chat.completions.create(
19
+ model="ep_…", # an endpoint id (see pa.models.list())
20
+ messages=[{"role": "user", "content": "Extract the total from this invoice: …"}],
21
+ )
22
+ print(resp.choices[0].message.content)
23
+
24
+ # Streaming
25
+ for chunk in pa.chat.completions.create(model="ep_…", messages=[...], stream=True):
26
+ print(chunk.choices[0].delta.content or "", end="")
27
+
28
+ # List the models (endpoints) your org can call
29
+ for m in pa.models.list():
30
+ print(m.id)
31
+ ```
32
+
33
+ Async mirrors the sync client:
34
+
35
+ ```python
36
+ from pareta import AsyncPareta
37
+
38
+ async with AsyncPareta.from_env() as pa:
39
+ resp = await pa.chat.completions.create(model="ep_…", messages=[...])
40
+ ```
41
+
42
+ ## Auth
43
+
44
+ Mint a `pareta_sk_` key in the dashboard (key management is browser-only) and
45
+ pass it as `api_key=` or via `PARETA_API_KEY`. The SDK only ever *consumes* a
46
+ key; it never creates, lists, or revokes them.
47
+
48
+ ## Inference is OpenAI-compatible
49
+
50
+ You don't even need this SDK to *call* a deployed endpoint — point the `openai`
51
+ client at `base_url` + your key:
52
+
53
+ ```python
54
+ from openai import OpenAI
55
+ client = OpenAI(api_key="pareta_sk_…", base_url="https://api.pareta.ai/v1")
56
+ ```
57
+
58
+ This SDK's unique value is the **control plane**: deploy, operate, and eval
59
+ models from code. Those land slice by slice — see `SDK_PLAN.md`.
60
+
61
+ ## Errors
62
+
63
+ All errors subclass `pareta.ParetaError`:
64
+
65
+ | Exception | When |
66
+ |---|---|
67
+ | `AuthenticationError` (401) | bad/missing key |
68
+ | `InsufficientCreditsError` (402) | org out of credit — top up in the dashboard |
69
+ | `NotFoundError` (404) | unknown endpoint |
70
+ | `EndpointNotReadyError` (503) | endpoint stopped / cold / provider down |
71
+ | `RateLimitError` (429) | throttled (auto-retried) |
72
+ | `BadRequestError` (400/422) | malformed request |
73
+ | `APIConnectionError` / `APITimeoutError` | transport failure (auto-retried) |
74
+
75
+ Idempotent GETs and 429/5xx/timeouts are retried with exponential backoff
76
+ (`max_retries`, default 2).
77
+
78
+ ## Status
79
+
80
+ Slice 1 (this release): core client, auth, retries, typed errors,
81
+ `chat.completions`, `models`. Endpoints, tasks, and evals land next
82
+ (`SDK_PLAN.md` §11).
@@ -0,0 +1,78 @@
1
+ # Pareta Python SDK
2
+
3
+ `pareta` is the Python client for [Pareta](https://pareta.ai). It does four things:
4
+
5
+ - **Deploys open-weights models** as live endpoints. You name a task and a model; Pareta picks the GPU and serving config. There is no hardware knob.
6
+ - **Serves metered OpenAI-compatible inference.** A deployed endpoint speaks the OpenAI chat-completions wire format, so this SDK and the stock `openai` client are interchangeable against it.
7
+ - **Evaluates models on your own data.** Score open candidates and frontier baselines on your rows, then read per-model quality and cost.
8
+ - **Browses the benchmark catalog.** Match a sentence to a task, read its leaderboard, and find the model worth deploying.
9
+
10
+ A few platform truths shape the whole API:
11
+
12
+ - **GPUs are hidden.** `endpoints.deploy()` takes a task and a model, never hardware.
13
+ - **Models are per-task aliases.** Open-weights ids are masked to public aliases like `qwen-vl-2`. Real ids never cross the SDK boundary. Frontier (vendor) ids are in the clear.
14
+ - **Inference and evals are metered against your org balance.** A successful call debits credit. An empty balance raises `InsufficientCreditsError` (402). An eval run reports its billed total on `run.cost` (dollars). Top-up is browser-only; the SDK never touches billing.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pip install pareta # or: uv add pareta / poetry add pareta
20
+ ```
21
+
22
+ ## Hello world
23
+
24
+ Mint a `pareta_sk_` key in the dashboard, export it as `PARETA_API_KEY`, then deploy and call a model:
25
+
26
+ ```python
27
+ from pareta import Pareta
28
+
29
+ pa = Pareta.from_env() # reads PARETA_API_KEY
30
+ ep = pa.endpoints.deploy(task="contract-key-fields", model="recommended", wait=True)
31
+ resp = pa.chat.completions.create(
32
+ model=ep.id, # the endpoint id
33
+ messages=[{"role": "user", "content": "Say hello in one sentence."}],
34
+ )
35
+ print(resp.choices[0].message.content)
36
+ ```
37
+
38
+ ## Guide
39
+
40
+ Start-to-finish, in reading order. See the [guide index](./guide/README.md).
41
+
42
+ - [Installation & authentication](./guide/installation.md) — install `pareta`, authenticate with a `pareta_sk_` key, make a first metered call.
43
+ - [Quickstart](./guide/quickstart.md) — deploy the recommended model and run inference end to end in about a dozen lines.
44
+ - [Core concepts](./guide/core-concepts.md) — tasks, open vs frontier models, per-task aliases, hidden hardware, metering, and the match to leaderboard to eval to deploy funnel.
45
+ - [Running inference](./guide/inference.md) — `chat.completions.create`, streaming, passthrough params, `models.list`, and metering errors.
46
+ - [Deploying & operating endpoints](./guide/deploying-endpoints.md) — `deploy` wait semantics, lifecycle, and `metrics`.
47
+ - [Finding the right model](./guide/discovery.md) — match intent, rank with `leaderboard`/`recommended`, list frontier baselines.
48
+ - [Evaluating on your own data](./guide/evaluation.md) — `evals.sets` and `evals.runs`, per-model quality/CIs/cost, and the metered run total.
49
+ - [Errors, retries & timeouts](./guide/errors-and-retries.md) — the `ParetaError` hierarchy, which errors to catch, and the retry policy.
50
+ - [Async usage](./guide/async.md) — `AsyncPareta`, async iteration, and fanning out with `asyncio.gather`.
51
+ - [Configuration](./guide/configuration.md) — `api_key`, `base_url`, timeouts, retries, custom `httpx` clients, and lifecycle.
52
+
53
+ ## Examples
54
+
55
+ Copy-paste workflows for real jobs. See the [examples index](./examples/README.md).
56
+
57
+ - [Deploy a model and call it](./examples/deploy-and-infer.md) — the two-call deploy-then-infer workflow.
58
+ - [From a sentence to a deployed winner](./examples/find-and-deploy-best-model.md) — the full match to eval to deploy funnel.
59
+ - [Benchmark models on your own data](./examples/evaluate-on-your-data.md) — eval open candidates against frontier baselines and read `run.cost`.
60
+ - [Document extraction (PDF/image)](./examples/document-extraction.md) — the blob-task loop: upload documents, eval, deploy, infer.
61
+ - [Streaming chat completions](./examples/streaming-chat.md) — iterate `ChatCompletionChunk` objects and accumulate text.
62
+ - [Concurrent calls with AsyncPareta](./examples/concurrent-async.md) — fan out inference and eval calls with `asyncio.gather`.
63
+ - [Cost & quality monitoring](./examples/cost-and-metrics.md) — read what calls cost and watch a live endpoint with `endpoints.metrics()`.
64
+ - [Migrating from the OpenAI SDK](./examples/migrate-from-openai.md) — keep using `openai` against Pareta, and when to switch to `pareta`.
65
+
66
+ ## Reference
67
+
68
+ Field-by-field API docs. See the [reference index](./reference/README.md).
69
+
70
+ - [Client](./reference/client.md) — `Pareta` and `AsyncPareta`: `from_env`, constructor params, lifecycle, and the five resource namespaces.
71
+ - [chat.completions](./reference/chat.md) — `chat.completions.create`, return types, streaming, and the error surface.
72
+ - [models](./reference/models.md) — `models.list()` and the `Model` fields.
73
+ - [endpoints](./reference/endpoints.md) — `deploy`/`list`/`retrieve`/`start`/`stop`/`delete`, the `Endpoint` object, and `metrics(id)`.
74
+ - [tasks](./reference/tasks.md) — `list`/`retrieve`/`match`/`leaderboard`/`recommended` and their response models.
75
+ - [evals](./reference/evals.md) — `evals.sets`, `evals.runs`, and `evals.frontier_models`.
76
+ - [Exceptions](./reference/exceptions.md) — the `ParetaError` hierarchy and status-to-class mapping.
77
+ - [Response types](./reference/types.md) — every response object plus the `.cost` vs `.cost_micro_usd` money convention.
78
+ - [Underlying HTTP API](./reference/http-api.md) — the `/v1` routes the SDK wraps.
@@ -0,0 +1,41 @@
1
+ # Examples
2
+
3
+ Complete, runnable workflows for real jobs. Each page is self-contained and uses the real SDK surface end to end: `Pareta.from_env()`, deploy a model (no GPU knob), call it with OpenAI-compatible inference, and read the metered cost in dollars off `run.cost`. Grouped by what you are trying to do.
4
+
5
+ ## Deploy and call a model
6
+
7
+ You know the task; you want a live endpoint and a response.
8
+
9
+ - [Deploy a model and call it](./deploy-and-infer.md) — the two-call workflow: `endpoints.deploy(task, model="recommended", wait=True)` then `chat.completions.create(model=endpoint.id, ...)`. Covers deploy events, streaming, metering and `InsufficientCreditsError`, errors, endpoint ops, and async.
10
+
11
+ ## Pick the right model first
12
+
13
+ You have a job in plain English, or your own data, and want to deploy the model that actually wins on it.
14
+
15
+ - [From a sentence to a deployed winner](./find-and-deploy-best-model.md) — the full funnel: `tasks.match` to `leaderboard` to `evals.runs` on your own data, pick the best `kind == "open"` model, `endpoints.deploy` it, then run inference.
16
+ - [Benchmark models on your own data](./evaluate-on-your-data.md) — build an eval set from your rows, run open candidates against `frontier="benchmarked"`, and read ranked results plus `run.cost`.
17
+ - [Document extraction (PDF/image)](./document-extraction.md) — the blob-task loop: build an eval set from your PDFs/images, `upload_document` per row, run against open candidates plus vision frontier baselines, pick the winner by quality and cost, deploy, then run OpenAI-compatible inference.
18
+
19
+ ## Inference patterns
20
+
21
+ Getting tokens out efficiently.
22
+
23
+ - [Streaming chat completions](./streaming-chat.md) — stream tokens with `chat.completions.create(stream=True)`: iterate `ChatCompletionChunk` objects, read `delta.content`, accumulate full text, plus async streaming and metering behavior.
24
+ - [Concurrent calls with AsyncPareta](./concurrent-async.md) — fire many inference and eval calls concurrently with `AsyncPareta` and `asyncio.gather`, with semaphore backpressure and per-task error handling.
25
+
26
+ ## Operate and monitor
27
+
28
+ Watching what is deployed, and what it costs.
29
+
30
+ - [Cost & quality monitoring](./cost-and-metrics.md) — read what calls and eval runs cost, the open-vs-frontier savings framing, and watch a live endpoint's spend and quality via `endpoints.metrics()`.
31
+
32
+ ## Migrating in
33
+
34
+ Already on the OpenAI SDK.
35
+
36
+ - [Migrating from the OpenAI SDK](./migrate-from-openai.md) — keep using the `openai` client against Pareta (`base_url` + `pareta_sk_` key), and when to switch to the `pareta` SDK for deploy, eval, and discovery.
37
+
38
+ ## See also
39
+
40
+ - Concepts and step-by-step explanation: [Guide](../guide/README.md).
41
+ - Field-by-field API docs: [Reference](../reference/README.md).