notdiamond 2.0.0-rc5 → 2.1.0

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 (144) hide show
  1. package/CHANGELOG.md +170 -0
  2. package/LICENSE +1 -1
  3. package/README.md +276 -148
  4. package/client.d.mts +16 -19
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +16 -19
  7. package/client.d.ts.map +1 -1
  8. package/client.js +11 -14
  9. package/client.js.map +1 -1
  10. package/client.mjs +11 -14
  11. package/client.mjs.map +1 -1
  12. package/internal/tslib.js +17 -17
  13. package/package.json +3 -3
  14. package/resources/{pzn.d.mts → custom-router.d.mts} +16 -96
  15. package/resources/custom-router.d.mts.map +1 -0
  16. package/resources/{pzn.d.ts → custom-router.d.ts} +16 -96
  17. package/resources/custom-router.d.ts.map +1 -0
  18. package/resources/{pzn.js → custom-router.js} +13 -50
  19. package/resources/custom-router.js.map +1 -0
  20. package/resources/{pzn.mjs → custom-router.mjs} +11 -48
  21. package/resources/custom-router.mjs.map +1 -0
  22. package/resources/index.d.mts +4 -5
  23. package/resources/index.d.mts.map +1 -1
  24. package/resources/index.d.ts +4 -5
  25. package/resources/index.d.ts.map +1 -1
  26. package/resources/index.js +5 -7
  27. package/resources/index.js.map +1 -1
  28. package/resources/index.mjs +2 -3
  29. package/resources/index.mjs.map +1 -1
  30. package/resources/model-router.d.mts +6 -123
  31. package/resources/model-router.d.mts.map +1 -1
  32. package/resources/model-router.d.ts +6 -123
  33. package/resources/model-router.d.ts.map +1 -1
  34. package/resources/model-router.js +3 -32
  35. package/resources/model-router.js.map +1 -1
  36. package/resources/model-router.mjs +3 -32
  37. package/resources/model-router.mjs.map +1 -1
  38. package/resources/preferences.d.mts +4 -23
  39. package/resources/preferences.d.mts.map +1 -1
  40. package/resources/preferences.d.ts +4 -23
  41. package/resources/preferences.d.ts.map +1 -1
  42. package/resources/preferences.js +3 -25
  43. package/resources/preferences.js.map +1 -1
  44. package/resources/preferences.mjs +3 -25
  45. package/resources/preferences.mjs.map +1 -1
  46. package/resources/prompt-adaptation.d.mts +687 -0
  47. package/resources/prompt-adaptation.d.mts.map +1 -0
  48. package/resources/prompt-adaptation.d.ts +687 -0
  49. package/resources/prompt-adaptation.d.ts.map +1 -0
  50. package/resources/prompt-adaptation.js +258 -0
  51. package/resources/prompt-adaptation.js.map +1 -0
  52. package/resources/prompt-adaptation.mjs +254 -0
  53. package/resources/prompt-adaptation.mjs.map +1 -0
  54. package/src/client.ts +37 -44
  55. package/src/resources/{pzn.ts → custom-router.ts} +17 -122
  56. package/src/resources/index.ts +14 -16
  57. package/src/resources/model-router.ts +5 -139
  58. package/src/resources/preferences.ts +3 -34
  59. package/src/resources/prompt-adaptation.ts +780 -0
  60. package/src/version.ts +1 -1
  61. package/version.d.mts +1 -1
  62. package/version.d.mts.map +1 -1
  63. package/version.d.ts +1 -1
  64. package/version.d.ts.map +1 -1
  65. package/version.js +1 -1
  66. package/version.js.map +1 -1
  67. package/version.mjs +1 -1
  68. package/version.mjs.map +1 -1
  69. package/resources/prompt/adapt.d.mts +0 -352
  70. package/resources/prompt/adapt.d.mts.map +0 -1
  71. package/resources/prompt/adapt.d.ts +0 -352
  72. package/resources/prompt/adapt.d.ts.map +0 -1
  73. package/resources/prompt/adapt.js +0 -154
  74. package/resources/prompt/adapt.js.map +0 -1
  75. package/resources/prompt/adapt.mjs +0 -150
  76. package/resources/prompt/adapt.mjs.map +0 -1
  77. package/resources/prompt/index.d.mts +0 -3
  78. package/resources/prompt/index.d.mts.map +0 -1
  79. package/resources/prompt/index.d.ts +0 -3
  80. package/resources/prompt/index.d.ts.map +0 -1
  81. package/resources/prompt/index.js +0 -9
  82. package/resources/prompt/index.js.map +0 -1
  83. package/resources/prompt/index.mjs +0 -4
  84. package/resources/prompt/index.mjs.map +0 -1
  85. package/resources/prompt/prompt.d.mts +0 -338
  86. package/resources/prompt/prompt.d.mts.map +0 -1
  87. package/resources/prompt/prompt.d.ts +0 -338
  88. package/resources/prompt/prompt.d.ts.map +0 -1
  89. package/resources/prompt/prompt.js +0 -128
  90. package/resources/prompt/prompt.js.map +0 -1
  91. package/resources/prompt/prompt.mjs +0 -123
  92. package/resources/prompt/prompt.mjs.map +0 -1
  93. package/resources/prompt.d.mts +0 -2
  94. package/resources/prompt.d.mts.map +0 -1
  95. package/resources/prompt.d.ts +0 -2
  96. package/resources/prompt.d.ts.map +0 -1
  97. package/resources/prompt.js +0 -6
  98. package/resources/prompt.js.map +0 -1
  99. package/resources/prompt.mjs +0 -3
  100. package/resources/prompt.mjs.map +0 -1
  101. package/resources/pzn.d.mts.map +0 -1
  102. package/resources/pzn.d.ts.map +0 -1
  103. package/resources/pzn.js.map +0 -1
  104. package/resources/pzn.mjs.map +0 -1
  105. package/resources/report/index.d.mts +0 -3
  106. package/resources/report/index.d.mts.map +0 -1
  107. package/resources/report/index.d.ts +0 -3
  108. package/resources/report/index.d.ts.map +0 -1
  109. package/resources/report/index.js +0 -9
  110. package/resources/report/index.js.map +0 -1
  111. package/resources/report/index.mjs +0 -4
  112. package/resources/report/index.mjs.map +0 -1
  113. package/resources/report/metrics.d.mts +0 -87
  114. package/resources/report/metrics.d.mts.map +0 -1
  115. package/resources/report/metrics.d.ts +0 -87
  116. package/resources/report/metrics.d.ts.map +0 -1
  117. package/resources/report/metrics.js +0 -57
  118. package/resources/report/metrics.js.map +0 -1
  119. package/resources/report/metrics.mjs +0 -53
  120. package/resources/report/metrics.mjs.map +0 -1
  121. package/resources/report/report.d.mts +0 -10
  122. package/resources/report/report.d.mts.map +0 -1
  123. package/resources/report/report.d.ts +0 -10
  124. package/resources/report/report.d.ts.map +0 -1
  125. package/resources/report/report.js +0 -17
  126. package/resources/report/report.js.map +0 -1
  127. package/resources/report/report.mjs +0 -12
  128. package/resources/report/report.mjs.map +0 -1
  129. package/resources/report.d.mts +0 -2
  130. package/resources/report.d.mts.map +0 -1
  131. package/resources/report.d.ts +0 -2
  132. package/resources/report.d.ts.map +0 -1
  133. package/resources/report.js +0 -6
  134. package/resources/report.js.map +0 -1
  135. package/resources/report.mjs +0 -3
  136. package/resources/report.mjs.map +0 -1
  137. package/src/resources/prompt/adapt.ts +0 -402
  138. package/src/resources/prompt/index.ts +0 -16
  139. package/src/resources/prompt/prompt.ts +0 -398
  140. package/src/resources/prompt.ts +0 -3
  141. package/src/resources/report/index.ts +0 -4
  142. package/src/resources/report/metrics.ts +0 -99
  143. package/src/resources/report/report.ts +0 -19
  144. package/src/resources/report.ts +0 -3
