notdiamond 2.0.0-rc10 → 2.0.0-rc13
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.
- package/CHANGELOG.md +27 -0
- package/LICENSE +1 -1
- package/README.md +61 -171
- package/client.d.mts +11 -11
- package/client.d.mts.map +1 -1
- package/client.d.ts +11 -11
- package/client.d.ts.map +1 -1
- package/client.js +38 -38
- package/client.js.map +1 -1
- package/client.mjs +36 -36
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts +2 -2
- package/core/api-promise.d.ts +2 -2
- package/core/error.d.mts +2 -2
- package/core/error.d.ts +2 -2
- package/core/error.js +4 -4
- package/core/error.mjs +2 -2
- package/core/resource.d.mts +3 -3
- package/core/resource.d.ts +3 -3
- package/index.d.mts +3 -3
- package/index.d.ts +3 -3
- package/index.js +4 -4
- package/index.mjs +3 -3
- package/internal/parse.d.mts +2 -2
- package/internal/parse.d.ts +2 -2
- package/internal/shims.js +1 -1
- package/internal/shims.mjs +1 -1
- package/internal/uploads.d.mts +4 -4
- package/internal/uploads.d.ts +4 -4
- package/internal/utils/base64.js +2 -2
- package/internal/utils/base64.mjs +3 -3
- package/internal/utils/log.d.mts +3 -3
- package/internal/utils/log.d.ts +3 -3
- package/internal/utils/path.js +1 -1
- package/internal/utils/path.mjs +2 -2
- package/internal/utils/values.js +5 -5
- package/internal/utils/values.mjs +6 -6
- package/package.json +3 -3
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/prompt-adaptation.d.mts +5 -5
- package/resources/prompt-adaptation.d.mts.map +1 -1
- package/resources/prompt-adaptation.d.ts +5 -5
- package/resources/prompt-adaptation.d.ts.map +1 -1
- package/resources/prompt-adaptation.js +2 -2
- package/resources/prompt-adaptation.js.map +1 -1
- package/resources/prompt-adaptation.mjs +2 -2
- package/resources/prompt-adaptation.mjs.map +1 -1
- package/src/client.ts +24 -24
- package/src/core/api-promise.ts +4 -4
- package/src/core/error.ts +2 -2
- package/src/core/resource.ts +3 -3
- package/src/index.ts +3 -3
- package/src/internal/parse.ts +2 -2
- package/src/internal/shims.ts +1 -1
- package/src/internal/uploads.ts +5 -5
- package/src/internal/utils/base64.ts +3 -3
- package/src/internal/utils/log.ts +3 -3
- package/src/internal/utils/path.ts +2 -2
- package/src/internal/utils/values.ts +6 -6
- package/src/resources/index.ts +2 -2
- package/src/resources/prompt-adaptation.ts +8 -8
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc13 (2025-11-13)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v2.0.0-rc11...v2.0.0-rc13](https://github.com/Not-Diamond/not-diamond-typescript/compare/v2.0.0-rc11...v2.0.0-rc13)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** manual updates ([39f6d64](https://github.com/Not-Diamond/not-diamond-typescript/commit/39f6d6412feea4853877ef81660b3b4bb1b8fce1))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
* update README to reflect changes in prompt adaptation details and API key naming convention ([664607c](https://github.com/Not-Diamond/not-diamond-typescript/commit/664607c23a691c96d8f9e7884a464fe5788d03ca))
|
|
15
|
+
* update README to remove Prompt Adaptation section and add Train Custom Router section with usage examples ([f568d40](https://github.com/Not-Diamond/not-diamond-typescript/commit/f568d406342742092a8f512373335764611005e4))
|
|
16
|
+
|
|
17
|
+
## 2.0.0-rc11 (2025-11-12)
|
|
18
|
+
|
|
19
|
+
Full Changelog: [v2.0.0-rc10...v2.0.0-rc11](https://github.com/Not-Diamond/not-diamond-typescript/compare/v2.0.0-rc10...v2.0.0-rc11)
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **api:** changed name ([26dafc9](https://github.com/Not-Diamond/not-diamond-typescript/commit/26dafc922b42ae9d95c010c38227360bde6759ce))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Chores
|
|
27
|
+
|
|
28
|
+
* **internal:** codegen related update ([8c6c957](https://github.com/Not-Diamond/not-diamond-typescript/commit/8c6c957834274d394960ac66d782547bdc7dd856))
|
|
29
|
+
|
|
3
30
|
## 2.0.0-rc10 (2025-11-10)
|
|
4
31
|
|
|
5
32
|
Full Changelog: [v2.0.0-rc9...v2.0.0-rc10](https://github.com/Not-Diamond/not-diamond-typescript/compare/v2.0.0-rc9...v2.0.0-rc10)
|
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright 2025
|
|
189
|
+
Copyright 2025 Notdiamond
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Notdiamond TypeScript API Library
|
|
2
2
|
|
|
3
3
|
[>)](https://npmjs.org/package/notdiamond) 
|
|
4
4
|
|
|
5
|
-
This library provides convenient access to the
|
|
5
|
+
This library provides convenient access to the Notdiamond REST API from server-side TypeScript or JavaScript.
|
|
6
6
|
|
|
7
7
|
The library includes type definitions for all request params and response fields.
|
|
8
8
|
|
|
9
|
-
It is generated with [Stainless](https://www.stainless.com/).
|
|
10
|
-
|
|
11
9
|
## What is Prompt Adaptation?
|
|
12
10
|
|
|
13
|
-
Not Diamond specializes in **Prompt Adaptation** - automatically optimizing your prompts to work optimally across different LLMs. Each language model has unique characteristics, instruction-following patterns, and preferred prompt formats. A prompt that works perfectly for GPT-
|
|
14
|
-
|
|
15
|
-
**The Problem**: Manually rewriting prompts for each model is time-consuming and requires deep expertise in each model's quirks.
|
|
11
|
+
Not Diamond specializes in **Prompt Adaptation** - automatically optimizing your prompts to work optimally across different LLMs. Each language model has unique characteristics, instruction-following patterns, and preferred prompt formats. A prompt that works perfectly for GPT-5 might perform poorly on Claude or Gemini.
|
|
12
|
+
Manually rewriting prompts for each model is time-consuming and requires deep expertise in each model's quirks.
|
|
16
13
|
|
|
17
|
-
**The Solution**: Not Diamond automatically adapts your prompts
|
|
14
|
+
**The Solution**: Not Diamond automatically adapts your prompts with:
|
|
18
15
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
16
|
+
- Automatic optimization of both system and user prompts
|
|
17
|
+
- Built-in evaluation metrics
|
|
18
|
+
- Minimum 25 training examples recommended
|
|
19
|
+
- Processing time: typically 10–30 minutes
|
|
23
20
|
|
|
24
21
|
## Documentation
|
|
25
22
|
|
|
@@ -33,18 +30,15 @@ npm install notdiamond
|
|
|
33
30
|
|
|
34
31
|
## Usage
|
|
35
32
|
|
|
36
|
-
### Prompt Adaptation
|
|
37
|
-
|
|
38
|
-
Automatically optimize your prompts to work better across different language models. Each model has unique characteristics and preferences - what works well for GPT-4 might not work as well for Claude or Gemini. Prompt Adaptation helps you get optimal performance from each model.
|
|
39
|
-
|
|
40
33
|
#### Quick Start
|
|
41
34
|
|
|
42
35
|
<!-- prettier-ignore -->
|
|
36
|
+
|
|
43
37
|
```ts
|
|
44
38
|
import NotDiamond from 'notdiamond';
|
|
45
39
|
|
|
46
|
-
const client = new
|
|
47
|
-
apiKey: process.env['
|
|
40
|
+
const client = new Notdiamond({
|
|
41
|
+
apiKey: process.env['NOTDIAMOND_API_KEY'], // This is the default and can be omitted
|
|
48
42
|
});
|
|
49
43
|
|
|
50
44
|
// Step 1: Start a prompt adaptation job
|
|
@@ -115,39 +109,20 @@ if (status.status === 'completed') {
|
|
|
115
109
|
}
|
|
116
110
|
```
|
|
117
111
|
|
|
118
|
-
#### Key Features
|
|
119
|
-
|
|
120
|
-
- **Automatic Optimization**: Adapts both system prompts and user message templates
|
|
121
|
-
- **Evaluation Metrics**: Choose from standard metrics (semantic similarity, JSON matching, SQL) or provide custom evaluation
|
|
122
|
-
- **Dataset Requirements**: Minimum 25 training examples (more examples = better results)
|
|
123
|
-
- **Processing Time**: Typically 10-30 minutes depending on dataset size and number of target models
|
|
124
|
-
- **Subscription Tiers**: Support for 1-10 target models depending on your plan
|
|
125
|
-
|
|
126
|
-
#### Evaluation Metrics
|
|
127
|
-
|
|
128
|
-
Choose from standard metrics:
|
|
129
|
-
|
|
130
|
-
- `LLMaaJ:Sem_Sim_1`, `LLMaaJ:Sem_Sim_3`, `LLMaaJ:Sem_Sim_10` - Semantic similarity
|
|
131
|
-
- `LLMaaJ:SQL` - SQL query validation
|
|
132
|
-
- `JSON_Match` - JSON structure matching
|
|
133
|
-
|
|
134
|
-
Or provide custom evaluation configuration with your own LLM judge.
|
|
135
|
-
|
|
136
|
-
#### Best Practices
|
|
137
|
-
|
|
138
|
-
1. **Use Representative Examples**: Include diverse examples from your production workload
|
|
139
|
-
2. **Sufficient Dataset Size**: Use at least 25 training examples (50+ recommended)
|
|
140
|
-
3. **Train/Test Split**: Separate train_goldens and test_goldens for proper validation
|
|
141
|
-
4. **A/B Test Results**: Validate optimized prompts in production before full deployment
|
|
142
|
-
|
|
143
112
|
For more details, see the [Prompt Adaptation documentation](https://docs.notdiamond.ai/docs/adapting-prompts-to-new-models).
|
|
144
113
|
|
|
145
114
|
### Model Routing
|
|
146
115
|
|
|
147
|
-
|
|
116
|
+
Select the best model automatically:
|
|
148
117
|
|
|
149
118
|
<!-- prettier-ignore -->
|
|
150
119
|
```ts
|
|
120
|
+
import NotDiamond from 'notdiamond';
|
|
121
|
+
|
|
122
|
+
const client = new NotDiamond({
|
|
123
|
+
apiKey: process.env['NOTDIAMOND_API_KEY'], // This is the default and can be omitted
|
|
124
|
+
});
|
|
125
|
+
|
|
151
126
|
const response = await client.modelRouter.selectModel({
|
|
152
127
|
llm_providers: [
|
|
153
128
|
{ model: 'gpt-4o', provider: 'openai' },
|
|
@@ -163,16 +138,37 @@ const response = await client.modelRouter.selectModel({
|
|
|
163
138
|
console.log(response.providers);
|
|
164
139
|
```
|
|
165
140
|
|
|
141
|
+
### Train Custom Router
|
|
142
|
+
|
|
143
|
+
For even better performance, you can train a custom router on your own dataset. This allows the router to learn the specific patterns and preferences of your use case:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import fs from 'fs';
|
|
147
|
+
import NotDiamond from 'notdiamond';
|
|
148
|
+
|
|
149
|
+
const client = new NotDiamond({
|
|
150
|
+
apiKey: process.env['NOTDIAMOND_API_KEY'], // This is the default and can be omitted
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
await client.pzn.trainCustomRouter({
|
|
154
|
+
dataset_file: fs.createReadStream('/path/to/file'),
|
|
155
|
+
language: 'english',
|
|
156
|
+
llm_providers:
|
|
157
|
+
'[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}]',
|
|
158
|
+
maximize: true,
|
|
159
|
+
prompt_column: 'prompt',
|
|
160
|
+
});
|
|
161
|
+
|
|
166
162
|
### Request & Response types
|
|
167
163
|
|
|
168
164
|
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
|
169
165
|
|
|
170
166
|
<!-- prettier-ignore -->
|
|
171
167
|
```ts
|
|
172
|
-
import
|
|
168
|
+
import Notdiamond from 'notdiamond';
|
|
173
169
|
|
|
174
|
-
const client = new
|
|
175
|
-
apiKey: process.env['
|
|
170
|
+
const client = new Notdiamond({
|
|
171
|
+
apiKey: process.env['NOTDIAMOND_API_KEY'], // This is the default and can be omitted
|
|
176
172
|
});
|
|
177
173
|
|
|
178
174
|
const params: NotDiamond.PromptAdaptCreateParams = {
|
|
@@ -211,70 +207,6 @@ console.log(response.adaptation_run_id);
|
|
|
211
207
|
|
|
212
208
|
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
213
209
|
|
|
214
|
-
## File uploads
|
|
215
|
-
|
|
216
|
-
Request parameters that correspond to file uploads can be passed in many different forms:
|
|
217
|
-
|
|
218
|
-
- `File` (or an object with the same structure)
|
|
219
|
-
- a `fetch` `Response` (or an object with the same structure)
|
|
220
|
-
- an `fs.ReadStream`
|
|
221
|
-
- the return value of our `toFile` helper
|
|
222
|
-
|
|
223
|
-
```ts
|
|
224
|
-
import fs from 'fs';
|
|
225
|
-
import NotDiamond, { toFile } from 'notdiamond';
|
|
226
|
-
|
|
227
|
-
const client = new NotDiamond();
|
|
228
|
-
|
|
229
|
-
// If you have access to Node `fs` we recommend using `fs.createReadStream()`:
|
|
230
|
-
await client.customRouter.trainCustomRouter({
|
|
231
|
-
dataset_file: fs.createReadStream('/path/to/file'),
|
|
232
|
-
language: 'english',
|
|
233
|
-
llm_providers:
|
|
234
|
-
'[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}]',
|
|
235
|
-
maximize: true,
|
|
236
|
-
prompt_column: 'prompt',
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// Or if you have the web `File` API you can pass a `File` instance:
|
|
240
|
-
await client.customRouter.trainCustomRouter({
|
|
241
|
-
dataset_file: new File(['my bytes'], 'file'),
|
|
242
|
-
language: 'english',
|
|
243
|
-
llm_providers:
|
|
244
|
-
'[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}]',
|
|
245
|
-
maximize: true,
|
|
246
|
-
prompt_column: 'prompt',
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
// You can also pass a `fetch` `Response`:
|
|
250
|
-
await client.customRouter.trainCustomRouter({
|
|
251
|
-
dataset_file: await fetch('https://somesite/file'),
|
|
252
|
-
language: 'english',
|
|
253
|
-
llm_providers:
|
|
254
|
-
'[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}]',
|
|
255
|
-
maximize: true,
|
|
256
|
-
prompt_column: 'prompt',
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
// Finally, if none of the above are convenient, you can use our `toFile` helper:
|
|
260
|
-
await client.customRouter.trainCustomRouter({
|
|
261
|
-
dataset_file: await toFile(Buffer.from('my bytes'), 'file'),
|
|
262
|
-
language: 'english',
|
|
263
|
-
llm_providers:
|
|
264
|
-
'[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}]',
|
|
265
|
-
maximize: true,
|
|
266
|
-
prompt_column: 'prompt',
|
|
267
|
-
});
|
|
268
|
-
await client.customRouter.trainCustomRouter({
|
|
269
|
-
dataset_file: await toFile(new Uint8Array([0, 1, 2]), 'file'),
|
|
270
|
-
language: 'english',
|
|
271
|
-
llm_providers:
|
|
272
|
-
'[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}]',
|
|
273
|
-
maximize: true,
|
|
274
|
-
prompt_column: 'prompt',
|
|
275
|
-
});
|
|
276
|
-
```
|
|
277
|
-
|
|
278
210
|
## Handling errors
|
|
279
211
|
|
|
280
212
|
When the library is unable to connect to the API,
|
|
@@ -339,48 +271,6 @@ Error codes are as follows:
|
|
|
339
271
|
| >=500 | `InternalServerError` |
|
|
340
272
|
| N/A | `APIConnectionError` |
|
|
341
273
|
|
|
342
|
-
### Retries
|
|
343
|
-
|
|
344
|
-
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
|
|
345
|
-
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
|
346
|
-
429 Rate Limit, and >=500 Internal errors will all be retried by default.
|
|
347
|
-
|
|
348
|
-
You can use the `maxRetries` option to configure or disable this:
|
|
349
|
-
|
|
350
|
-
<!-- prettier-ignore -->
|
|
351
|
-
```js
|
|
352
|
-
// Configure the default for all requests:
|
|
353
|
-
const client = new NotDiamond({
|
|
354
|
-
maxRetries: 0, // default is 2
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
// Or, configure per-request:
|
|
358
|
-
await client.prompt.adapt.create({
|
|
359
|
-
fields: ['question'],
|
|
360
|
-
system_prompt: 'You are a helpful assistant.',
|
|
361
|
-
target_models: [
|
|
362
|
-
{
|
|
363
|
-
model: 'claude-sonnet-4-5-20250929',
|
|
364
|
-
provider: 'anthropic',
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
model: 'gemini-2.5-flash',
|
|
368
|
-
provider: 'google',
|
|
369
|
-
},
|
|
370
|
-
],
|
|
371
|
-
template: 'Question: {question}\nAnswer:',
|
|
372
|
-
train_goldens: [
|
|
373
|
-
{ fields: { question: 'What is 2+2?' }, answer: '4' },
|
|
374
|
-
// Add at least 25 examples...
|
|
375
|
-
],
|
|
376
|
-
test_goldens: [
|
|
377
|
-
{ fields: { question: 'What is 3*3?' }, answer: '9' },
|
|
378
|
-
],
|
|
379
|
-
}, {
|
|
380
|
-
maxRetries: 5,
|
|
381
|
-
});
|
|
382
|
-
```
|
|
383
|
-
|
|
384
274
|
### Timeouts
|
|
385
275
|
|
|
386
276
|
Requests time out after 1 minute by default. You can configure this with a `timeout` option:
|
|
@@ -388,7 +278,7 @@ Requests time out after 1 minute by default. You can configure this with a `time
|
|
|
388
278
|
<!-- prettier-ignore -->
|
|
389
279
|
```ts
|
|
390
280
|
// Configure the default for all requests:
|
|
391
|
-
const client = new
|
|
281
|
+
const client = new Notdiamond({
|
|
392
282
|
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
|
|
393
283
|
});
|
|
394
284
|
|
|
@@ -414,7 +304,7 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
|
|
|
414
304
|
|
|
415
305
|
<!-- prettier-ignore -->
|
|
416
306
|
```ts
|
|
417
|
-
const client = new
|
|
307
|
+
const client = new Notdiamond();
|
|
418
308
|
|
|
419
309
|
const response = await client.prompt.adapt
|
|
420
310
|
.create({
|
|
@@ -481,13 +371,13 @@ console.log(adaptResponse.adaptation_run_id);
|
|
|
481
371
|
|
|
482
372
|
The log level can be configured in two ways:
|
|
483
373
|
|
|
484
|
-
1. Via the `
|
|
374
|
+
1. Via the `NOTDIAMOND_LOG` environment variable
|
|
485
375
|
2. Using the `logLevel` client option (overrides the environment variable if set)
|
|
486
376
|
|
|
487
377
|
```ts
|
|
488
|
-
import
|
|
378
|
+
import Notdiamond from 'notdiamond';
|
|
489
379
|
|
|
490
|
-
const client = new
|
|
380
|
+
const client = new Notdiamond({
|
|
491
381
|
logLevel: 'debug', // Show all log messages
|
|
492
382
|
});
|
|
493
383
|
```
|
|
@@ -513,13 +403,13 @@ When providing a custom logger, the `logLevel` option still controls which messa
|
|
|
513
403
|
below the configured level will not be sent to your logger.
|
|
514
404
|
|
|
515
405
|
```ts
|
|
516
|
-
import
|
|
406
|
+
import Notdiamond from 'notdiamond';
|
|
517
407
|
import pino from 'pino';
|
|
518
408
|
|
|
519
409
|
const logger = pino();
|
|
520
410
|
|
|
521
|
-
const client = new
|
|
522
|
-
logger: logger.child({ name: '
|
|
411
|
+
const client = new Notdiamond({
|
|
412
|
+
logger: logger.child({ name: 'Notdiamond' }),
|
|
523
413
|
logLevel: 'debug', // Send all messages to pino, allowing it to filter
|
|
524
414
|
});
|
|
525
415
|
```
|
|
@@ -586,10 +476,10 @@ globalThis.fetch = fetch;
|
|
|
586
476
|
Or pass it to the client:
|
|
587
477
|
|
|
588
478
|
```ts
|
|
589
|
-
import
|
|
479
|
+
import Notdiamond from 'notdiamond';
|
|
590
480
|
import fetch from 'my-fetch';
|
|
591
481
|
|
|
592
|
-
const client = new
|
|
482
|
+
const client = new Notdiamond({ fetch });
|
|
593
483
|
```
|
|
594
484
|
|
|
595
485
|
### Fetch options
|
|
@@ -597,9 +487,9 @@ const client = new NotDiamond({ fetch });
|
|
|
597
487
|
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
|
|
598
488
|
|
|
599
489
|
```ts
|
|
600
|
-
import
|
|
490
|
+
import Notdiamond from 'notdiamond';
|
|
601
491
|
|
|
602
|
-
const client = new
|
|
492
|
+
const client = new Notdiamond({
|
|
603
493
|
fetchOptions: {
|
|
604
494
|
// `RequestInit` options
|
|
605
495
|
},
|
|
@@ -614,11 +504,11 @@ options to requests:
|
|
|
614
504
|
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
|
|
615
505
|
|
|
616
506
|
```ts
|
|
617
|
-
import
|
|
507
|
+
import Notdiamond from 'notdiamond';
|
|
618
508
|
import * as undici from 'undici';
|
|
619
509
|
|
|
620
510
|
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
|
|
621
|
-
const client = new
|
|
511
|
+
const client = new Notdiamond({
|
|
622
512
|
fetchOptions: {
|
|
623
513
|
dispatcher: proxyAgent,
|
|
624
514
|
},
|
|
@@ -628,9 +518,9 @@ const client = new NotDiamond({
|
|
|
628
518
|
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
|
|
629
519
|
|
|
630
520
|
```ts
|
|
631
|
-
import
|
|
521
|
+
import Notdiamond from 'notdiamond';
|
|
632
522
|
|
|
633
|
-
const client = new
|
|
523
|
+
const client = new Notdiamond({
|
|
634
524
|
fetchOptions: {
|
|
635
525
|
proxy: 'http://localhost:8888',
|
|
636
526
|
},
|
|
@@ -640,10 +530,10 @@ const client = new NotDiamond({
|
|
|
640
530
|
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
|
|
641
531
|
|
|
642
532
|
```ts
|
|
643
|
-
import
|
|
533
|
+
import Notdiamond from 'npm:notdiamond';
|
|
644
534
|
|
|
645
535
|
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
|
|
646
|
-
const client = new
|
|
536
|
+
const client = new Notdiamond({
|
|
647
537
|
fetchOptions: {
|
|
648
538
|
client: httpClient,
|
|
649
539
|
},
|
package/client.d.mts
CHANGED
|
@@ -10,7 +10,7 @@ import { CustomRouter, CustomRouterTrainCustomRouterParams, CustomRouterTrainCus
|
|
|
10
10
|
import { ModelRouter, ModelRouterSelectModelParams, ModelRouterSelectModelResponse } from "./resources/model-router.mjs";
|
|
11
11
|
import { Model, ModelListParams, ModelListResponse, Models } from "./resources/models.mjs";
|
|
12
12
|
import { PreferenceCreateParams, PreferenceCreateResponse, PreferenceDeleteResponse, PreferenceUpdateParams, PreferenceUpdateResponse, Preferences } from "./resources/preferences.mjs";
|
|
13
|
-
import { GoldenRecord, JobStatus, PromptAdaptation,
|
|
13
|
+
import { GoldenRecord, JobStatus, PromptAdaptation, PromptAdaptationAdaptParams, PromptAdaptationAdaptResponse, PromptAdaptationGetAdaptResultsResponse, PromptAdaptationGetAdaptStatusResponse, PromptAdaptationGetCostsResponse, RequestProvider } from "./resources/prompt-adaptation.mjs";
|
|
14
14
|
import { Report } from "./resources/report/report.mjs";
|
|
15
15
|
import { type Fetch } from "./internal/builtin-types.mjs";
|
|
16
16
|
import { HeadersLike, NullableHeaders } from "./internal/headers.mjs";
|
|
@@ -24,7 +24,7 @@ export interface ClientOptions {
|
|
|
24
24
|
/**
|
|
25
25
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
26
26
|
*
|
|
27
|
-
* Defaults to process.env['
|
|
27
|
+
* Defaults to process.env['NOTDIAMOND_BASE_URL'].
|
|
28
28
|
*/
|
|
29
29
|
baseURL?: string | null | undefined;
|
|
30
30
|
/**
|
|
@@ -72,7 +72,7 @@ export interface ClientOptions {
|
|
|
72
72
|
/**
|
|
73
73
|
* Set the log level.
|
|
74
74
|
*
|
|
75
|
-
* Defaults to process.env['
|
|
75
|
+
* Defaults to process.env['NOTDIAMOND_LOG'] or 'warn' if it isn't set.
|
|
76
76
|
*/
|
|
77
77
|
logLevel?: LogLevel | undefined;
|
|
78
78
|
/**
|
|
@@ -83,9 +83,9 @@ export interface ClientOptions {
|
|
|
83
83
|
logger?: Logger | undefined;
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
* API Client for interfacing with the
|
|
86
|
+
* API Client for interfacing with the Notdiamond API.
|
|
87
87
|
*/
|
|
88
|
-
export declare class
|
|
88
|
+
export declare class Notdiamond {
|
|
89
89
|
#private;
|
|
90
90
|
apiKey: string;
|
|
91
91
|
baseURL: string;
|
|
@@ -98,10 +98,10 @@ export declare class NotDiamond {
|
|
|
98
98
|
protected idempotencyHeader?: string;
|
|
99
99
|
private _options;
|
|
100
100
|
/**
|
|
101
|
-
* API Client for interfacing with the
|
|
101
|
+
* API Client for interfacing with the Notdiamond API.
|
|
102
102
|
*
|
|
103
103
|
* @param {string | undefined} [opts.apiKey=process.env['NOT_DIAMOND_API_KEY'] ?? undefined]
|
|
104
|
-
* @param {string} [opts.baseURL=process.env['
|
|
104
|
+
* @param {string} [opts.baseURL=process.env['NOTDIAMOND_BASE_URL'] ?? https://api.notdiamond.ai] - Override the default base URL for the API.
|
|
105
105
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
106
106
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
107
107
|
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -157,9 +157,9 @@ export declare class NotDiamond {
|
|
|
157
157
|
}>;
|
|
158
158
|
private buildHeaders;
|
|
159
159
|
private buildBody;
|
|
160
|
-
static
|
|
160
|
+
static Notdiamond: typeof Notdiamond;
|
|
161
161
|
static DEFAULT_TIMEOUT: number;
|
|
162
|
-
static
|
|
162
|
+
static NotdiamondError: typeof Errors.NotdiamondError;
|
|
163
163
|
static APIError: typeof Errors.APIError;
|
|
164
164
|
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
165
165
|
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
@@ -180,12 +180,12 @@ export declare class NotDiamond {
|
|
|
180
180
|
customRouter: API.CustomRouter;
|
|
181
181
|
models: API.Models;
|
|
182
182
|
}
|
|
183
|
-
export declare namespace
|
|
183
|
+
export declare namespace Notdiamond {
|
|
184
184
|
export type RequestOptions = Opts.RequestOptions;
|
|
185
185
|
export { ModelRouter as ModelRouter, type ModelRouterSelectModelResponse as ModelRouterSelectModelResponse, type ModelRouterSelectModelParams as ModelRouterSelectModelParams, };
|
|
186
186
|
export { Report as Report };
|
|
187
187
|
export { Preferences as Preferences, type PreferenceCreateResponse as PreferenceCreateResponse, type PreferenceUpdateResponse as PreferenceUpdateResponse, type PreferenceDeleteResponse as PreferenceDeleteResponse, type PreferenceCreateParams as PreferenceCreateParams, type PreferenceUpdateParams as PreferenceUpdateParams, };
|
|
188
|
-
export { PromptAdaptation as PromptAdaptation, type GoldenRecord as GoldenRecord, type JobStatus as JobStatus, type RequestProvider as RequestProvider, type
|
|
188
|
+
export { PromptAdaptation as PromptAdaptation, type GoldenRecord as GoldenRecord, type JobStatus as JobStatus, type RequestProvider as RequestProvider, type PromptAdaptationAdaptResponse as PromptAdaptationAdaptResponse, type PromptAdaptationGetAdaptResultsResponse as PromptAdaptationGetAdaptResultsResponse, type PromptAdaptationGetAdaptStatusResponse as PromptAdaptationGetAdaptStatusResponse, type PromptAdaptationGetCostsResponse as PromptAdaptationGetCostsResponse, type PromptAdaptationAdaptParams as PromptAdaptationAdaptParams, };
|
|
189
189
|
export { CustomRouter as CustomRouter, type CustomRouterTrainCustomRouterResponse as CustomRouterTrainCustomRouterResponse, type CustomRouterTrainCustomRouterParams as CustomRouterTrainCustomRouterParams, };
|
|
190
190
|
export { Models as Models, type Model as Model, type ModelListResponse as ModelListResponse, type ModelListParams as ModelListParams, };
|
|
191
191
|
}
|
package/client.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;YAIvE,EAAE,MAAM,EAAE,QAAQ,EAAE;OAKzB,KAAK,IAAI;OAGT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,UAAU,EAAE;OACd,EACL,YAAY,EACZ,mCAAmC,EACnC,qCAAqC,EACtC;OACM,EACL,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,EAC/B;OACM,EAAE,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,EAAE;OACrD,EACL,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,WAAW,EACZ;OACM,EACL,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"client.d.mts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;YAIvE,EAAE,MAAM,EAAE,QAAQ,EAAE;OAKzB,KAAK,IAAI;OAGT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,UAAU,EAAE;OACd,EACL,YAAY,EACZ,mCAAmC,EACnC,qCAAqC,EACtC;OACM,EACL,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,EAC/B;OACM,EAAE,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,EAAE;OACrD,EACL,sBAAsB,EACtB,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L,WAAW,IAAI,WAAW,EAC1B,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,GAClE,CAAC;IAEF,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,CAAC;IAE5B,OAAO,EACL,WAAW,IAAI,WAAW,EAC1B,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;IAEF,OAAO,EACL,gBAAgB,IAAI,gBAAgB,EACpC,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,uCAAuC,IAAI,uCAAuC,EACvF,KAAK,sCAAsC,IAAI,sCAAsC,EACrF,KAAK,gCAAgC,IAAI,gCAAgC,EACzE,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;IAEF,OAAO,EACL,YAAY,IAAI,YAAY,EAC5B,KAAK,qCAAqC,IAAI,qCAAqC,EACnF,KAAK,mCAAmC,IAAI,mCAAmC,GAChF,CAAC;IAEF,OAAO,EACL,MAAM,IAAI,MAAM,EAChB,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,eAAe,IAAI,eAAe,GACxC,CAAC;CACH"}
|
package/client.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { CustomRouter, CustomRouterTrainCustomRouterParams, CustomRouterTrainCus
|
|
|
10
10
|
import { ModelRouter, ModelRouterSelectModelParams, ModelRouterSelectModelResponse } from "./resources/model-router.js";
|
|
11
11
|
import { Model, ModelListParams, ModelListResponse, Models } from "./resources/models.js";
|
|
12
12
|
import { PreferenceCreateParams, PreferenceCreateResponse, PreferenceDeleteResponse, PreferenceUpdateParams, PreferenceUpdateResponse, Preferences } from "./resources/preferences.js";
|
|
13
|
-
import { GoldenRecord, JobStatus, PromptAdaptation,
|
|
13
|
+
import { GoldenRecord, JobStatus, PromptAdaptation, PromptAdaptationAdaptParams, PromptAdaptationAdaptResponse, PromptAdaptationGetAdaptResultsResponse, PromptAdaptationGetAdaptStatusResponse, PromptAdaptationGetCostsResponse, RequestProvider } from "./resources/prompt-adaptation.js";
|
|
14
14
|
import { Report } from "./resources/report/report.js";
|
|
15
15
|
import { type Fetch } from "./internal/builtin-types.js";
|
|
16
16
|
import { HeadersLike, NullableHeaders } from "./internal/headers.js";
|
|
@@ -24,7 +24,7 @@ export interface ClientOptions {
|
|
|
24
24
|
/**
|
|
25
25
|
* Override the default base URL for the API, e.g., "https://api.example.com/v2/"
|
|
26
26
|
*
|
|
27
|
-
* Defaults to process.env['
|
|
27
|
+
* Defaults to process.env['NOTDIAMOND_BASE_URL'].
|
|
28
28
|
*/
|
|
29
29
|
baseURL?: string | null | undefined;
|
|
30
30
|
/**
|
|
@@ -72,7 +72,7 @@ export interface ClientOptions {
|
|
|
72
72
|
/**
|
|
73
73
|
* Set the log level.
|
|
74
74
|
*
|
|
75
|
-
* Defaults to process.env['
|
|
75
|
+
* Defaults to process.env['NOTDIAMOND_LOG'] or 'warn' if it isn't set.
|
|
76
76
|
*/
|
|
77
77
|
logLevel?: LogLevel | undefined;
|
|
78
78
|
/**
|
|
@@ -83,9 +83,9 @@ export interface ClientOptions {
|
|
|
83
83
|
logger?: Logger | undefined;
|
|
84
84
|
}
|
|
85
85
|
/**
|
|
86
|
-
* API Client for interfacing with the
|
|
86
|
+
* API Client for interfacing with the Notdiamond API.
|
|
87
87
|
*/
|
|
88
|
-
export declare class
|
|
88
|
+
export declare class Notdiamond {
|
|
89
89
|
#private;
|
|
90
90
|
apiKey: string;
|
|
91
91
|
baseURL: string;
|
|
@@ -98,10 +98,10 @@ export declare class NotDiamond {
|
|
|
98
98
|
protected idempotencyHeader?: string;
|
|
99
99
|
private _options;
|
|
100
100
|
/**
|
|
101
|
-
* API Client for interfacing with the
|
|
101
|
+
* API Client for interfacing with the Notdiamond API.
|
|
102
102
|
*
|
|
103
103
|
* @param {string | undefined} [opts.apiKey=process.env['NOT_DIAMOND_API_KEY'] ?? undefined]
|
|
104
|
-
* @param {string} [opts.baseURL=process.env['
|
|
104
|
+
* @param {string} [opts.baseURL=process.env['NOTDIAMOND_BASE_URL'] ?? https://api.notdiamond.ai] - Override the default base URL for the API.
|
|
105
105
|
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
|
|
106
106
|
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
|
|
107
107
|
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
|
|
@@ -157,9 +157,9 @@ export declare class NotDiamond {
|
|
|
157
157
|
}>;
|
|
158
158
|
private buildHeaders;
|
|
159
159
|
private buildBody;
|
|
160
|
-
static
|
|
160
|
+
static Notdiamond: typeof Notdiamond;
|
|
161
161
|
static DEFAULT_TIMEOUT: number;
|
|
162
|
-
static
|
|
162
|
+
static NotdiamondError: typeof Errors.NotdiamondError;
|
|
163
163
|
static APIError: typeof Errors.APIError;
|
|
164
164
|
static APIConnectionError: typeof Errors.APIConnectionError;
|
|
165
165
|
static APIConnectionTimeoutError: typeof Errors.APIConnectionTimeoutError;
|
|
@@ -180,12 +180,12 @@ export declare class NotDiamond {
|
|
|
180
180
|
customRouter: API.CustomRouter;
|
|
181
181
|
models: API.Models;
|
|
182
182
|
}
|
|
183
|
-
export declare namespace
|
|
183
|
+
export declare namespace Notdiamond {
|
|
184
184
|
export type RequestOptions = Opts.RequestOptions;
|
|
185
185
|
export { ModelRouter as ModelRouter, type ModelRouterSelectModelResponse as ModelRouterSelectModelResponse, type ModelRouterSelectModelParams as ModelRouterSelectModelParams, };
|
|
186
186
|
export { Report as Report };
|
|
187
187
|
export { Preferences as Preferences, type PreferenceCreateResponse as PreferenceCreateResponse, type PreferenceUpdateResponse as PreferenceUpdateResponse, type PreferenceDeleteResponse as PreferenceDeleteResponse, type PreferenceCreateParams as PreferenceCreateParams, type PreferenceUpdateParams as PreferenceUpdateParams, };
|
|
188
|
-
export { PromptAdaptation as PromptAdaptation, type GoldenRecord as GoldenRecord, type JobStatus as JobStatus, type RequestProvider as RequestProvider, type
|
|
188
|
+
export { PromptAdaptation as PromptAdaptation, type GoldenRecord as GoldenRecord, type JobStatus as JobStatus, type RequestProvider as RequestProvider, type PromptAdaptationAdaptResponse as PromptAdaptationAdaptResponse, type PromptAdaptationGetAdaptResultsResponse as PromptAdaptationGetAdaptResultsResponse, type PromptAdaptationGetAdaptStatusResponse as PromptAdaptationGetAdaptStatusResponse, type PromptAdaptationGetCostsResponse as PromptAdaptationGetCostsResponse, type PromptAdaptationAdaptParams as PromptAdaptationAdaptParams, };
|
|
189
189
|
export { CustomRouter as CustomRouter, type CustomRouterTrainCustomRouterResponse as CustomRouterTrainCustomRouterResponse, type CustomRouterTrainCustomRouterParams as CustomRouterTrainCustomRouterParams, };
|
|
190
190
|
export { Models as Models, type Model as Model, type ModelListResponse as ModelListResponse, type ModelListParams as ModelListParams, };
|
|
191
191
|
}
|
package/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["src/client.ts"],"names":[],"mappings":"OAEO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAY;OAC3C,KAAK,EAAc,cAAc,EAAE,iBAAiB,EAAE,oBAAoB,EAAE;YAIvE,EAAE,MAAM,EAAE,QAAQ,EAAE;OAKzB,KAAK,IAAI;OAGT,KAAK,MAAM;OACX,KAAK,OAAO;OACZ,KAAK,GAAG;OACR,EAAE,UAAU,EAAE;OACd,EACL,YAAY,EACZ,mCAAmC,EACnC,qCAAqC,EACtC;OACM,EACL,WAAW,EACX,4BAA4B,EAC5B,8BAA8B,EAC/B;O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