Skip to content

Commit 4b015f3

Browse files
authored
Merge pull request #3 from Not-Diamond/release-please--branches--main--changes--next
release: 0.3.0
2 parents a12b1cd + c3581e1 commit 4b015f3

71 files changed

Lines changed: 5778 additions & 4658 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-
".": "0.2.0"
2+
".": "0.3.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 20
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/not-diamond-dragos199993%2Fnot-diamond-16cbc3880d2b786cefa8c80a6dd1129791483c0b487955104c68a5c13f00a69b.yml
3-
openapi_spec_hash: 4c16e5753f4b9e0a20dd01706c5d07d7
4-
config_hash: 36de232224f15ed78970b28252ccf625
1+
configured_endpoints: 17
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/not-diamond-dragos199993%2Fnot-diamond-76d84ad8b4d68f7470a24f0f938d10318ecc1f16b86ca654c1644065c13e413a.yml
3+
openapi_spec_hash: 92030c9eb965278da586919e9c7375b3
4+
config_hash: 0dbf3c6b30eede76ffb01f86b59ac672

CHANGELOG.md

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

3+
## 0.3.0 (2025-10-24)
4+
5+
Full Changelog: [v0.2.0...v0.3.0](https://github.com/Not-Diamond/not-diamond-python/compare/v0.2.0...v0.3.0)
6+
7+
### Features
8+
9+
* **api:** api update ([d403264](https://github.com/Not-Diamond/not-diamond-python/commit/d4032647605736f1c51d04023d3adb24f448737f))
10+
* **api:** api update ([c7a1198](https://github.com/Not-Diamond/not-diamond-python/commit/c7a1198c1432e833b740f92df9996379f941228f))
11+
* **api:** api update ([9265a0a](https://github.com/Not-Diamond/not-diamond-python/commit/9265a0a3959818b06f157726e68d3c73f7f5d9c9))
12+
* **api:** api update ([880c195](https://github.com/Not-Diamond/not-diamond-python/commit/880c195dc41ac5e500cae9b9a71b0840f97e7556))
13+
* **api:** exclude non sdk endpoints ([fb04bc4](https://github.com/Not-Diamond/not-diamond-python/commit/fb04bc460d7f9f7f191cffcb56868d09fa45edc1))
14+
* **api:** fix missing endpoint ([427d1d3](https://github.com/Not-Diamond/not-diamond-python/commit/427d1d3bdd7be290e66897aa35daba984931e4a4))
15+
* **api:** manual updates ([603c1b7](https://github.com/Not-Diamond/not-diamond-python/commit/603c1b74c64850e1fd8a89e08b1d66d0665188e0))
16+
* **api:** manual updates ([42fb39e](https://github.com/Not-Diamond/not-diamond-python/commit/42fb39e0978aa329f4b5171ff54aaab257558135))
17+
* **api:** report group ([4312188](https://github.com/Not-Diamond/not-diamond-python/commit/43121880104978fa2b88a3ad0e85070a2b322787))
18+
19+
20+
### Chores
21+
22+
* bump `httpx-aiohttp` version to 0.1.9 ([37d5de2](https://github.com/Not-Diamond/not-diamond-python/commit/37d5de2162ece6024539d9e546dd2679ba5e1882))
23+
* **internal:** detect missing future annotations with ruff ([316a749](https://github.com/Not-Diamond/not-diamond-python/commit/316a7493d166e631eafcc888d377dbe340178b24))
24+
325
## 0.2.0 (2025-10-09)
426

527
Full Changelog: [v0.1.0...v0.2.0](https://github.com/Not-Diamond/not-diamond-python/compare/v0.1.0...v0.2.0)

README.md

Lines changed: 81 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,20 @@ pip install git+ssh://git@github.com/Not-Diamond/not-diamond-python.git
2828
The full API of this library can be found in [api.md](api.md).
2929

3030
```python
31+
import os
3132
from not_diamond import NotDiamond
3233

33-
client = NotDiamond()
34+
client = NotDiamond(
35+
api_key=os.environ.get("NOT_DIAMOND_API_KEY"), # This is the default and can be omitted
36+
)
3437

35-
response = client.model_router.select_model(
36-
llm_providers=[
37-
{
38-
"model": "model",
39-
"provider": "provider",
40-
}
41-
],
42-
messages=[{"foo": "string"}],
38+
response = client.router.create_survey_response(
39+
constraint_priorities="constraint_priorities",
40+
email="email",
41+
llm_providers="llm_providers",
42+
use_case_desc="use_case_desc",
43+
user_id="user_id",
44+
x_token="x-token",
4345
)
4446
```
4547

@@ -53,21 +55,23 @@ so that your API Key is not stored in source control.
5355
Simply import `AsyncNotDiamond` instead of `NotDiamond` and use `await` with each API call:
5456

5557
```python
58+
import os
5659
import asyncio
5760
from not_diamond import AsyncNotDiamond
5861

59-
client = AsyncNotDiamond()
62+
client = AsyncNotDiamond(
63+
api_key=os.environ.get("NOT_DIAMOND_API_KEY"), # This is the default and can be omitted
64+
)
6065

6166

6267
async def main() -> None:
63-
response = await client.model_router.select_model(
64-
llm_providers=[
65-
{
66-
"model": "model",
67-
"provider": "provider",
68-
}
69-
],
70-
messages=[{"foo": "string"}],
68+
response = await client.router.create_survey_response(
69+
constraint_priorities="constraint_priorities",
70+
email="email",
71+
llm_providers="llm_providers",
72+
use_case_desc="use_case_desc",
73+
user_id="user_id",
74+
x_token="x-token",
7175
)
7276

7377

@@ -97,16 +101,16 @@ from not_diamond import AsyncNotDiamond
97101

98102
async def main() -> None:
99103
async with AsyncNotDiamond(
104+
api_key="My API Key",
100105
http_client=DefaultAioHttpClient(),
101106
) as client:
102-
response = await client.model_router.select_model(
103-
llm_providers=[
104-
{
105-
"model": "model",
106-
"provider": "provider",
107-
}
108-
],
109-
messages=[{"foo": "string"}],
107+
response = await client.router.create_survey_response(
108+
constraint_priorities="constraint_priorities",
109+
email="email",
110+
llm_providers="llm_providers",
111+
use_case_desc="use_case_desc",
112+
user_id="user_id",
113+
x_token="x-token",
110114
)
111115

112116

@@ -131,21 +135,24 @@ from not_diamond import NotDiamond
131135

132136
client = NotDiamond()
133137

134-
response = client.prompt.adapt(
135-
fields=["string"],
136-
goldens=[{"fields": {"foo": "string"}}],
138+
response = client.prompt_adaptation.adapt(
139+
fields=["question"],
137140
origin_model={
138-
"model": "model",
139-
"provider": "provider",
141+
"model": "gpt-4o",
142+
"provider": "openai",
140143
},
141-
system_prompt="system_prompt",
144+
system_prompt="You are a helpful assistant that answers questions accurately.",
142145
target_models=[
143146
{
144-
"model": "model",
145-
"provider": "provider",
146-
}
147+
"model": "claude-3-5-sonnet-20241022",
148+
"provider": "anthropic",
149+
},
150+
{
151+
"model": "gemini-1.5-pro",
152+
"provider": "google",
153+
},
147154
],
148-
template="template",
155+
template="Question: {question}\nAnswer:",
149156
)
150157
print(response.origin_model)
151158
```
@@ -160,7 +167,7 @@ from not_diamond import NotDiamond
160167

161168
client = NotDiamond()
162169

163-
client.pzn.create_survey_response(
170+
client.router.create_survey_response(
164171
constraint_priorities="constraint_priorities",
165172
email="email",
166173
llm_providers="llm_providers",
@@ -189,14 +196,13 @@ from not_diamond import NotDiamond
189196
client = NotDiamond()
190197

191198
try:
192-
client.model_router.select_model(
193-
llm_providers=[
194-
{
195-
"model": "model",
196-
"provider": "provider",
197-
}
198-
],
199-
messages=[{"foo": "string"}],
199+
client.router.create_survey_response(
200+
constraint_priorities="constraint_priorities",
201+
email="email",
202+
llm_providers="llm_providers",
203+
use_case_desc="use_case_desc",
204+
user_id="user_id",
205+
x_token="x-token",
200206
)
201207
except not_diamond.APIConnectionError as e:
202208
print("The server could not be reached")
@@ -240,14 +246,13 @@ client = NotDiamond(
240246
)
241247

242248
# Or, configure per-request:
243-
client.with_options(max_retries=5).model_router.select_model(
244-
llm_providers=[
245-
{
246-
"model": "model",
247-
"provider": "provider",
248-
}
249-
],
250-
messages=[{"foo": "string"}],
249+
client.with_options(max_retries=5).router.create_survey_response(
250+
constraint_priorities="constraint_priorities",
251+
email="email",
252+
llm_providers="llm_providers",
253+
use_case_desc="use_case_desc",
254+
user_id="user_id",
255+
x_token="x-token",
251256
)
252257
```
253258

@@ -271,14 +276,13 @@ client = NotDiamond(
271276
)
272277

273278
# Override per-request:
274-
client.with_options(timeout=5.0).model_router.select_model(
275-
llm_providers=[
276-
{
277-
"model": "model",
278-
"provider": "provider",
279-
}
280-
],
281-
messages=[{"foo": "string"}],
279+
client.with_options(timeout=5.0).router.create_survey_response(
280+
constraint_priorities="constraint_priorities",
281+
email="email",
282+
llm_providers="llm_providers",
283+
use_case_desc="use_case_desc",
284+
user_id="user_id",
285+
x_token="x-token",
282286
)
283287
```
284288

@@ -320,19 +324,18 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
320324
from not_diamond import NotDiamond
321325

322326
client = NotDiamond()
323-
response = client.model_router.with_raw_response.select_model(
324-
llm_providers=[{
325-
"model": "model",
326-
"provider": "provider",
327-
}],
328-
messages=[{
329-
"foo": "string"
330-
}],
327+
response = client.router.with_raw_response.create_survey_response(
328+
constraint_priorities="constraint_priorities",
329+
email="email",
330+
llm_providers="llm_providers",
331+
use_case_desc="use_case_desc",
332+
user_id="user_id",
333+
x_token="x-token",
331334
)
332335
print(response.headers.get('X-My-Header'))
333336

334-
model_router = response.parse() # get the object that `model_router.select_model()` would have returned
335-
print(model_router)
337+
router = response.parse() # get the object that `router.create_survey_response()` would have returned
338+
print(router)
336339
```
337340

338341
These methods return an [`APIResponse`](https://github.com/Not-Diamond/not-diamond-python/tree/main/src/not_diamond/_response.py) object.
@@ -346,14 +349,13 @@ The above interface eagerly reads the full response body when you make the reque
346349
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.
347350

348351
```python
349-
with client.model_router.with_streaming_response.select_model(
350-
llm_providers=[
351-
{
352-
"model": "model",
353-
"provider": "provider",
354-
}
355-
],
356-
messages=[{"foo": "string"}],
352+
with client.router.with_streaming_response.create_survey_response(
353+
constraint_priorities="constraint_priorities",
354+
email="email",
355+
llm_providers="llm_providers",
356+
use_case_desc="use_case_desc",
357+
user_id="user_id",
358+
x_token="x-token",
357359
) as response:
358360
print(response.headers.get("X-My-Header"))
359361

0 commit comments

Comments
 (0)