@@ -1,398 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../core/resource';
4
- import * as PromptAPI from './prompt';
5
- import * as AdaptAPI from './adapt';
6
- import {
7
- Adapt,
8
- AdaptCreateParams,
9
- AdaptCreateResponse,
10
- AdaptGetCostsResponse,
11
- GoldenRecord,
12
- RequestProvider,
13
- } from './adapt';
14
- import { APIPromise } from '../../core/api-promise';
15
- import { RequestOptions } from '../../internal/request-options';
16
- import { path } from '../../internal/utils/path';
17
-
18
- export class Prompt extends APIResource {
19
- adapt: AdaptAPI.Adapt = new AdaptAPI.Adapt(this._client);
20
-
21
- /**
22
- * Retrieve the complete results of a prompt adaptation run, including optimized
23
- * prompts for all target models.
24
- *
25
- * This endpoint returns the adapted prompts and evaluation metrics for each target
26
- * model in your adaptation request. Call this endpoint after the adaptation status
27
- * is 'completed' to get your optimized prompts.
28
- *
29
- * **Response Structure:**
30
- *
31
- * - **origin_model**: Baseline performance of your original prompt on the origin
32
- * model
33
- * - Includes: system_prompt, user_message_template, score, evaluation metrics,
34
- * cost
35
- * - **target_models**: Array of results for each target model
36
- * - Includes: optimized system_prompt, user_message_template, template_fields
37
- * - pre_optimization_score: Performance before adaptation
38
- * - post_optimization_score: Performance after adaptation
39
- * - Evaluation metrics and cost information
40
- *
41
- * **Using Adapted Prompts:**
42
- *
43
- * 1. Extract the `system_prompt` and `user_message_template` from each target
44
- * model result
45
- * 2. Use `user_message_template_fields` to know which fields to substitute
46
- * 3. Apply the optimized prompts when calling the respective target models
47
- * 4. Compare pre/post optimization scores to see improvement
48
- *
49
- * **Evaluation Scores:**
50
- *
51
- * - Scores range from 0-10 (higher is better)
52
- * - Compare origin_model score with target_models pre_optimization_score for
53
- * baseline
54
- * - Compare pre_optimization_score with post_optimization_score to see improvement
55
- * from adaptation
56
- * - Typical improvements range from 5-30% on evaluation metrics
57
- *
58
- * **Status Handling:**
59
- *
60
- * - If adaptation is still processing, target model results will have
61
- * `result_status: "processing"`
62
- * - Only completed target models will have system_prompt and template values
63
- * - Failed target models will have `result_status: "failed"` with null values
64
- *
65
- * **Cost Information:**
66
- *
67
- * - Each model result includes cost in USD for the adaptation process
68
- * - Costs vary based on model pricing and number of evaluation examples
69
- * - Typical range: $0.10 - $2.00 per target model
70
- *
71
- * **Best Practices:**
72
- *
73
- * 1. Wait for status 'completed' before calling this endpoint
74
- * 2. Check result_status for each target model
75
- * 3. Validate that post_optimization_score > pre_optimization_score
76
- * 4. Save optimized prompts for production use
77
- * 5. A/B test adapted prompts against originals in production
78
- *
79
- * @example
80
- * ```ts
81
- * const response = await client.prompt.getAdaptResults(
82
- * 'adaptation_run_id',
83
- * );
84
- * ```
85
- */
86
- getAdaptResults(
87
- adaptationRunID: string,
88
- options?: RequestOptions,
89
- ): APIPromise<PromptGetAdaptResultsResponse> {
90
- return this._client.get(path`/v2/prompt/adaptResults/${adaptationRunID}`, options);
91
- }
92
-
93
- /**
94
- * Check the status of a prompt adaptation run.
95
- *
96
- * Use this endpoint to poll the status of your adaptation request. Processing is
97
- * asynchronous, so you'll need to check periodically until the status indicates
98
- * completion.
99
- *
100
- * **Status Values:**
101
- *
102
- * - `created`: Initial state, not yet processing
103
- * - `queued`: Waiting for processing capacity (check queue_position)
104
- * - `processing`: Currently optimizing prompts
105
- * - `completed`: All target models have been processed successfully
106
- * - `failed`: One or more target models failed to process
107
- *
108
- * **Polling Recommendations:**
109
- *
110
- * - Poll every 30-60 seconds during processing
111
- * - Check queue_position if status is 'queued' to estimate wait time
112
- * - Stop polling once status is 'completed' or 'failed'
113
- * - Use GET /v2/prompt/adaptResults to retrieve results after completion
114
- *
115
- * **Queue Position:**
116
- *
117
- * - Only present when status is 'queued'
118
- * - Lower numbers mean earlier processing (position 1 is next)
119
- * - Typical wait time: 1-5 minutes per position
120
- *
121
- * **Note:** This endpoint only returns status information. To get the actual
122
- * adapted prompts and evaluation results, use GET /v2/prompt/adaptResults once
123
- * status is 'completed'.
124
- *
125
- * @example
126
- * ```ts
127
- * const response = await client.prompt.getAdaptStatus(
128
- * 'adaptation_run_id',
129
- * );
130
- * ```
131
- */
132
- getAdaptStatus(
133
- adaptationRunID: string,
134
- options?: RequestOptions,
135
- ): APIPromise<PromptGetAdaptStatusResponse> {
136
- return this._client.get(path`/v2/prompt/adaptStatus/${adaptationRunID}`, options);
137
- }
138
- }
139
-
140
- /**
141
- * Status enum for asynchronous jobs (prompt adaptation, custom router training,
142
- * etc.).
143
- *
144
- * Represents the current state of a long-running operation:
145
- *
146
- * - **created**: Job has been initialized but not yet queued
147
- * - **queued**: Job is waiting in the queue to be processed
148
- * - **processing**: Job is currently being executed
149
- * - **completed**: Job finished successfully and results are available
150
- * - **failed**: Job encountered an error and did not complete
151
- */
152
- export type JobStatus = 'created' | 'queued' | 'processing' | 'completed' | 'failed';
153
-
154
- /**
155
- * Response model for GET /v2/prompt/adaptResults/{adaptation_run_id} endpoint.
156
- *
157
- * Contains the complete results of a prompt adaptation run, including optimized
158
- * prompts and evaluation metrics for all target models. Use this to retrieve your
159
- * adapted prompts after the adaptation status is 'completed'.
160
- *
161
- * The response includes:
162
- *
163
- * - Baseline performance of your original prompt on the origin model
164
- * - Optimized prompts for each target model with pre/post optimization scores
165
- * - Evaluation metrics and cost information for each model
166
- */
167
- export interface PromptGetAdaptResultsResponse {
168
- /**
169
- * Unique ID for this adaptation run
170
- */
171
- id: string;
172
-
173
- /**
174
- * Timestamp when this adaptation run was created
175
- */
176
- created_at: string;
177
-
178
- /**
179
- * Overall status of the adaptation run (queued, running, completed, failed)
180
- */
181
- job_status: JobStatus;
182
-
183
- /**
184
- * Results for each target model with optimized prompts and improvement scores
185
- */
186
- target_models: Array<PromptGetAdaptResultsResponse.TargetModel>;
187
-
188
- /**
189
- * Timestamp of last update to this adaptation run
190
- */
191
- updated_at: string | null;
192
-
193
- evaluation_config?: string | null;
194
-
195
- evaluation_metric?: string | null;
196
-
197
- /**
198
- * Metrics for the LLM requests made during the adaptation run (e.g.,
199
- * total_requests, avg_latency)
200
- */
201
- llm_request_metrics?: { [key: string]: number };
202
-
203
- /**
204
- * Baseline results for the origin model in prompt adaptation.
205
- *
206
- * Part of AdaptationRunResultsResponse. Contains the performance metrics and
207
- * prompt configuration for your original prompt on the origin model. This serves
208
- * as the baseline to compare against optimized prompts for target models.
209
- *
210
- * **Fields include:**
211
- *
212
- * - Original system prompt and user message template
213
- * - Baseline performance score and evaluation metrics
214
- * - Cost of running the baseline evaluation
215
- * - Job status for the origin model evaluation
216
- */
217
- origin_model?: PromptGetAdaptResultsResponse.OriginModel | null;
218
- }
219
-
220
- export namespace PromptGetAdaptResultsResponse {
221
- /**
222
- * Optimized prompt results for a single target model in prompt adaptation.
223
- *
224
- * Part of AdaptationRunResultsResponse. Contains the optimized system prompt and
225
- * user message template for a specific target model, along with performance scores
226
- * before and after optimization. Use these optimized prompts with the target model
227
- * to achieve better performance than the original prompt.
228
- *
229
- * **Key metrics:**
230
- *
231
- * - **pre_optimization_score**: Performance with original prompt on this target
232
- * model
233
- * - **post_optimization_score**: Performance with optimized prompt on this target
234
- * model
235
- * - **Score improvement**: post - pre shows how much optimization helped
236
- *
237
- * **Usage:**
238
- *
239
- * 1. Extract the optimized system_prompt and user_message_template
240
- * 2. Replace placeholders in user_message_template using fields from your data
241
- * 3. Use these prompts when calling this target model
242
- * 4. Compare pre/post scores to see improvement gained
243
- */
244
- export interface TargetModel {
245
- cost: number | null;
246
-
247
- model_name: string;
248
-
249
- post_optimization_evals: { [key: string]: unknown } | null;
250
-
251
- post_optimization_score: number | null;
252
-
253
- pre_optimization_evals: { [key: string]: unknown } | null;
254
-
255
- pre_optimization_score: number | null;
256
-
257
- task_type: string | null;
258
-
259
- /**
260
- * Status enum for asynchronous jobs (prompt adaptation, custom router training,
261
- * etc.).
262
- *
263
- * Represents the current state of a long-running operation:
264
- *
265
- * - **created**: Job has been initialized but not yet queued
266
- * - **queued**: Job is waiting in the queue to be processed
267
- * - **processing**: Job is currently being executed
268
- * - **completed**: Job finished successfully and results are available
269
- * - **failed**: Job encountered an error and did not complete
270
- */
271
- result_status?: PromptAPI.JobStatus | null;
272
-
273
- /**
274
- * Optimized system prompt for this target model. Use this as the system message in
275
- * your LLM calls
276
- */
277
- system_prompt?: string | null;
278
-
279
- /**
280
- * Optimized user message template with placeholders. Substitute fields using your
281
- * data before calling the LLM
282
- */
283
- user_message_template?: string | null;
284
-
285
- /**
286
- * List of field names to substitute in the template (e.g., ['question',
287
- * 'context']). These match the curly-brace placeholders in user_message_template
288
- */
289
- user_message_template_fields?: Array<string> | null;
290
- }
291
-
292
- /**
293
- * Baseline results for the origin model in prompt adaptation.
294
- *
295
- * Part of AdaptationRunResultsResponse. Contains the performance metrics and
296
- * prompt configuration for your original prompt on the origin model. This serves
297
- * as the baseline to compare against optimized prompts for target models.
298
- *
299
- * **Fields include:**
300
- *
301
- * - Original system prompt and user message template
302
- * - Baseline performance score and evaluation metrics
303
- * - Cost of running the baseline evaluation
304
- * - Job status for the origin model evaluation
305
- */
306
- export interface OriginModel {
307
- cost: number | null;
308
-
309
- evals: { [key: string]: unknown } | null;
310
-
311
- model_name: string | null;
312
-
313
- score: number | null;
314
-
315
- /**
316
- * Status enum for asynchronous jobs (prompt adaptation, custom router training,
317
- * etc.).
318
- *
319
- * Represents the current state of a long-running operation:
320
- *
321
- * - **created**: Job has been initialized but not yet queued
322
- * - **queued**: Job is waiting in the queue to be processed
323
- * - **processing**: Job is currently being executed
324
- * - **completed**: Job finished successfully and results are available
325
- * - **failed**: Job encountered an error and did not complete
326
- */
327
- result_status?: PromptAPI.JobStatus | null;
328
-
329
- /**
330
- * Original system prompt used for the origin model
331
- */
332
- system_prompt?: string | null;
333
-
334
- /**
335
- * Original user message template used for the origin model
336
- */
337
- user_message_template?: string | null;
338
- }
339
- }
340
-
341
- /**
342
- * Response model for GET /v2/prompt/adaptStatus/{adaptation_run_id} endpoint.
343
- *
344
- * Returns the current status of an asynchronous prompt adaptation job. Poll this
345
- * endpoint periodically to track progress. When status is 'completed', you can
346
- * retrieve the optimized prompts using the /adaptResults endpoint.
347
- *
348
- * **Status values:**
349
- *
350
- * - **created**: Job has been initialized
351
- * - **queued**: Waiting in queue (check queue_position for your place in line)
352
- * - **processing**: Currently running optimization
353
- * - **completed**: Finished successfully, results available via /adaptResults
354
- * - **failed**: Encountered an error during processing
355
- *
356
- * **Polling recommendations:**
357
- *
358
- * - Poll every 30-60 seconds while status is incomplete
359
- * - Stop polling once status is 'completed' or 'failed'
360
- * - Adaptation typically takes 10-30 minutes total
361
- */
362
- export interface PromptGetAdaptStatusResponse {
363
- /**
364
- * Unique identifier for this adaptation run. Use this to poll status and retrieve
365
- * optimized prompts when complete
366
- */
367
- adaptation_run_id: string;
368
-
369
- /**
370
- * Current status of the adaptation run. Poll until this is 'completed' or 'failed'
371
- */
372
- status: JobStatus;
373
-
374
- /**
375
- * Position in queue when status is 'queued'. Lower numbers process sooner. Null
376
- * when not queued
377
- */
378
- queue_position?: number | null;
379
- }
380
-
381
- Prompt.Adapt = Adapt;
382
-
383
- export declare namespace Prompt {
384
- export {
385
- type JobStatus as JobStatus,
386
- type PromptGetAdaptResultsResponse as PromptGetAdaptResultsResponse,
387
- type PromptGetAdaptStatusResponse as PromptGetAdaptStatusResponse,
388
- };
389
-
390
- export {
391
- Adapt as Adapt,
392
- type GoldenRecord as GoldenRecord,
393
- type RequestProvider as RequestProvider,
394
- type AdaptCreateResponse as AdaptCreateResponse,
395
- type AdaptGetCostsResponse as AdaptGetCostsResponse,
396
- type AdaptCreateParams as AdaptCreateParams,
397
- };
398
- }
@@ -1,3 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export * from './prompt/index';
@@ -1,4 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export { Metrics, type MetricSubmitFeedbackResponse, type MetricSubmitFeedbackParams } from './metrics';
4
- export { Report } from './report';
@@ -1,99 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../core/resource';
4
- import * as AdaptAPI from '../prompt/adapt';
5
- import { APIPromise } from '../../core/api-promise';
6
- import { RequestOptions } from '../../internal/request-options';
7
-
8
- export class Metrics extends APIResource {
9
- /**
10
- * Submit feedback on a routing decision to improve future recommendations.
11
- *
12
- * This endpoint allows you to provide feedback on whether the router selected the
13
- * right model for your query. Your feedback is used to:
14
- *
15
- * 1. Personalize routing decisions for your preference_id
16
- * 2. Improve the overall routing quality
17
- * 3. Train and refine custom routers
18
- *
19
- * **Feedback Format:**
20
- *
21
- * - `accuracy: 1` - Thumbs up (the model performed well)
22
- * - `accuracy: 0` - Thumbs down (the model did not perform well)
23
- *
24
- * **Requirements:**
25
- *
26
- * - You must have used a preference_id in the original model_select() call
27
- * - The session_id must be valid and belong to your account
28
- * - The provider must match one of the providers returned by model_select()
29
- *
30
- * **How Feedback Works:** When you submit thumbs down, the router will:
31
- *
32
- * - Decrease the ranking of the selected model for similar queries
33
- * - Consider alternative models more favorably
34
- *
35
- * When you submit thumbs up, the router will:
36
- *
37
- * - Increase the ranking of the selected model for similar queries
38
- * - Prioritize this model for similar future requests
39
- *
40
- * **Note:** Feedback requires a valid preference_id. Create one via POST
41
- * /v2/preferences/userPreferenceCreate
42
- *
43
- * @example
44
- * ```ts
45
- * const response = await client.report.metrics.submitFeedback(
46
- * {
47
- * feedback: { accuracy: 1 },
48
- * provider: { provider: 'openai', model: 'gpt-4o' },
49
- * session_id: '550e8400-e29b-41d4-a716-446655440000',
50
- * },
51
- * );
52
- * ```
53
- */
54
- submitFeedback(
55
- body: MetricSubmitFeedbackParams,
56
- options?: RequestOptions,
57
- ): APIPromise<MetricSubmitFeedbackResponse> {
58
- return this._client.post('/v2/report/metrics/feedback', { body, ...options });
59
- }
60
- }
61
-
62
- /**
63
- * Response from feedback submission endpoint.
64
- */
65
- export interface MetricSubmitFeedbackResponse {
66
- /**
67
- * The processed feedback
68
- */
69
- feedback: { [key: string]: unknown };
70
-
71
- /**
72
- * The session ID for which feedback was submitted
73
- */
74
- session_id: string;
75
- }
76
-
77
- export interface MetricSubmitFeedbackParams {
78
- /**
79
- * Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
80
- */
81
- feedback: { [key: string]: unknown };
82
-
83
- /**
84
- * The provider that was selected by the router
85
- */
86
- provider: AdaptAPI.RequestProvider;
87
-
88
- /**
89
- * Session ID returned from POST /v2/modelRouter/modelSelect
90
- */
91
- session_id: string;
92
- }
93
-
94
- export declare namespace Metrics {
95
- export {
96
- type MetricSubmitFeedbackResponse as MetricSubmitFeedbackResponse,
97
- type MetricSubmitFeedbackParams as MetricSubmitFeedbackParams,
98
- };
99
- }
@@ -1,19 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../core/resource';
4
- import * as MetricsAPI from './metrics';
5
- import { MetricSubmitFeedbackParams, MetricSubmitFeedbackResponse, Metrics } from './metrics';
6
-
7
- export class Report extends APIResource {
8
- metrics: MetricsAPI.Metrics = new MetricsAPI.Metrics(this._client);
9
- }
10
-
11
- Report.Metrics = Metrics;
12
-
13
- export declare namespace Report {
14
- export {
15
- Metrics as Metrics,
16
- type MetricSubmitFeedbackResponse as MetricSubmitFeedbackResponse,
17
- type MetricSubmitFeedbackParams as MetricSubmitFeedbackParams,
18
- };
19
- }
@@ -1,3 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export * from './report/index';