notdiamond 2.0.0-rc2 → 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.
Files changed (167) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +14 -16
  3. package/client.d.mts +21 -35
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +21 -35
  6. package/client.d.ts.map +1 -1
  7. package/client.js +23 -39
  8. package/client.js.map +1 -1
  9. package/client.mjs +23 -39
  10. package/client.mjs.map +1 -1
  11. package/internal/tslib.js +17 -17
  12. package/internal/utils/env.d.mts.map +1 -1
  13. package/internal/utils/env.d.ts.map +1 -1
  14. package/internal/utils/env.js +4 -2
  15. package/internal/utils/env.js.map +1 -1
  16. package/internal/utils/env.mjs +4 -2
  17. package/internal/utils/env.mjs.map +1 -1
  18. package/package.json +10 -11
  19. package/resources/index.d.mts +6 -6
  20. package/resources/index.d.mts.map +1 -1
  21. package/resources/index.d.ts +6 -6
  22. package/resources/index.d.ts.map +1 -1
  23. package/resources/index.js +8 -8
  24. package/resources/index.js.map +1 -1
  25. package/resources/index.mjs +4 -4
  26. package/resources/index.mjs.map +1 -1
  27. package/resources/model-router.d.mts +311 -0
  28. package/resources/model-router.d.mts.map +1 -0
  29. package/resources/model-router.d.ts +311 -0
  30. package/resources/model-router.d.ts.map +1 -0
  31. package/resources/model-router.js +97 -0
  32. package/resources/model-router.js.map +1 -0
  33. package/resources/model-router.mjs +93 -0
  34. package/resources/model-router.mjs.map +1 -0
  35. package/resources/models.d.mts +50 -25
  36. package/resources/models.d.mts.map +1 -1
  37. package/resources/models.d.ts +50 -25
  38. package/resources/models.d.ts.map +1 -1
  39. package/resources/models.js +5 -0
  40. package/resources/models.js.map +1 -1
  41. package/resources/models.mjs +5 -0
  42. package/resources/models.mjs.map +1 -1
  43. package/resources/preferences.d.mts +49 -47
  44. package/resources/preferences.d.mts.map +1 -1
  45. package/resources/preferences.d.ts +49 -47
  46. package/resources/preferences.d.ts.map +1 -1
  47. package/resources/preferences.js +30 -33
  48. package/resources/preferences.js.map +1 -1
  49. package/resources/preferences.mjs +30 -33
  50. package/resources/preferences.mjs.map +1 -1
  51. package/resources/prompt/adapt.d.mts +352 -0
  52. package/resources/prompt/adapt.d.mts.map +1 -0
  53. package/resources/prompt/adapt.d.ts +352 -0
  54. package/resources/prompt/adapt.d.ts.map +1 -0
  55. package/resources/prompt/adapt.js +154 -0
  56. package/resources/prompt/adapt.js.map +1 -0
  57. package/resources/prompt/adapt.mjs +150 -0
  58. package/resources/prompt/adapt.mjs.map +1 -0
  59. package/resources/prompt/index.d.mts +3 -0
  60. package/resources/prompt/index.d.mts.map +1 -0
  61. package/resources/prompt/index.d.ts +3 -0
  62. package/resources/prompt/index.d.ts.map +1 -0
  63. package/resources/prompt/index.js +9 -0
  64. package/resources/prompt/index.js.map +1 -0
  65. package/resources/prompt/index.mjs +4 -0
  66. package/resources/prompt/index.mjs.map +1 -0
  67. package/resources/prompt/prompt.d.mts +338 -0
  68. package/resources/prompt/prompt.d.mts.map +1 -0
  69. package/resources/prompt/prompt.d.ts +338 -0
  70. package/resources/prompt/prompt.d.ts.map +1 -0
  71. package/resources/prompt/prompt.js +128 -0
  72. package/resources/prompt/prompt.js.map +1 -0
  73. package/resources/prompt/prompt.mjs +123 -0
  74. package/resources/prompt/prompt.mjs.map +1 -0
  75. package/resources/prompt.d.mts +2 -0
  76. package/resources/prompt.d.mts.map +1 -0
  77. package/resources/prompt.d.ts +2 -0
  78. package/resources/prompt.d.ts.map +1 -0
  79. package/resources/prompt.js +6 -0
  80. package/resources/prompt.js.map +1 -0
  81. package/resources/prompt.mjs +3 -0
  82. package/resources/prompt.mjs.map +1 -0
  83. package/resources/pzn.d.mts +225 -0
  84. package/resources/pzn.d.mts.map +1 -0
  85. package/resources/pzn.d.ts +225 -0
  86. package/resources/pzn.d.ts.map +1 -0
  87. package/resources/{routing.js → pzn.js} +26 -69
  88. package/resources/pzn.js.map +1 -0
  89. package/resources/{routing.mjs → pzn.mjs} +24 -67
  90. package/resources/pzn.mjs.map +1 -0
  91. package/resources/report/index.d.mts +3 -0
  92. package/resources/report/index.d.mts.map +1 -0
  93. package/resources/report/index.d.ts +3 -0
  94. package/resources/report/index.d.ts.map +1 -0
  95. package/resources/report/index.js +9 -0
  96. package/resources/report/index.js.map +1 -0
  97. package/resources/report/index.mjs +4 -0
  98. package/resources/report/index.mjs.map +1 -0
  99. package/resources/report/metrics.d.mts +87 -0
  100. package/resources/report/metrics.d.mts.map +1 -0
  101. package/resources/report/metrics.d.ts +87 -0
  102. package/resources/report/metrics.d.ts.map +1 -0
  103. package/resources/report/metrics.js +57 -0
  104. package/resources/report/metrics.js.map +1 -0
  105. package/resources/report/metrics.mjs +53 -0
  106. package/resources/report/metrics.mjs.map +1 -0
  107. package/resources/report/report.d.mts +10 -0
  108. package/resources/report/report.d.mts.map +1 -0
  109. package/resources/report/report.d.ts +10 -0
  110. package/resources/report/report.d.ts.map +1 -0
  111. package/resources/report/report.js +17 -0
  112. package/resources/report/report.js.map +1 -0
  113. package/resources/report/report.mjs +12 -0
  114. package/resources/report/report.mjs.map +1 -0
  115. package/resources/report.d.mts +1 -244
  116. package/resources/report.d.mts.map +1 -1
  117. package/resources/report.d.ts +1 -244
  118. package/resources/report.d.ts.map +1 -1
  119. package/resources/report.js +2 -82
  120. package/resources/report.js.map +1 -1
  121. package/resources/report.mjs +1 -80
  122. package/resources/report.mjs.map +1 -1
  123. package/src/client.ts +71 -120
  124. package/src/internal/utils/env.ts +4 -2
  125. package/src/resources/index.ts +24 -34
  126. package/src/resources/model-router.ts +356 -0
  127. package/src/resources/models.ts +55 -32
  128. package/src/resources/preferences.ts +61 -70
  129. package/src/resources/prompt/adapt.ts +402 -0
  130. package/src/resources/prompt/index.ts +16 -0
  131. package/src/resources/prompt/prompt.ts +398 -0
  132. package/src/resources/prompt.ts +3 -0
  133. package/src/resources/pzn.ts +273 -0
  134. package/src/resources/report/index.ts +4 -0
  135. package/src/resources/report/metrics.ts +99 -0
  136. package/src/resources/report/report.ts +19 -0
  137. package/src/resources/report.ts +1 -298
  138. package/src/version.ts +1 -1
  139. package/version.d.mts +1 -1
  140. package/version.d.ts +1 -1
  141. package/version.js +1 -1
  142. package/version.mjs +1 -1
  143. package/resources/admin.d.mts +0 -4
  144. package/resources/admin.d.mts.map +0 -1
  145. package/resources/admin.d.ts +0 -4
  146. package/resources/admin.d.ts.map +0 -1
  147. package/resources/admin.js +0 -9
  148. package/resources/admin.js.map +0 -1
  149. package/resources/admin.mjs +0 -5
  150. package/resources/admin.mjs.map +0 -1
  151. package/resources/prompt-adaptation.d.mts +0 -581
  152. package/resources/prompt-adaptation.d.mts.map +0 -1
  153. package/resources/prompt-adaptation.d.ts +0 -581
  154. package/resources/prompt-adaptation.d.ts.map +0 -1
  155. package/resources/prompt-adaptation.js +0 -289
  156. package/resources/prompt-adaptation.js.map +0 -1
  157. package/resources/prompt-adaptation.mjs +0 -285
  158. package/resources/prompt-adaptation.mjs.map +0 -1
  159. package/resources/routing.d.mts +0 -391
  160. package/resources/routing.d.mts.map +0 -1
  161. package/resources/routing.d.ts +0 -391
  162. package/resources/routing.d.ts.map +0 -1
  163. package/resources/routing.js.map +0 -1
  164. package/resources/routing.mjs.map +0 -1
  165. package/src/resources/admin.ts +0 -5
  166. package/src/resources/prompt-adaptation.ts +0 -707
  167. package/src/resources/routing.ts +0 -476
