Skip to content

Commit c52efc3

Browse files
authored
Merge pull request #8 from Not-Diamond/release-please--branches--main--changes--next
release: 1.0.0-rc3
2 parents 4cc92d0 + e441c24 commit c52efc3

72 files changed

Lines changed: 4658 additions & 4750 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.0.0-rc2"
2+
".": "1.0.0-rc3"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 17
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/not-diamond-dragos199993%2Fnot-diamond-8bcbee982c8824ec1768e681aafe64151b8c1790fda874599f7818c8e067099b.yml
3-
openapi_spec_hash: cf30014285209649e86e504008efb7d1
4-
config_hash: ebc053f864d961cd31bf34d651c7c04d
1+
configured_endpoints: 14
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/not-diamond-dragos199993%2Fnot-diamond-e24f2461df15a806e3208e5228ecdb9913e9c9d526cd68cf87fee4a2528b95c3.yml
3+
openapi_spec_hash: a7a8c716d5b412a6befc68091a7627ea
4+
config_hash: 9d158a3181fcb2291bf97047b2cbb7a0

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog
22

3+
## 1.0.0-rc3 (2025-11-05)
4+
5+
Full Changelog: [v1.0.0-rc2...v1.0.0-rc3](https://github.com/Not-Diamond/not-diamond-python/compare/v1.0.0-rc2...v1.0.0-rc3)
6+
7+
### Features
8+
9+
* **api:** api update ([0cdedc2](https://github.com/Not-Diamond/not-diamond-python/commit/0cdedc27ef1bab63e433bdc0717c36cc48d60b55))
10+
* **api:** api update ([f717b91](https://github.com/Not-Diamond/not-diamond-python/commit/f717b91a37cd48a63e9ef9458cef6dd899383f2c))
11+
* **api:** api update ([24340ab](https://github.com/Not-Diamond/not-diamond-python/commit/24340ab121937a85e9c4bbc8b644c62b15f75d89))
12+
* **api:** enable tests ([64ccd03](https://github.com/Not-Diamond/not-diamond-python/commit/64ccd03281ae7b420b44cf64910568e3657f24db))
13+
* **api:** regen docs ([c80dbe1](https://github.com/Not-Diamond/not-diamond-python/commit/c80dbe1994cd73b549995b5e91ac86a62a77f5b7))
14+
* **api:** verify mock tests enabled ([638d79b](https://github.com/Not-Diamond/not-diamond-python/commit/638d79bdd90097d9823d02e3dac8b12ab2849d03))
15+
16+
17+
### Chores
18+
19+
* **internal:** grammar fix (it's -> its) ([6d37a12](https://github.com/Not-Diamond/not-diamond-python/commit/6d37a125457223046183bcc8ee7159ed96b80424))
20+
* update SDK settings ([ba3968b](https://github.com/Not-Diamond/not-diamond-python/commit/ba3968b9ef7b2ec9e7b1b3983a6e2a8b31ccbc37))
21+
322
## 1.0.0-rc2 (2025-10-31)
423

524
Full Changelog: [v1.0.0-rc1...v1.0.0-rc2](https://github.com/Not-Diamond/not-diamond-python/compare/v1.0.0-rc1...v1.0.0-rc2)

README.md

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Not Diamond Python API library
22

33
<!-- prettier-ignore -->
4-
[![PyPI version](https://img.shields.io/pypi/v/notdiamond.svg?label=pypi%20(stable))](https://pypi.org/project/notdiamond/)
4+
[![PyPI version](https://img.shields.io/pypi/v/not_diamond.svg?label=pypi%20(stable))](https://pypi.org/project/not_diamond/)
55

66
The Not Diamond Python library provides convenient access to the Not Diamond REST API from any Python 3.8+
77
application. The library includes type definitions for all request params and response fields,
@@ -11,15 +11,18 @@ It is generated with [Stainless](https://www.stainless.com/).
1111

1212
## Documentation
1313

14-
The REST API documentation can be found on [docs.notdiamond.ai](https://docs.notdiamond.ai). The full API of this library can be found in [api.md](api.md).
14+
The full API of this library can be found in [api.md](api.md).
1515

1616
## Installation
1717

1818
```sh
19-
# install from PyPI
20-
pip install --pre notdiamond
19+
# install from the production repo
20+
pip install git+ssh://git@github.com/Not-Diamond/not-diamond-python.git
2121
```
2222

23+
> [!NOTE]
24+
> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install --pre not_diamond`
25+
2326
## Usage
2427

2528
The full API of this library can be found in [api.md](api.md).
@@ -30,11 +33,9 @@ from not_diamond import NotDiamond
3033

3134
client = NotDiamond(
3235
api_key=os.environ.get("NOT_DIAMOND_API_KEY"), # This is the default and can be omitted
33-
# defaults to "production".
34-
environment="staging",
3536
)
3637

37-
response = client.routing.select_model(
38+
response = client.model_router.select_model(
3839
llm_providers=[
3940
{
4041
"model": "gpt-4o",
@@ -79,13 +80,11 @@ from not_diamond import AsyncNotDiamond
7980

8081
client = AsyncNotDiamond(
8182
api_key=os.environ.get("NOT_DIAMOND_API_KEY"), # This is the default and can be omitted
82-
# defaults to "production".
83-
environment="staging",
8483
)
8584

8685

8786
async def main() -> None:
88-
response = await client.routing.select_model(
87+
response = await client.model_router.select_model(
8988
llm_providers=[
9089
{
9190
"model": "gpt-4o",
@@ -126,8 +125,8 @@ By default, the async client uses `httpx` for HTTP requests. However, for improv
126125
You can enable this by installing `aiohttp`:
127126

128127
```sh
129-
# install from PyPI
130-
pip install --pre notdiamond[aiohttp]
128+
# install from the production repo
129+
pip install 'not_diamond[aiohttp] @ git+ssh://git@github.com/Not-Diamond/not-diamond-python.git'
131130
```
132131

133132
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
@@ -143,7 +142,7 @@ async def main() -> None:
143142
api_key="My API Key",
144143
http_client=DefaultAioHttpClient(),
145144
) as client:
146-
response = await client.routing.select_model(
145+
response = await client.model_router.select_model(
147146
llm_providers=[
148147
{
149148
"model": "gpt-4o",
@@ -193,26 +192,15 @@ from not_diamond import NotDiamond
193192

194193
client = NotDiamond()
195194

196-
response = client.prompt_adaptation.adapt(
197-
fields=["question"],
198-
system_prompt="You are a helpful assistant that answers questions accurately.",
199-
target_models=[
200-
{
201-
"model": "claude-sonnet-4-5-20250929",
202-
"provider": "anthropic",
203-
},
204-
{
205-
"model": "gemini-1.5-pro",
206-
"provider": "google",
207-
},
208-
],
209-
template="Question: {question}\nAnswer:",
210-
origin_model={
195+
response = client.report.metrics.submit_feedback(
196+
feedback={"accuracy": "bar"},
197+
provider={
211198
"model": "gpt-4o",
212199
"provider": "openai",
213200
},
201+
session_id="550e8400-e29b-41d4-a716-446655440000",
214202
)
215-
print(response.origin_model)
203+
print(response.provider)
216204
```
217205

218206
## File uploads
@@ -225,7 +213,7 @@ from not_diamond import NotDiamond
225213

226214
client = NotDiamond()
227215

228-
client.routing.create_survey_response(
216+
client.pzn.submit_survey_response(
229217
constraint_priorities="constraint_priorities",
230218
email="email",
231219
llm_providers="llm_providers",
@@ -254,7 +242,7 @@ from not_diamond import NotDiamond
254242
client = NotDiamond()
255243

256244
try:
257-
client.routing.select_model(
245+
client.model_router.select_model(
258246
llm_providers=[
259247
{
260248
"model": "gpt-4o",
@@ -322,7 +310,7 @@ client = NotDiamond(
322310
)
323311

324312
# Or, configure per-request:
325-
client.with_options(max_retries=5).routing.select_model(
313+
client.with_options(max_retries=5).model_router.select_model(
326314
llm_providers=[
327315
{
328316
"model": "gpt-4o",
@@ -370,7 +358,7 @@ client = NotDiamond(
370358
)
371359

372360
# Override per-request:
373-
client.with_options(timeout=5.0).routing.select_model(
361+
client.with_options(timeout=5.0).model_router.select_model(
374362
llm_providers=[
375363
{
376364
"model": "gpt-4o",
@@ -436,7 +424,7 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
436424
from not_diamond import NotDiamond
437425

438426
client = NotDiamond()
439-
response = client.routing.with_raw_response.select_model(
427+
response = client.model_router.with_raw_response.select_model(
440428
llm_providers=[{
441429
"model": "gpt-4o",
442430
"provider": "openai",
@@ -457,8 +445,8 @@ response = client.routing.with_raw_response.select_model(
457445
)
458446
print(response.headers.get('X-My-Header'))
459447

460-
routing = response.parse() # get the object that `routing.select_model()` would have returned
461-
print(routing.providers)
448+
model_router = response.parse() # get the object that `model_router.select_model()` would have returned
449+
print(model_router.providers)
462450
```
463451

464452
These methods return an [`APIResponse`](https://github.com/Not-Diamond/not-diamond-python/tree/main/src/not_diamond/_response.py) object.
@@ -472,7 +460,7 @@ The above interface eagerly reads the full response body when you make the reque
472460
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
473461

474462
```python
475-
with client.routing.with_streaming_response.select_model(
463+
with client.model_router.with_streaming_response.select_model(
476464
llm_providers=[
477465
{
478466
"model": "gpt-4o",

SECURITY.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ before making any information public.
1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
1919
or products provided by Not Diamond, please follow the respective company's security reporting guidelines.
2020

21-
### Not Diamond Terms and Policies
22-
23-
Please contact d6@notdiamond.ai for any questions or concerns regarding the security of our services.
24-
2521
---
2622

2723
Thank you for helping us keep the SDKs and systems they interact with secure.

api.md

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,95 @@
1-
# Routing
1+
# ModelRouter
22

33
Types:
44

55
```python
6-
from not_diamond.types import RoutingSelectModelResponse, RoutingTrainCustomRouterResponse
6+
from not_diamond.types import ModelRouterSelectModelResponse
77
```
88

99
Methods:
1010

11-
- <code title="post /v2/pzn/surveyResponse">client.routing.<a href="./src/not_diamond/resources/routing.py">create_survey_response</a>(\*\*<a href="src/not_diamond/types/routing_create_survey_response_params.py">params</a>) -> object</code>
12-
- <code title="post /v2/modelRouter/modelSelect">client.routing.<a href="./src/not_diamond/resources/routing.py">select_model</a>(\*\*<a href="src/not_diamond/types/routing_select_model_params.py">params</a>) -> <a href="./src/not_diamond/types/routing_select_model_response.py">RoutingSelectModelResponse</a></code>
13-
- <code title="post /v2/pzn/trainCustomRouter">client.routing.<a href="./src/not_diamond/resources/routing.py">train_custom_router</a>(\*\*<a href="src/not_diamond/types/routing_train_custom_router_params.py">params</a>) -> <a href="./src/not_diamond/types/routing_train_custom_router_response.py">RoutingTrainCustomRouterResponse</a></code>
11+
- <code title="post /v2/modelRouter/openHandsRouter">client.model_router.<a href="./src/not_diamond/resources/model_router.py">open_hands_select</a>(\*\*<a href="src/not_diamond/types/model_router_open_hands_select_params.py">params</a>) -> object</code>
12+
- <code title="post /v2/modelRouter/modelSelect">client.model_router.<a href="./src/not_diamond/resources/model_router.py">select_model</a>(\*\*<a href="src/not_diamond/types/model_router_select_model_params.py">params</a>) -> <a href="./src/not_diamond/types/model_router_select_model_response.py">ModelRouterSelectModelResponse</a></code>
13+
14+
# Report
15+
16+
## Metrics
17+
18+
Types:
19+
20+
```python
21+
from not_diamond.types.report import MetricSubmitFeedbackResponse
22+
```
23+
24+
Methods:
25+
26+
- <code title="post /v2/report/metrics/feedback">client.report.metrics.<a href="./src/not_diamond/resources/report/metrics.py">submit_feedback</a>(\*\*<a href="src/not_diamond/types/report/metric_submit_feedback_params.py">params</a>) -> <a href="./src/not_diamond/types/report/metric_submit_feedback_response.py">MetricSubmitFeedbackResponse</a></code>
1427

1528
# Preferences
1629

1730
Types:
1831

1932
```python
20-
from not_diamond.types import PreferenceCreateUserPreferenceResponse
33+
from not_diamond.types import PreferenceCreateResponse
2134
```
2235

2336
Methods:
2437

25-
- <code title="get /v2/preferences/{user_id}/{preference_id}">client.preferences.<a href="./src/not_diamond/resources/preferences.py">retrieve</a>(preference_id, \*, user_id) -> object</code>
26-
- <code title="post /v2/preferences/userPreferenceCreate">client.preferences.<a href="./src/not_diamond/resources/preferences.py">create_user_preference</a>(\*\*<a href="src/not_diamond/types/preference_create_user_preference_params.py">params</a>) -> <a href="./src/not_diamond/types/preference_create_user_preference_response.py">PreferenceCreateUserPreferenceResponse</a></code>
27-
- <code title="delete /v2/preferences/userPreferenceDelete/{preference_id}">client.preferences.<a href="./src/not_diamond/resources/preferences.py">delete_user_preference</a>(preference_id) -> object</code>
28-
- <code title="put /v2/preferences/userPreferenceUpdate">client.preferences.<a href="./src/not_diamond/resources/preferences.py">update_user_preference</a>(\*\*<a href="src/not_diamond/types/preference_update_user_preference_params.py">params</a>) -> object</code>
38+
- <code title="post /v2/preferences/userPreferenceCreate">client.preferences.<a href="./src/not_diamond/resources/preferences.py">create</a>(\*\*<a href="src/not_diamond/types/preference_create_params.py">params</a>) -> <a href="./src/not_diamond/types/preference_create_response.py">PreferenceCreateResponse</a></code>
39+
- <code title="get /v2/preferences/{user_id}">client.preferences.<a href="./src/not_diamond/resources/preferences.py">retrieve</a>(user_id) -> object</code>
40+
- <code title="put /v2/preferences/userPreferenceUpdate">client.preferences.<a href="./src/not_diamond/resources/preferences.py">update</a>(\*\*<a href="src/not_diamond/types/preference_update_params.py">params</a>) -> object</code>
41+
- <code title="delete /v2/preferences/userPreferenceDelete/{preference_id}">client.preferences.<a href="./src/not_diamond/resources/preferences.py">delete</a>(preference_id) -> object</code>
2942

30-
# PromptAdaptation
43+
# Prompt
3144

3245
Types:
3346

3447
```python
35-
from not_diamond.types import (
36-
AdaptationRunResults,
37-
JobStatus,
38-
PromptAdaptationAdaptResponse,
39-
PromptAdaptationGetAdaptRunsResponse,
40-
PromptAdaptationGetAdaptStatusResponse,
41-
PromptAdaptationRetrieveCostsResponse,
48+
from not_diamond.types import JobStatus, PromptGetAdaptResultsResponse, PromptGetAdaptStatusResponse
49+
```
50+
51+
Methods:
52+
53+
- <code title="get /v2/prompt/adaptResults/{adaptation_run_id}">client.prompt.<a href="./src/not_diamond/resources/prompt/prompt.py">get_adapt_results</a>(adaptation_run_id) -> <a href="./src/not_diamond/types/prompt_get_adapt_results_response.py">PromptGetAdaptResultsResponse</a></code>
54+
- <code title="get /v2/prompt/adaptStatus/{adaptation_run_id}">client.prompt.<a href="./src/not_diamond/resources/prompt/prompt.py">get_adapt_status</a>(adaptation_run_id) -> <a href="./src/not_diamond/types/prompt_get_adapt_status_response.py">PromptGetAdaptStatusResponse</a></code>
55+
56+
## Adapt
57+
58+
Types:
59+
60+
```python
61+
from not_diamond.types.prompt import (
62+
GoldenRecord,
63+
RequestProvider,
64+
AdaptCreateResponse,
65+
AdaptGetCostsResponse,
4266
)
4367
```
4468

4569
Methods:
4670

47-
- <code title="post /v2/prompt/adapt">client.prompt_adaptation.<a href="./src/not_diamond/resources/prompt_adaptation.py">adapt</a>(\*\*<a href="src/not_diamond/types/prompt_adaptation_adapt_params.py">params</a>) -> <a href="./src/not_diamond/types/prompt_adaptation_adapt_response.py">PromptAdaptationAdaptResponse</a></code>
48-
- <code title="get /v2/prompt/adaptResults/{adaptation_run_id}">client.prompt_adaptation.<a href="./src/not_diamond/resources/prompt_adaptation.py">get_adapt_results</a>(adaptation_run_id) -> <a href="./src/not_diamond/types/adaptation_run_results.py">AdaptationRunResults</a></code>
49-
- <code title="get /v2/prompt/frontendAdaptRunResults/{user_id}/{adaptation_run_id}">client.prompt_adaptation.<a href="./src/not_diamond/resources/prompt_adaptation.py">get_adapt_run_results</a>(adaptation_run_id, \*, user_id) -> <a href="./src/not_diamond/types/adaptation_run_results.py">AdaptationRunResults</a></code>
50-
- <code title="get /v2/prompt/frontendAdaptRuns/{user_id}">client.prompt_adaptation.<a href="./src/not_diamond/resources/prompt_adaptation.py">get_adapt_runs</a>(user_id) -> <a href="./src/not_diamond/types/prompt_adaptation_get_adapt_runs_response.py">PromptAdaptationGetAdaptRunsResponse</a></code>
51-
- <code title="get /v2/prompt/adaptStatus/{adaptation_run_id}">client.prompt_adaptation.<a href="./src/not_diamond/resources/prompt_adaptation.py">get_adapt_status</a>(adaptation_run_id) -> <a href="./src/not_diamond/types/prompt_adaptation_get_adapt_status_response.py">PromptAdaptationGetAdaptStatusResponse</a></code>
52-
- <code title="get /v1/adaptation-runs/{adaptation_run_id}/costs">client.prompt_adaptation.<a href="./src/not_diamond/resources/prompt_adaptation.py">retrieve_costs</a>(adaptation_run_id) -> <a href="./src/not_diamond/types/prompt_adaptation_retrieve_costs_response.py">PromptAdaptationRetrieveCostsResponse</a></code>
71+
- <code title="post /v2/prompt/adapt">client.prompt.adapt.<a href="./src/not_diamond/resources/prompt/adapt.py">create</a>(\*\*<a href="src/not_diamond/types/prompt/adapt_create_params.py">params</a>) -> <a href="./src/not_diamond/types/prompt/adapt_create_response.py">AdaptCreateResponse</a></code>
72+
- <code title="get /v2/prompt/adapt/{adaptation_run_id}/costs">client.prompt.adapt.<a href="./src/not_diamond/resources/prompt/adapt.py">get_costs</a>(adaptation_run_id) -> <a href="./src/not_diamond/types/prompt/adapt_get_costs_response.py">AdaptGetCostsResponse</a></code>
5373

54-
# Report
74+
# Pzn
5575

5676
Types:
5777

5878
```python
59-
from not_diamond.types import ReportSubmitFeedbackResponse
79+
from not_diamond.types import PznTrainCustomRouterResponse
6080
```
6181

6282
Methods:
6383

64-
- <code title="post /v2/report/hallucination">client.report.<a href="./src/not_diamond/resources/report.py">evaluate_hallucination</a>(\*\*<a href="src/not_diamond/types/report_evaluate_hallucination_params.py">params</a>) -> object</code>
65-
- <code title="post /v2/report/metrics/latency">client.report.<a href="./src/not_diamond/resources/report.py">latency</a>(\*\*<a href="src/not_diamond/types/report_latency_params.py">params</a>) -> object</code>
66-
- <code title="post /v2/report/metrics/feedback">client.report.<a href="./src/not_diamond/resources/report.py">submit_feedback</a>(\*\*<a href="src/not_diamond/types/report_submit_feedback_params.py">params</a>) -> <a href="./src/not_diamond/types/report_submit_feedback_response.py">ReportSubmitFeedbackResponse</a></code>
84+
- <code title="post /v2/pzn/surveyResponse">client.pzn.<a href="./src/not_diamond/resources/pzn.py">submit_survey_response</a>(\*\*<a href="src/not_diamond/types/pzn_submit_survey_response_params.py">params</a>) -> object</code>
85+
- <code title="post /v2/pzn/trainCustomRouter">client.pzn.<a href="./src/not_diamond/resources/pzn.py">train_custom_router</a>(\*\*<a href="src/not_diamond/types/pzn_train_custom_router_params.py">params</a>) -> <a href="./src/not_diamond/types/pzn_train_custom_router_response.py">PznTrainCustomRouterResponse</a></code>
6786

6887
# Models
6988

7089
Types:
7190

7291
```python
73-
from not_diamond.types import ModelListResponse
92+
from not_diamond.types import Model, ModelListResponse
7493
```
7594

7695
Methods:

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
2-
name = "notdiamond"
3-
version = "1.0.0-rc2"
2+
name = "not_diamond"
3+
version = "1.0.0-rc3"
44
description = "The official Python library for the not-diamond API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
77
authors = [
8-
{ name = "Not Diamond", email = "d6@notdiamond.ai" },
8+
{ name = "Not Diamond", email = "" },
99
]
1010
dependencies = [
1111
"httpx>=0.23.0, <1",

0 commit comments

Comments
 (0)