notdiamond 2.0.0-rc1 → 2.0.0-rc4
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 +45 -0
- package/README.md +19 -21
- package/client.d.mts +21 -35
- package/client.d.mts.map +1 -1
- package/client.d.ts +21 -35
- package/client.d.ts.map +1 -1
- package/client.js +23 -39
- package/client.js.map +1 -1
- package/client.mjs +23 -39
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/env.d.mts.map +1 -1
- package/internal/utils/env.d.ts.map +1 -1
- package/internal/utils/env.js +4 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +4 -2
- package/internal/utils/env.mjs.map +1 -1
- package/package.json +10 -11
- package/resources/index.d.mts +6 -6
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +6 -6
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +8 -8
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +4 -4
- package/resources/index.mjs.map +1 -1
- package/resources/model-router.d.mts +311 -0
- package/resources/model-router.d.mts.map +1 -0
- package/resources/model-router.d.ts +311 -0
- package/resources/model-router.d.ts.map +1 -0
- package/resources/model-router.js +97 -0
- package/resources/model-router.js.map +1 -0
- package/resources/model-router.mjs +93 -0
- package/resources/model-router.mjs.map +1 -0
- package/resources/models.d.mts +50 -25
- package/resources/models.d.mts.map +1 -1
- package/resources/models.d.ts +50 -25
- package/resources/models.d.ts.map +1 -1
- package/resources/models.js +5 -0
- package/resources/models.js.map +1 -1
- package/resources/models.mjs +5 -0
- package/resources/models.mjs.map +1 -1
- package/resources/preferences.d.mts +49 -47
- package/resources/preferences.d.mts.map +1 -1
- package/resources/preferences.d.ts +49 -47
- package/resources/preferences.d.ts.map +1 -1
- package/resources/preferences.js +30 -33
- package/resources/preferences.js.map +1 -1
- package/resources/preferences.mjs +30 -33
- package/resources/preferences.mjs.map +1 -1
- package/resources/prompt/adapt.d.mts +352 -0
- package/resources/prompt/adapt.d.mts.map +1 -0
- package/resources/prompt/adapt.d.ts +352 -0
- package/resources/prompt/adapt.d.ts.map +1 -0
- package/resources/prompt/adapt.js +154 -0
- package/resources/prompt/adapt.js.map +1 -0
- package/resources/prompt/adapt.mjs +150 -0
- package/resources/prompt/adapt.mjs.map +1 -0
- package/resources/prompt/index.d.mts +3 -0
- package/resources/prompt/index.d.mts.map +1 -0
- package/resources/prompt/index.d.ts +3 -0
- package/resources/prompt/index.d.ts.map +1 -0
- package/resources/prompt/index.js +9 -0
- package/resources/prompt/index.js.map +1 -0
- package/resources/prompt/index.mjs +4 -0
- package/resources/prompt/index.mjs.map +1 -0
- package/resources/prompt/prompt.d.mts +338 -0
- package/resources/prompt/prompt.d.mts.map +1 -0
- package/resources/prompt/prompt.d.ts +338 -0
- package/resources/prompt/prompt.d.ts.map +1 -0
- package/resources/prompt/prompt.js +128 -0
- package/resources/prompt/prompt.js.map +1 -0
- package/resources/prompt/prompt.mjs +123 -0
- package/resources/prompt/prompt.mjs.map +1 -0
- package/resources/prompt.d.mts +2 -0
- package/resources/prompt.d.mts.map +1 -0
- package/resources/prompt.d.ts +2 -0
- package/resources/prompt.d.ts.map +1 -0
- package/resources/prompt.js +6 -0
- package/resources/prompt.js.map +1 -0
- package/resources/prompt.mjs +3 -0
- package/resources/prompt.mjs.map +1 -0
- package/resources/pzn.d.mts +225 -0
- package/resources/pzn.d.mts.map +1 -0
- package/resources/pzn.d.ts +225 -0
- package/resources/pzn.d.ts.map +1 -0
- package/resources/{routing.js → pzn.js} +28 -71
- package/resources/pzn.js.map +1 -0
- package/resources/{routing.mjs → pzn.mjs} +26 -69
- package/resources/pzn.mjs.map +1 -0
- package/resources/report/index.d.mts +3 -0
- package/resources/report/index.d.mts.map +1 -0
- package/resources/report/index.d.ts +3 -0
- package/resources/report/index.d.ts.map +1 -0
- package/resources/report/index.js +9 -0
- package/resources/report/index.js.map +1 -0
- package/resources/report/index.mjs +4 -0
- package/resources/report/index.mjs.map +1 -0
- package/resources/report/metrics.d.mts +87 -0
- package/resources/report/metrics.d.mts.map +1 -0
- package/resources/report/metrics.d.ts +87 -0
- package/resources/report/metrics.d.ts.map +1 -0
- package/resources/report/metrics.js +57 -0
- package/resources/report/metrics.js.map +1 -0
- package/resources/report/metrics.mjs +53 -0
- package/resources/report/metrics.mjs.map +1 -0
- package/resources/report/report.d.mts +10 -0
- package/resources/report/report.d.mts.map +1 -0
- package/resources/report/report.d.ts +10 -0
- package/resources/report/report.d.ts.map +1 -0
- package/resources/report/report.js +17 -0
- package/resources/report/report.js.map +1 -0
- package/resources/report/report.mjs +12 -0
- package/resources/report/report.mjs.map +1 -0
- package/resources/report.d.mts +1 -244
- package/resources/report.d.mts.map +1 -1
- package/resources/report.d.ts +1 -244
- package/resources/report.d.ts.map +1 -1
- package/resources/report.js +2 -82
- package/resources/report.js.map +1 -1
- package/resources/report.mjs +1 -80
- package/resources/report.mjs.map +1 -1
- package/src/client.ts +71 -120
- package/src/internal/utils/env.ts +4 -2
- package/src/resources/index.ts +24 -34
- package/src/resources/model-router.ts +356 -0
- package/src/resources/models.ts +55 -32
- package/src/resources/preferences.ts +61 -70
- package/src/resources/prompt/adapt.ts +402 -0
- package/src/resources/prompt/index.ts +16 -0
- package/src/resources/prompt/prompt.ts +398 -0
- package/src/resources/prompt.ts +3 -0
- package/src/resources/pzn.ts +273 -0
- package/src/resources/report/index.ts +4 -0
- package/src/resources/report/metrics.ts +99 -0
- package/src/resources/report/report.ts +19 -0
- package/src/resources/report.ts +1 -298
- 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/resources/admin.d.mts +0 -4
- package/resources/admin.d.mts.map +0 -1
- package/resources/admin.d.ts +0 -4
- package/resources/admin.d.ts.map +0 -1
- package/resources/admin.js +0 -9
- package/resources/admin.js.map +0 -1
- package/resources/admin.mjs +0 -5
- package/resources/admin.mjs.map +0 -1
- package/resources/prompt-adaptation.d.mts +0 -574
- package/resources/prompt-adaptation.d.mts.map +0 -1
- package/resources/prompt-adaptation.d.ts +0 -574
- package/resources/prompt-adaptation.d.ts.map +0 -1
- package/resources/prompt-adaptation.js +0 -289
- package/resources/prompt-adaptation.js.map +0 -1
- package/resources/prompt-adaptation.mjs +0 -285
- package/resources/prompt-adaptation.mjs.map +0 -1
- package/resources/routing.d.mts +0 -391
- package/resources/routing.d.mts.map +0 -1
- package/resources/routing.d.ts +0 -391
- package/resources/routing.d.ts.map +0 -1
- package/resources/routing.js.map +0 -1
- package/resources/routing.mjs.map +0 -1
- package/src/resources/admin.ts +0 -5
- package/src/resources/prompt-adaptation.ts +0 -700
- package/src/resources/routing.ts +0 -476
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import { APIPromise } from '../../core/api-promise';
|
|
5
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
6
|
+
import { path } from '../../internal/utils/path';
|
|
7
|
+
|
|
8
|
+
export class Adapt extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Adapt your prompt from one LLM to work optimally across different target LLMs.
|
|
11
|
+
*
|
|
12
|
+
* This endpoint automatically optimizes your prompt (system prompt + user message
|
|
13
|
+
* template) to achieve better performance when switching between different
|
|
14
|
+
* language models. Each model has unique characteristics, and what works well for
|
|
15
|
+
* GPT-4 might not work as well for Claude or Gemini.
|
|
16
|
+
*
|
|
17
|
+
* **How Prompt Adaptation Works:**
|
|
18
|
+
*
|
|
19
|
+
* 1. You provide your current prompt optimized for an origin model
|
|
20
|
+
* 2. You specify target models you want to adapt to
|
|
21
|
+
* 3. You provide evaluation examples (golden records) with expected answers
|
|
22
|
+
* 4. The system runs optimization to find the best prompt for each target model
|
|
23
|
+
* 5. You receive adapted prompts that perform well on your target models
|
|
24
|
+
*
|
|
25
|
+
* **Evaluation Metrics:** Choose either a standard metric or provide custom
|
|
26
|
+
* evaluation:
|
|
27
|
+
*
|
|
28
|
+
* - **Standard metrics**: LLMaaJ:SQL, LLMaaJ:Sem_Sim_1/3/10 (semantic similarity),
|
|
29
|
+
* JSON_Match
|
|
30
|
+
* - **Custom evaluation**: Provide evaluation_config with your own LLM judge,
|
|
31
|
+
* prompt, and cutoff
|
|
32
|
+
*
|
|
33
|
+
* **Dataset Requirements:**
|
|
34
|
+
*
|
|
35
|
+
* - Minimum 25 examples in train_goldens (more examples = better adaptation)
|
|
36
|
+
* - Each example must have fields matching your template placeholders
|
|
37
|
+
* - Supervised evaluation requires 'answer' field in each golden record
|
|
38
|
+
* - Unsupervised evaluation can work without answers
|
|
39
|
+
*
|
|
40
|
+
* **Training Time:**
|
|
41
|
+
*
|
|
42
|
+
* - Processing is asynchronous and typically takes 10-30 minutes
|
|
43
|
+
* - Time depends on: number of target models, dataset size, model availability
|
|
44
|
+
* - Use the returned adaptation_run_id to check status and retrieve results
|
|
45
|
+
*
|
|
46
|
+
* **Subscription Tiers:**
|
|
47
|
+
*
|
|
48
|
+
* - Free: 1 target model
|
|
49
|
+
* - Starter: 3 target models
|
|
50
|
+
* - Startup: 5 target models
|
|
51
|
+
* - Enterprise: 10 target models
|
|
52
|
+
*
|
|
53
|
+
* **Best Practices:**
|
|
54
|
+
*
|
|
55
|
+
* 1. Use diverse, representative examples from your production workload
|
|
56
|
+
* 2. Include examples for best results (25 minimum)
|
|
57
|
+
* 3. Ensure consistent evaluation across all examples
|
|
58
|
+
* 4. Test both train_goldens and test_goldens split for validation
|
|
59
|
+
* 5. Use the same model versions you'll use in production
|
|
60
|
+
*
|
|
61
|
+
* **Example Workflow:**
|
|
62
|
+
*
|
|
63
|
+
* ```
|
|
64
|
+
* 1. POST /v2/prompt/adapt - Submit adaptation request
|
|
65
|
+
* 2. GET /v2/prompt/adaptStatus/{id} - Poll status until completed
|
|
66
|
+
* 3. GET /v2/prompt/adaptResults/{id} - Retrieve optimized prompts
|
|
67
|
+
* 4. Use optimized prompts in production with target models
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* **Related Documentation:** See
|
|
71
|
+
* https://docs.notdiamond.ai/docs/adapting-prompts-to-new-models for detailed
|
|
72
|
+
* guide.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const adapt = await client.prompt.adapt.create({
|
|
77
|
+
* fields: ['question'],
|
|
78
|
+
* system_prompt: 'You are a helpful assistant that answers questions accurately.',
|
|
79
|
+
* target_models: [
|
|
80
|
+
* { provider: 'anthropic', model: 'claude-sonnet-4-5-20250929' },
|
|
81
|
+
* { provider: 'google', model: 'gemini-1.5-pro' },
|
|
82
|
+
* ],
|
|
83
|
+
* template: 'Question: {question}\nAnswer:',
|
|
84
|
+
* evaluation_metric: 'LLMaaJ:Sem_Sim_3',
|
|
85
|
+
* origin_model: { provider: 'openai', model: 'gpt-4o' },
|
|
86
|
+
* test_goldens: [
|
|
87
|
+
* {
|
|
88
|
+
* fields: { ... },
|
|
89
|
+
* answer: '9',
|
|
90
|
+
* },
|
|
91
|
+
* {
|
|
92
|
+
* fields: { ... },
|
|
93
|
+
* answer: 'Pacific Ocean',
|
|
94
|
+
* },
|
|
95
|
+
* ],
|
|
96
|
+
* train_goldens: [
|
|
97
|
+
* {
|
|
98
|
+
* fields: { ... },
|
|
99
|
+
* answer: '4',
|
|
100
|
+
* },
|
|
101
|
+
* {
|
|
102
|
+
* fields: { ... },
|
|
103
|
+
* answer: 'Paris',
|
|
104
|
+
* },
|
|
105
|
+
* {
|
|
106
|
+
* fields: { ... },
|
|
107
|
+
* answer: 'William Shakespeare',
|
|
108
|
+
* },
|
|
109
|
+
* {
|
|
110
|
+
* fields: { ... },
|
|
111
|
+
* answer: 'Water',
|
|
112
|
+
* },
|
|
113
|
+
* {
|
|
114
|
+
* fields: { ... },
|
|
115
|
+
* answer: '7',
|
|
116
|
+
* },
|
|
117
|
+
* ],
|
|
118
|
+
* });
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
create(body: AdaptCreateParams, options?: RequestOptions): APIPromise<AdaptCreateResponse> {
|
|
122
|
+
return this._client.post('/v2/prompt/adapt', { body, ...options });
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Get LLM usage costs for a specific prompt adaptation run.
|
|
127
|
+
*
|
|
128
|
+
* This endpoint returns the total cost and detailed usage records for all LLM
|
|
129
|
+
* requests made during a prompt adaptation run. Use this to track costs associated
|
|
130
|
+
* with optimizing prompts for different target models.
|
|
131
|
+
*
|
|
132
|
+
* **Cost Breakdown:**
|
|
133
|
+
*
|
|
134
|
+
* - Total cost across all models used in the adaptation
|
|
135
|
+
* - Individual usage records with provider, model, tokens, and costs
|
|
136
|
+
* - Timestamps for each LLM request
|
|
137
|
+
* - Task type (e.g., optimization, evaluation)
|
|
138
|
+
*
|
|
139
|
+
* **Access Control:**
|
|
140
|
+
*
|
|
141
|
+
* - Only accessible by the user who created the adaptation run
|
|
142
|
+
* - Requires prompt adaptation access
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```ts
|
|
146
|
+
* const response = await client.prompt.adapt.getCosts(
|
|
147
|
+
* 'adaptation_run_id',
|
|
148
|
+
* );
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
getCosts(adaptationRunID: string, options?: RequestOptions): APIPromise<AdaptGetCostsResponse> {
|
|
152
|
+
return this._client.get(path`/v2/prompt/adapt/${adaptationRunID}/costs`, options);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* A training or test example for prompt adaptation.
|
|
158
|
+
*/
|
|
159
|
+
export interface GoldenRecord {
|
|
160
|
+
/**
|
|
161
|
+
* Dictionary mapping field names to their values. Keys must match the fields
|
|
162
|
+
* specified in the template
|
|
163
|
+
*/
|
|
164
|
+
fields: { [key: string]: string };
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Expected answer for supervised evaluation. Required for supervised metrics,
|
|
168
|
+
* optional for unsupervised
|
|
169
|
+
*/
|
|
170
|
+
answer?: string | null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Model for specifying an LLM provider in API requests.
|
|
175
|
+
*/
|
|
176
|
+
export interface RequestProvider {
|
|
177
|
+
/**
|
|
178
|
+
* Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
|
|
179
|
+
*/
|
|
180
|
+
model: string;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Provider name (e.g., 'openai', 'anthropic', 'google')
|
|
184
|
+
*/
|
|
185
|
+
provider: string;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Maximum context length for the model (required for custom models)
|
|
189
|
+
*/
|
|
190
|
+
context_length?: number | null;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Input token price per million tokens in USD (required for custom models)
|
|
194
|
+
*/
|
|
195
|
+
input_price?: number | null;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Whether this is a custom model not in Not Diamond's supported model list
|
|
199
|
+
*/
|
|
200
|
+
is_custom?: boolean;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Average latency in seconds (required for custom models)
|
|
204
|
+
*/
|
|
205
|
+
latency?: number | null;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Output token price per million tokens in USD (required for custom models)
|
|
209
|
+
*/
|
|
210
|
+
output_price?: number | null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Response model for POST /v2/prompt/adapt endpoint.
|
|
215
|
+
*
|
|
216
|
+
* Returned immediately after submitting a prompt adaptation request. The
|
|
217
|
+
* adaptation process runs asynchronously, so use the returned adaptation_run_id to
|
|
218
|
+
* track progress and retrieve results when complete.
|
|
219
|
+
*
|
|
220
|
+
* **Next steps:**
|
|
221
|
+
*
|
|
222
|
+
* 1. Store the adaptation_run_id
|
|
223
|
+
* 2. Poll GET /v2/prompt/adaptStatus/{adaptation_run_id} to check progress
|
|
224
|
+
* 3. When status is 'completed', retrieve optimized prompts from GET
|
|
225
|
+
* /v2/prompt/adaptResults/{adaptation_run_id}
|
|
226
|
+
* 4. Use the optimized prompts with your target models
|
|
227
|
+
*/
|
|
228
|
+
export interface AdaptCreateResponse {
|
|
229
|
+
/**
|
|
230
|
+
* Unique identifier for this adaptation run. Use this to poll status and retrieve
|
|
231
|
+
* optimized prompts when complete
|
|
232
|
+
*/
|
|
233
|
+
adaptation_run_id: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Response model for GET /v2/prompt/adapt/{adaptation_run_id}/costs endpoint.
|
|
238
|
+
*
|
|
239
|
+
* Contains the total LLM costs and detailed usage records for a prompt adaptation
|
|
240
|
+
* run. Use this to track costs associated with optimizing prompts for different
|
|
241
|
+
* target models.
|
|
242
|
+
*/
|
|
243
|
+
export interface AdaptGetCostsResponse {
|
|
244
|
+
/**
|
|
245
|
+
* Unique identifier for the adaptation run
|
|
246
|
+
*/
|
|
247
|
+
adaptation_run_id: string;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Total cost in USD across all LLM requests in this adaptation run
|
|
251
|
+
*/
|
|
252
|
+
total_cost: number;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Detailed usage records for each LLM request made during the adaptation
|
|
256
|
+
*/
|
|
257
|
+
usage_records: Array<AdaptGetCostsResponse.UsageRecord>;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export namespace AdaptGetCostsResponse {
|
|
261
|
+
/**
|
|
262
|
+
* Individual LLM usage record with token counts and cost breakdown.
|
|
263
|
+
*
|
|
264
|
+
* Returned by GET /llm-usage endpoint and included in AdaptationRunCostResponse.
|
|
265
|
+
* Each record represents a single LLM API call with detailed usage metrics.
|
|
266
|
+
*/
|
|
267
|
+
export interface UsageRecord {
|
|
268
|
+
/**
|
|
269
|
+
* Unique identifier for this usage record
|
|
270
|
+
*/
|
|
271
|
+
id: string;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Adaptation run ID this usage is associated with
|
|
275
|
+
*/
|
|
276
|
+
adaptation_run_id: string;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Cost of input tokens in USD
|
|
280
|
+
*/
|
|
281
|
+
input_cost: number;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Number of input tokens consumed
|
|
285
|
+
*/
|
|
286
|
+
input_tokens: number;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Model name (e.g., 'gpt-4', 'claude-3-opus-20240229')
|
|
290
|
+
*/
|
|
291
|
+
model: string;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Organization ID associated with the request
|
|
295
|
+
*/
|
|
296
|
+
organization_id: string;
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Cost of output tokens in USD
|
|
300
|
+
*/
|
|
301
|
+
output_cost: number;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Number of output tokens generated
|
|
305
|
+
*/
|
|
306
|
+
output_tokens: number;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* LLM provider (e.g., 'openai', 'anthropic', 'google')
|
|
310
|
+
*/
|
|
311
|
+
provider: string;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Type of task (e.g., 'optimization', 'evaluation')
|
|
315
|
+
*/
|
|
316
|
+
task_type: string;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Unix timestamp when the request was made
|
|
320
|
+
*/
|
|
321
|
+
timestamp: number;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Total cost (input + output) in USD
|
|
325
|
+
*/
|
|
326
|
+
total_cost: number;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* User ID who made the request
|
|
330
|
+
*/
|
|
331
|
+
user_id: string;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface AdaptCreateParams {
|
|
336
|
+
/**
|
|
337
|
+
* List of field names that will be substituted into the template. Must match keys
|
|
338
|
+
* in golden records
|
|
339
|
+
*/
|
|
340
|
+
fields: Array<string>;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* System prompt to use with the origin model. This sets the context and role for
|
|
344
|
+
* the LLM
|
|
345
|
+
*/
|
|
346
|
+
system_prompt: string;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* List of models to adapt the prompt for. Maximum count depends on your
|
|
350
|
+
* subscription tier (Free: 1, Starter: 3, Startup: 5, Enterprise: 10)
|
|
351
|
+
*/
|
|
352
|
+
target_models: Array<RequestProvider>;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* User message template with placeholders for fields. Use curly braces for field
|
|
356
|
+
* substitution
|
|
357
|
+
*/
|
|
358
|
+
template: string;
|
|
359
|
+
|
|
360
|
+
evaluation_config?: string | null;
|
|
361
|
+
|
|
362
|
+
evaluation_metric?: string | null;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Training examples (legacy parameter). Use train_goldens and test_goldens for
|
|
366
|
+
* better control. Minimum 25 examples
|
|
367
|
+
*/
|
|
368
|
+
goldens?: Array<GoldenRecord> | null;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Model for specifying an LLM provider in API requests.
|
|
372
|
+
*/
|
|
373
|
+
origin_model?: RequestProvider | null;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Optional baseline score for the origin model. If provided, can skip origin model
|
|
377
|
+
* evaluation
|
|
378
|
+
*/
|
|
379
|
+
origin_model_evaluation_score?: number | null;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Test examples for evaluation. Required if train_goldens is provided. Used to
|
|
383
|
+
* measure final performance on held-out data
|
|
384
|
+
*/
|
|
385
|
+
test_goldens?: Array<GoldenRecord> | null;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Training examples for prompt optimization. Minimum 25 examples required. Cannot
|
|
389
|
+
* be used with 'goldens' parameter
|
|
390
|
+
*/
|
|
391
|
+
train_goldens?: Array<GoldenRecord> | null;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export declare namespace Adapt {
|
|
395
|
+
export {
|
|
396
|
+
type GoldenRecord as GoldenRecord,
|
|
397
|
+
type RequestProvider as RequestProvider,
|
|
398
|
+
type AdaptCreateResponse as AdaptCreateResponse,
|
|
399
|
+
type AdaptGetCostsResponse as AdaptGetCostsResponse,
|
|
400
|
+
type AdaptCreateParams as AdaptCreateParams,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Adapt,
|
|
5
|
+
type GoldenRecord,
|
|
6
|
+
type RequestProvider,
|
|
7
|
+
type AdaptCreateResponse,
|
|
8
|
+
type AdaptGetCostsResponse,
|
|
9
|
+
type AdaptCreateParams,
|
|
10
|
+
} from './adapt';
|
|
11
|
+
export {
|
|
12
|
+
Prompt,
|
|
13
|
+
type JobStatus,
|
|
14
|
+
type PromptGetAdaptResultsResponse,
|
|
15
|
+
type PromptGetAdaptStatusResponse,
|
|
16
|
+
} from './prompt';
|