@@ -1,581 +0,0 @@
1
- import { APIResource } from "../core/resource.js";
2
- import * as PromptAdaptationAPI from "./prompt-adaptation.js";
3
- import { APIPromise } from "../core/api-promise.js";
4
- import { RequestOptions } from "../internal/request-options.js";
5
- export declare class PromptAdaptation extends APIResource {
6
- /**
7
- * Adapt your prompt from one LLM to work optimally across different target LLMs.
8
- *
9
- * This endpoint automatically optimizes your prompt (system prompt + user message
10
- * template) to achieve better performance when switching between different
11
- * language models. Each model has unique characteristics, and what works well for
12
- * GPT-4 might not work as well for Claude or Gemini.
13
- *
14
- * **How Prompt Adaptation Works:**
15
- *
16
- * 1. You provide your current prompt optimized for an origin model
17
- * 2. You specify target models you want to adapt to
18
- * 3. You provide evaluation examples (golden records) with expected answers
19
- * 4. The system runs optimization to find the best prompt for each target model
20
- * 5. You receive adapted prompts that perform well on your target models
21
- *
22
- * **Evaluation Metrics:** Choose either a standard metric or provide custom
23
- * evaluation:
24
- *
25
- * - **Standard metrics**: LLMaaJ:SQL, LLMaaJ:Sem_Sim_1/3/10 (semantic similarity),
26
- * JSON_Match
27
- * - **Custom evaluation**: Provide evaluation_config with your own LLM judge,
28
- * prompt, and cutoff
29
- *
30
- * **Dataset Requirements:**
31
- *
32
- * - Minimum 5 examples in train_goldens (more examples = better adaptation)
33
- * - Each example must have fields matching your template placeholders
34
- * - Supervised evaluation requires 'answer' field in each golden record
35
- * - Unsupervised evaluation can work without answers
36
- *
37
- * **Training Time:**
38
- *
39
- * - Processing is asynchronous and typically takes 10-30 minutes
40
- * - Time depends on: number of target models, dataset size, model availability
41
- * - Use the returned adaptation_run_id to check status and retrieve results
42
- *
43
- * **Subscription Tiers:**
44
- *
45
- * - Free: 1 target model
46
- * - Starter: 3 target models
47
- * - Startup: 5 target models
48
- * - Enterprise: 10 target models
49
- *
50
- * **Best Practices:**
51
- *
52
- * 1. Use diverse, representative examples from your production workload
53
- * 2. Include 10-20 examples for best results (5 minimum)
54
- * 3. Ensure consistent evaluation across all examples
55
- * 4. Test both train_goldens and test_goldens split for validation
56
- * 5. Use the same model versions you'll use in production
57
- *
58
- * **Example Workflow:**
59
- *
60
- * ```
61
- * 1. POST /v2/prompt/adapt - Submit adaptation request
62
- * 2. GET /v2/prompt/adaptStatus/{id} - Poll status until completed
63
- * 3. GET /v2/prompt/adaptResults/{id} - Retrieve optimized prompts
64
- * 4. Use optimized prompts in production with target models
65
- * ```
66
- *
67
- * **Related Documentation:** See
68
- * https://docs.notdiamond.ai/docs/adapting-prompts-to-new-models for detailed
69
- * guide.
70
- *
71
- * @example
72
- * ```ts
73
- * const response = await client.promptAdaptation.adapt({
74
- * fields: ['question'],
75
- * system_prompt: 'You are a helpful assistant that answers questions accurately.',
76
- * target_models: [
77
- * { provider: 'anthropic', model: 'claude-sonnet-4-5-20250929' },
78
- * { provider: 'google', model: 'gemini-1.5-pro' },
79
- * ],
80
- * template: 'Question: {question}\nAnswer:',
81
- * evaluation_metric: 'LLMaaJ:Sem_Sim_3',
82
- * origin_model: { provider: 'openai', model: 'gpt-4o' },
83
- * test_goldens: [
84
- * {
85
- * fields: { ... },
86
- * answer: '9',
87
- * },
88
- * {
89
- * fields: { ... },
90
- * answer: 'Pacific Ocean',
91
- * },
92
- * ],
93
- * train_goldens: [
94
- * {
95
- * fields: { ... },
96
- * answer: '4',
97
- * },
98
- * {
99
- * fields: { ... },
100
- * answer: 'Paris',
101
- * },
102
- * {
103
- * fields: { ... },
104
- * answer: 'William Shakespeare',
105
- * },
106
- * {
107
- * fields: { ... },
108
- * answer: 'Water',
109
- * },
110
- * {
111
- * fields: { ... },
112
- * answer: '7',
113
- * },
114
- * ],
115
- * });
116
- * ```
117
- */
118
- adapt(body: PromptAdaptationAdaptParams, options?: RequestOptions): APIPromise<PromptAdaptationAdaptResponse>;
119
- /**
120
- * Retrieve the complete results of a prompt adaptation run, including optimized
121
- * prompts for all target models.
122
- *
123
- * This endpoint returns the adapted prompts and evaluation metrics for each target
124
- * model in your adaptation request. Call this endpoint after the adaptation status
125
- * is 'completed' to get your optimized prompts.
126
- *
127
- * **Response Structure:**
128
- *
129
- * - **origin_model**: Baseline performance of your original prompt on the origin
130
- * model
131
- * - Includes: system_prompt, user_message_template, score, evaluation metrics,
132
- * cost
133
- * - **target_models**: Array of results for each target model
134
- * - Includes: optimized system_prompt, user_message_template, template_fields
135
- * - pre_optimization_score: Performance before adaptation
136
- * - post_optimization_score: Performance after adaptation
137
- * - Evaluation metrics and cost information
138
- *
139
- * **Using Adapted Prompts:**
140
- *
141
- * 1. Extract the `system_prompt` and `user_message_template` from each target
142
- * model result
143
- * 2. Use `user_message_template_fields` to know which fields to substitute
144
- * 3. Apply the optimized prompts when calling the respective target models
145
- * 4. Compare pre/post optimization scores to see improvement
146
- *
147
- * **Evaluation Scores:**
148
- *
149
- * - Scores range from 0-10 (higher is better)
150
- * - Compare origin_model score with target_models pre_optimization_score for
151
- * baseline
152
- * - Compare pre_optimization_score with post_optimization_score to see improvement
153
- * from adaptation
154
- * - Typical improvements range from 5-30% on evaluation metrics
155
- *
156
- * **Status Handling:**
157
- *
158
- * - If adaptation is still processing, target model results will have
159
- * `result_status: "processing"`
160
- * - Only completed target models will have system_prompt and template values
161
- * - Failed target models will have `result_status: "failed"` with null values
162
- *
163
- * **Cost Information:**
164
- *
165
- * - Each model result includes cost in USD for the adaptation process
166
- * - Costs vary based on model pricing and number of evaluation examples
167
- * - Typical range: $0.10 - $2.00 per target model
168
- *
169
- * **Best Practices:**
170
- *
171
- * 1. Wait for status 'completed' before calling this endpoint
172
- * 2. Check result_status for each target model
173
- * 3. Validate that post_optimization_score > pre_optimization_score
174
- * 4. Save optimized prompts for production use
175
- * 5. A/B test adapted prompts against originals in production
176
- *
177
- * @example
178
- * ```ts
179
- * const adaptationRunResults =
180
- * await client.promptAdaptation.getAdaptResults(
181
- * 'adaptation_run_id',
182
- * );
183
- * ```
184
- */
185
- getAdaptResults(adaptationRunID: string, options?: RequestOptions): APIPromise<AdaptationRunResults>;
186
- /**
187
- * Get Adapt Run Results
188
- *
189
- * @example
190
- * ```ts
191
- * const adaptationRunResults =
192
- * await client.promptAdaptation.getAdaptRunResults(
193
- * 'adaptation_run_id',
194
- * { user_id: 'user_id', 'x-token': 'x-token' },
195
- * );
196
- * ```
197
- */
198
- getAdaptRunResults(adaptationRunID: string, params: PromptAdaptationGetAdaptRunResultsParams, options?: RequestOptions): APIPromise<AdaptationRunResults>;
199
- /**
200
- * Get Adapt Runs
201
- *
202
- * @example
203
- * ```ts
204
- * const adaptationRunResults =
205
- * await client.promptAdaptation.getAdaptRuns('user_id', {
206
- * 'x-token': 'x-token',
207
- * });
208
- * ```
209
- */
210
- getAdaptRuns(userID: string, params: PromptAdaptationGetAdaptRunsParams, options?: RequestOptions): APIPromise<PromptAdaptationGetAdaptRunsResponse>;
211
- /**
212
- * Check the status of a prompt adaptation run.
213
- *
214
- * Use this endpoint to poll the status of your adaptation request. Processing is
215
- * asynchronous, so you'll need to check periodically until the status indicates
216
- * completion.
217
- *
218
- * **Status Values:**
219
- *
220
- * - `created`: Initial state, not yet processing
221
- * - `queued`: Waiting for processing capacity (check queue_position)
222
- * - `processing`: Currently optimizing prompts
223
- * - `completed`: All target models have been processed successfully
224
- * - `failed`: One or more target models failed to process
225
- *
226
- * **Polling Recommendations:**
227
- *
228
- * - Poll every 30-60 seconds during processing
229
- * - Check queue_position if status is 'queued' to estimate wait time
230
- * - Stop polling once status is 'completed' or 'failed'
231
- * - Use GET /v2/prompt/adaptResults to retrieve results after completion
232
- *
233
- * **Queue Position:**
234
- *
235
- * - Only present when status is 'queued'
236
- * - Lower numbers mean earlier processing (position 1 is next)
237
- * - Typical wait time: 1-5 minutes per position
238
- *
239
- * **Note:** This endpoint only returns status information. To get the actual
240
- * adapted prompts and evaluation results, use GET /v2/prompt/adaptResults once
241
- * status is 'completed'.
242
- *
243
- * @example
244
- * ```ts
245
- * const response =
246
- * await client.promptAdaptation.getAdaptStatus(
247
- * 'adaptation_run_id',
248
- * );
249
- * ```
250
- */
251
- getAdaptStatus(adaptationRunID: string, options?: RequestOptions): APIPromise<PromptAdaptationGetAdaptStatusResponse>;
252
- /**
253
- * Get LLM costs for a specific adaptation run
254
- *
255
- * @example
256
- * ```ts
257
- * const response =
258
- * await client.promptAdaptation.retrieveCosts(
259
- * 'adaptation_run_id',
260
- * );
261
- * ```
262
- */
263
- retrieveCosts(adaptationRunID: string, options?: RequestOptions): APIPromise<PromptAdaptationRetrieveCostsResponse>;
264
- }
265
- /**
266
- * Complete results for a prompt adaptation run including all target models.
267
- */
268
- export interface AdaptationRunResults {
269
- /**
270
- * Unique ID for this adaptation run
271
- */
272
- id: string;
273
- /**
274
- * Timestamp when this adaptation run was created
275
- */
276
- created_at: string;
277
- /**
278
- * Overall status of the adaptation run
279
- */
280
- job_status: JobStatus;
281
- /**
282
- * Results for each target model with optimized prompts
283
- */
284
- target_models: Array<AdaptationRunResults.TargetModel>;
285
- /**
286
- * Timestamp of last update to this adaptation run
287
- */
288
- updated_at: string | null;
289
- evaluation_config?: string | null;
290
- evaluation_metric?: string | null;
291
- /**
292
- * Metrics for the LLM requests made during the adaptation run
293
- */
294
- llm_request_metrics?: {
295
- [key: string]: number;
296
- };
297
- /**
298
- * Results for the origin model (baseline performance)
299
- */
300
- origin_model?: AdaptationRunResults.OriginModel | null;
301
- }
302
- export declare namespace AdaptationRunResults {
303
- /**
304
- * Results for a single target model adaptation.
305
- */
306
- interface TargetModel {
307
- cost: number | null;
308
- model_name: string;
309
- post_optimization_evals: {
310
- [key: string]: unknown;
311
- } | null;
312
- post_optimization_score: number | null;
313
- pre_optimization_evals: {
314
- [key: string]: unknown;
315
- } | null;
316
- pre_optimization_score: number | null;
317
- /**
318
- * Status of this specific target model adaptation
319
- */
320
- result_status: PromptAdaptationAPI.JobStatus | null;
321
- /**
322
- * Optimized system prompt for this target model
323
- */
324
- system_prompt: string | null;
325
- task_type: string | null;
326
- /**
327
- * Optimized user message template for this target model
328
- */
329
- user_message_template: string | null;
330
- /**
331
- * Field names used in the optimized template
332
- */
333
- user_message_template_fields: Array<string> | null;
334
- }
335
- /**
336
- * Results for the origin model (baseline performance)
337
- */
338
- interface OriginModel {
339
- cost: number | null;
340
- evals: {
341
- [key: string]: unknown;
342
- } | null;
343
- model_name: string | null;
344
- result_status: PromptAdaptationAPI.JobStatus | null;
345
- score: number | null;
346
- system_prompt: string | null;
347
- user_message_template: string | null;
348
- }
349
- }
350
- export type JobStatus = 'created' | 'queued' | 'processing' | 'completed' | 'failed';
351
- /**
352
- * Response from prompt adaptation request.
353
- */
354
- export interface PromptAdaptationAdaptResponse {
355
- /**
356
- * Unique ID for this adaptation run. Use this to check status and retrieve results
357
- */
358
- adaptation_run_id: string;
359
- }
360
- export type PromptAdaptationGetAdaptRunsResponse = Array<AdaptationRunResults>;
361
- /**
362
- * Status response for a prompt adaptation run.
363
- */
364
- export interface PromptAdaptationGetAdaptStatusResponse {
365
- /**
366
- * Unique ID for this adaptation run. Use this to check status and retrieve results
367
- */
368
- adaptation_run_id: string;
369
- /**
370
- * Current status of the adaptation run (created, queued, processing, completed, or
371
- * failed)
372
- */
373
- status: JobStatus;
374
- /**
375
- * Position in queue if status is 'queued'. Lower numbers mean earlier processing
376
- */
377
- queue_position?: number | null;
378
- }
379
- export interface PromptAdaptationRetrieveCostsResponse {
380
- adaptation_run_id: string;
381
- total_cost: number;
382
- usage_records: Array<PromptAdaptationRetrieveCostsResponse.UsageRecord>;
383
- }
384
- export declare namespace PromptAdaptationRetrieveCostsResponse {
385
- interface UsageRecord {
386
- id: string;
387
- adaptation_run_id: string;
388
- input_cost: number;
389
- input_tokens: number;
390
- model: string;
391
- organization_id: string;
392
- output_cost: number;
393
- output_tokens: number;
394
- provider: string;
395
- task_type: string;
396
- timestamp: number;
397
- total_cost: number;
398
- user_id: string;
399
- }
400
- }
401
- export interface PromptAdaptationAdaptParams {
402
- /**
403
- * List of field names that will be substituted into the template. Must match keys
404
- * in golden records
405
- */
406
- fields: Array<string>;
407
- /**
408
- * System prompt to use with the origin model. This sets the context and role for
409
- * the LLM
410
- */
411
- system_prompt: string;
412
- /**
413
- * List of models to adapt the prompt for. Maximum count depends on your
414
- * subscription tier
415
- */
416
- target_models: Array<PromptAdaptationAdaptParams.TargetModel>;
417
- /**
418
- * User message template with placeholders for fields. Use curly braces for field
419
- * substitution
420
- */
421
- template: string;
422
- evaluation_config?: string | null;
423
- evaluation_metric?: string | null;
424
- /**
425
- * Training examples (legacy parameter). Use train_goldens and test_goldens for
426
- * better control
427
- */
428
- goldens?: Array<PromptAdaptationAdaptParams.Golden> | null;
429
- /**
430
- * Model for specifying an LLM provider in API requests.
431
- */
432
- origin_model?: PromptAdaptationAdaptParams.OriginModel | null;
433
- /**
434
- * Optional baseline score for the origin model
435
- */
436
- origin_model_evaluation_score?: number | null;
437
- /**
438
- * Test examples for evaluation. Required if train_goldens is provided
439
- */
440
- test_goldens?: Array<PromptAdaptationAdaptParams.TestGolden> | null;
441
- /**
442
- * Training examples for prompt optimization. Minimum 5 examples required
443
- */
444
- train_goldens?: Array<PromptAdaptationAdaptParams.TrainGolden> | null;
445
- }
446
- export declare namespace PromptAdaptationAdaptParams {
447
- /**
448
- * Model for specifying an LLM provider in API requests.
449
- */
450
- interface TargetModel {
451
- /**
452
- * Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
453
- */
454
- model: string;
455
- /**
456
- * Provider name (e.g., 'openai', 'anthropic', 'google')
457
- */
458
- provider: string;
459
- /**
460
- * Maximum context length for the model (required for custom models)
461
- */
462
- context_length?: number | null;
463
- /**
464
- * Input token price per million tokens in USD (required for custom models)
465
- */
466
- input_price?: number | null;
467
- /**
468
- * Whether this is a custom model not in Not Diamond's supported model list
469
- */
470
- is_custom?: boolean;
471
- /**
472
- * Average latency in seconds (required for custom models)
473
- */
474
- latency?: number | null;
475
- /**
476
- * Output token price per million tokens in USD (required for custom models)
477
- */
478
- output_price?: number | null;
479
- }
480
- /**
481
- * A training or test example for prompt adaptation.
482
- */
483
- interface Golden {
484
- /**
485
- * Dictionary mapping field names to their values. Keys must match the fields
486
- * specified in the template
487
- */
488
- fields: {
489
- [key: string]: string;
490
- };
491
- /**
492
- * Expected answer for supervised evaluation. Required for supervised metrics,
493
- * optional for unsupervised
494
- */
495
- answer?: string | null;
496
- }
497
- /**
498
- * Model for specifying an LLM provider in API requests.
499
- */
500
- interface OriginModel {
501
- /**
502
- * Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
503
- */
504
- model: string;
505
- /**
506
- * Provider name (e.g., 'openai', 'anthropic', 'google')
507
- */
508
- provider: string;
509
- /**
510
- * Maximum context length for the model (required for custom models)
511
- */
512
- context_length?: number | null;
513
- /**
514
- * Input token price per million tokens in USD (required for custom models)
515
- */
516
- input_price?: number | null;
517
- /**
518
- * Whether this is a custom model not in Not Diamond's supported model list
519
- */
520
- is_custom?: boolean;
521
- /**
522
- * Average latency in seconds (required for custom models)
523
- */
524
- latency?: number | null;
525
- /**
526
- * Output token price per million tokens in USD (required for custom models)
527
- */
528
- output_price?: number | null;
529
- }
530
- /**
531
- * A training or test example for prompt adaptation.
532
- */
533
- interface TestGolden {
534
- /**
535
- * Dictionary mapping field names to their values. Keys must match the fields
536
- * specified in the template
537
- */
538
- fields: {
539
- [key: string]: string;
540
- };
541
- /**
542
- * Expected answer for supervised evaluation. Required for supervised metrics,
543
- * optional for unsupervised
544
- */
545
- answer?: string | null;
546
- }
547
- /**
548
- * A training or test example for prompt adaptation.
549
- */
550
- interface TrainGolden {
551
- /**
552
- * Dictionary mapping field names to their values. Keys must match the fields
553
- * specified in the template
554
- */
555
- fields: {
556
- [key: string]: string;
557
- };
558
- /**
559
- * Expected answer for supervised evaluation. Required for supervised metrics,
560
- * optional for unsupervised
561
- */
562
- answer?: string | null;
563
- }
564
- }
565
- export interface PromptAdaptationGetAdaptRunResultsParams {
566
- /**
567
- * Path param:
568
- */
569
- user_id: string;
570
- /**
571
- * Header param:
572
- */
573
- 'x-token': string;
574
- }
575
- export interface PromptAdaptationGetAdaptRunsParams {
576
- 'x-token': string;
577
- }
578
- export declare namespace PromptAdaptation {
579
- export { type AdaptationRunResults as AdaptationRunResults, type JobStatus as JobStatus, type PromptAdaptationAdaptResponse as PromptAdaptationAdaptResponse, type PromptAdaptationGetAdaptRunsResponse as PromptAdaptationGetAdaptRunsResponse, type PromptAdaptationGetAdaptStatusResponse as PromptAdaptationGetAdaptStatusResponse, type PromptAdaptationRetrieveCostsResponse as PromptAdaptationRetrieveCostsResponse, type PromptAdaptationAdaptParams as PromptAdaptationAdaptParams, type PromptAdaptationGetAdaptRunResultsParams as PromptAdaptationGetAdaptRunResultsParams, type PromptAdaptationGetAdaptRunsParams as PromptAdaptationGetAdaptRunsParams, };
580
- }
581
- //# sourceMappingURL=prompt-adaptation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt-adaptation.d.ts","sourceRoot":"","sources":["../src/resources/prompt-adaptation.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,mBAAmB;OACxB,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+GG;IACH,KAAK,CACH,IAAI,EAAE,2BAA2B,EACjC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,6BAA6B,CAAC;IAI5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiEG;IACH,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAIpG;;;;;;;;;;;OAWG;IACH,kBAAkB,CAChB,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,wCAAwC,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAQnC;;;;;;;;;;OAUG;IACH,YAAY,CACV,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,kCAAkC,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oCAAoC,CAAC;IAQnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,cAAc,CACZ,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,sCAAsC,CAAC;IAIrD;;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