notdiamond 2.0.0-rc2 → 2.0.0-rc20

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 (147) hide show
  1. package/CHANGELOG.md +185 -0
  2. package/LICENSE +1 -1
  3. package/README.md +261 -168
  4. package/client.d.mts +26 -43
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +26 -43
  7. package/client.d.ts.map +1 -1
  8. package/client.js +49 -68
  9. package/client.js.map +1 -1
  10. package/client.mjs +47 -66
  11. package/client.mjs.map +1 -1
  12. package/core/api-promise.d.mts +2 -2
  13. package/core/api-promise.d.ts +2 -2
  14. package/core/error.d.mts +2 -2
  15. package/core/error.d.ts +2 -2
  16. package/core/error.js +4 -4
  17. package/core/error.mjs +2 -2
  18. package/core/resource.d.mts +3 -3
  19. package/core/resource.d.ts +3 -3
  20. package/index.d.mts +3 -3
  21. package/index.d.ts +3 -3
  22. package/index.js +4 -4
  23. package/index.mjs +3 -3
  24. package/internal/parse.d.mts +2 -2
  25. package/internal/parse.d.ts +2 -2
  26. package/internal/shims.js +1 -1
  27. package/internal/shims.mjs +1 -1
  28. package/internal/uploads.d.mts +4 -4
  29. package/internal/uploads.d.ts +4 -4
  30. package/internal/utils/base64.js +2 -2
  31. package/internal/utils/base64.mjs +3 -3
  32. package/internal/utils/env.d.mts.map +1 -1
  33. package/internal/utils/env.d.ts.map +1 -1
  34. package/internal/utils/env.js +4 -2
  35. package/internal/utils/env.js.map +1 -1
  36. package/internal/utils/env.mjs +4 -2
  37. package/internal/utils/env.mjs.map +1 -1
  38. package/internal/utils/log.d.mts +3 -3
  39. package/internal/utils/log.d.ts +3 -3
  40. package/internal/utils/path.js +1 -1
  41. package/internal/utils/path.mjs +2 -2
  42. package/internal/utils/values.js +5 -5
  43. package/internal/utils/values.mjs +6 -6
  44. package/package.json +11 -12
  45. package/resources/custom-router.d.mts +145 -0
  46. package/resources/custom-router.d.mts.map +1 -0
  47. package/resources/custom-router.d.ts +145 -0
  48. package/resources/custom-router.d.ts.map +1 -0
  49. package/resources/custom-router.js +83 -0
  50. package/resources/custom-router.js.map +1 -0
  51. package/resources/custom-router.mjs +79 -0
  52. package/resources/custom-router.mjs.map +1 -0
  53. package/resources/index.d.mts +5 -6
  54. package/resources/index.d.mts.map +1 -1
  55. package/resources/index.d.ts +5 -6
  56. package/resources/index.d.ts.map +1 -1
  57. package/resources/index.js +5 -7
  58. package/resources/index.js.map +1 -1
  59. package/resources/index.mjs +2 -3
  60. package/resources/index.mjs.map +1 -1
  61. package/resources/model-router.d.mts +194 -0
  62. package/resources/model-router.d.mts.map +1 -0
  63. package/resources/model-router.d.ts +194 -0
  64. package/resources/model-router.d.ts.map +1 -0
  65. package/resources/model-router.js +68 -0
  66. package/resources/model-router.js.map +1 -0
  67. package/resources/model-router.mjs +64 -0
  68. package/resources/model-router.mjs.map +1 -0
  69. package/resources/models.d.mts +50 -25
  70. package/resources/models.d.mts.map +1 -1
  71. package/resources/models.d.ts +50 -25
  72. package/resources/models.d.ts.map +1 -1
  73. package/resources/models.js +5 -0
  74. package/resources/models.js.map +1 -1
  75. package/resources/models.mjs +5 -0
  76. package/resources/models.mjs.map +1 -1
  77. package/resources/preferences.d.mts +37 -54
  78. package/resources/preferences.d.mts.map +1 -1
  79. package/resources/preferences.d.ts +37 -54
  80. package/resources/preferences.d.ts.map +1 -1
  81. package/resources/preferences.js +17 -42
  82. package/resources/preferences.js.map +1 -1
  83. package/resources/preferences.mjs +17 -42
  84. package/resources/preferences.mjs.map +1 -1
  85. package/resources/prompt-adaptation.d.mts +340 -249
  86. package/resources/prompt-adaptation.d.mts.map +1 -1
  87. package/resources/prompt-adaptation.d.ts +340 -249
  88. package/resources/prompt-adaptation.d.ts.map +1 -1
  89. package/resources/prompt-adaptation.js +36 -79
  90. package/resources/prompt-adaptation.js.map +1 -1
  91. package/resources/prompt-adaptation.mjs +36 -79
  92. package/resources/prompt-adaptation.mjs.map +1 -1
  93. package/src/client.ts +72 -128
  94. package/src/core/api-promise.ts +4 -4
  95. package/src/core/error.ts +2 -2
  96. package/src/core/resource.ts +3 -3
  97. package/src/index.ts +3 -3
  98. package/src/internal/parse.ts +2 -2
  99. package/src/internal/shims.ts +1 -1
  100. package/src/internal/uploads.ts +5 -5
  101. package/src/internal/utils/base64.ts +3 -3
  102. package/src/internal/utils/env.ts +4 -2
  103. package/src/internal/utils/log.ts +3 -3
  104. package/src/internal/utils/path.ts +2 -2
  105. package/src/internal/utils/values.ts +6 -6
  106. package/src/resources/custom-router.ts +168 -0
  107. package/src/resources/index.ts +20 -32
  108. package/src/resources/model-router.ts +222 -0
  109. package/src/resources/models.ts +55 -32
  110. package/src/resources/preferences.ts +43 -83
  111. package/src/resources/prompt-adaptation.ts +358 -300
  112. package/src/version.ts +1 -1
  113. package/version.d.mts +1 -1
  114. package/version.d.mts.map +1 -1
  115. package/version.d.ts +1 -1
  116. package/version.d.ts.map +1 -1
  117. package/version.js +1 -1
  118. package/version.js.map +1 -1
  119. package/version.mjs +1 -1
  120. package/version.mjs.map +1 -1
  121. package/resources/admin.d.mts +0 -4
  122. package/resources/admin.d.mts.map +0 -1
  123. package/resources/admin.d.ts +0 -4
  124. package/resources/admin.d.ts.map +0 -1
  125. package/resources/admin.js +0 -9
  126. package/resources/admin.js.map +0 -1
  127. package/resources/admin.mjs +0 -5
  128. package/resources/admin.mjs.map +0 -1
  129. package/resources/report.d.mts +0 -245
  130. package/resources/report.d.mts.map +0 -1
  131. package/resources/report.d.ts +0 -245
  132. package/resources/report.d.ts.map +0 -1
  133. package/resources/report.js +0 -86
  134. package/resources/report.js.map +0 -1
  135. package/resources/report.mjs +0 -82
  136. package/resources/report.mjs.map +0 -1
  137. package/resources/routing.d.mts +0 -391
  138. package/resources/routing.d.mts.map +0 -1
  139. package/resources/routing.d.ts +0 -391
  140. package/resources/routing.d.ts.map +0 -1
  141. package/resources/routing.js +0 -163
  142. package/resources/routing.js.map +0 -1
  143. package/resources/routing.mjs +0 -159
  144. package/resources/routing.mjs.map +0 -1
  145. package/src/resources/admin.ts +0 -5
  146. package/src/resources/report.ts +0 -300
  147. package/src/resources/routing.ts +0 -476
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '2.0.0-rc2'; // x-release-please-version
1
+ export const VERSION = '2.0.0-rc20'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.0-rc2";
1
+ export declare const VERSION = "2.0.0-rc20";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,cAAc,CAAC"}
1
+ {"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,eAAe,CAAC"}
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "2.0.0-rc2";
1
+ export declare const VERSION = "2.0.0-rc20";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,cAAc,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,eAAe,CAAC"}
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '2.0.0-rc2'; // x-release-please-version
4
+ exports.VERSION = '2.0.0-rc20'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,WAAW,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,YAAY,CAAC,CAAC,2BAA2B"}
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '2.0.0-rc2'; // x-release-please-version
1
+ export const VERSION = '2.0.0-rc20'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
package/version.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,2BAA2B"}
@@ -1,4 +0,0 @@
1
- import { APIResource } from "../core/resource.mjs";
2
- export declare class Admin extends APIResource {
3
- }
4
- //# sourceMappingURL=admin.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"admin.d.mts","sourceRoot":"","sources":["../src/resources/admin.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;AAEtB,qBAAa,KAAM,SAAQ,WAAW;CAAG"}
@@ -1,4 +0,0 @@
1
- import { APIResource } from "../core/resource.js";
2
- export declare class Admin extends APIResource {
3
- }
4
- //# sourceMappingURL=admin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/resources/admin.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;AAEtB,qBAAa,KAAM,SAAQ,WAAW;CAAG"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Admin = void 0;
5
- const resource_1 = require("../core/resource.js");
6
- class Admin extends resource_1.APIResource {
7
- }
8
- exports.Admin = Admin;
9
- //# sourceMappingURL=admin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/resources/admin.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,MAAa,KAAM,SAAQ,sBAAW;CAAG;AAAzC,sBAAyC"}
@@ -1,5 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../core/resource.mjs";
3
- export class Admin extends APIResource {
4
- }
5
- //# sourceMappingURL=admin.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"admin.mjs","sourceRoot":"","sources":["../src/resources/admin.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAEtB,MAAM,OAAO,KAAM,SAAQ,WAAW;CAAG"}
@@ -1,245 +0,0 @@
1
- import { APIResource } from "../core/resource.mjs";
2
- import { APIPromise } from "../core/api-promise.mjs";
3
- import { RequestOptions } from "../internal/request-options.mjs";
4
- export declare class Report extends APIResource {
5
- /**
6
- * Evaluate Hallucination
7
- *
8
- * @example
9
- * ```ts
10
- * const response = await client.report.evaluateHallucination({
11
- * context: 'context',
12
- * prompt: 'prompt',
13
- * provider: { model: 'gpt-4o', provider: 'openai' },
14
- * response: 'response',
15
- * });
16
- * ```
17
- */
18
- evaluateHallucination(body: ReportEvaluateHallucinationParams, options?: RequestOptions): APIPromise<unknown>;
19
- /**
20
- * Report Latency
21
- *
22
- * @example
23
- * ```ts
24
- * const response = await client.report.latency({
25
- * feedback: { accuracy: 'bar' },
26
- * provider: { model: 'gpt-4o', provider: 'openai' },
27
- * session_id: 'session_id',
28
- * });
29
- * ```
30
- */
31
- latency(body: ReportLatencyParams, options?: RequestOptions): APIPromise<unknown>;
32
- /**
33
- * Submit feedback on a routing decision to improve future recommendations.
34
- *
35
- * This endpoint allows you to provide feedback on whether the router selected the
36
- * right model for your query. Your feedback is used to:
37
- *
38
- * 1. Personalize routing decisions for your preference_id
39
- * 2. Improve the overall routing quality
40
- * 3. Train and refine custom routers
41
- *
42
- * **Feedback Format:**
43
- *
44
- * - `accuracy: 1` - Thumbs up (the model performed well)
45
- * - `accuracy: 0` - Thumbs down (the model did not perform well)
46
- *
47
- * **Requirements:**
48
- *
49
- * - You must have used a preference_id in the original model_select() call
50
- * - The session_id must be valid and belong to your account
51
- * - The provider must match one of the providers returned by model_select()
52
- *
53
- * **How Feedback Works:** When you submit thumbs down, the router will:
54
- *
55
- * - Decrease the ranking of the selected model for similar queries
56
- * - Consider alternative models more favorably
57
- *
58
- * When you submit thumbs up, the router will:
59
- *
60
- * - Increase the ranking of the selected model for similar queries
61
- * - Prioritize this model for similar future requests
62
- *
63
- * **Note:** Feedback requires a valid preference_id. Create one via POST
64
- * /v2/preferences/userPreferenceCreate
65
- *
66
- * @example
67
- * ```ts
68
- * const response = await client.report.submitFeedback({
69
- * feedback: { accuracy: 1 },
70
- * provider: { provider: 'openai', model: 'gpt-4o' },
71
- * session_id: '550e8400-e29b-41d4-a716-446655440000',
72
- * });
73
- * ```
74
- */
75
- submitFeedback(body: ReportSubmitFeedbackParams, options?: RequestOptions): APIPromise<ReportSubmitFeedbackResponse>;
76
- }
77
- export type ReportEvaluateHallucinationResponse = unknown;
78
- export type ReportLatencyResponse = unknown;
79
- /**
80
- * Response from feedback submission endpoint.
81
- */
82
- export interface ReportSubmitFeedbackResponse {
83
- /**
84
- * The processed feedback
85
- */
86
- feedback: {
87
- [key: string]: unknown;
88
- };
89
- /**
90
- * The session ID for which feedback was submitted
91
- */
92
- session_id: string;
93
- }
94
- export interface ReportEvaluateHallucinationParams {
95
- context: string;
96
- prompt: string;
97
- /**
98
- * Model for specifying an LLM provider in API requests.
99
- */
100
- provider: ReportEvaluateHallucinationParams.Provider;
101
- response: string;
102
- cost?: number | null;
103
- latency?: number | null;
104
- }
105
- export declare namespace ReportEvaluateHallucinationParams {
106
- /**
107
- * Model for specifying an LLM provider in API requests.
108
- */
109
- interface Provider {
110
- /**
111
- * Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
112
- */
113
- model: string;
114
- /**
115
- * Provider name (e.g., 'openai', 'anthropic', 'google')
116
- */
117
- provider: string;
118
- /**
119
- * Maximum context length for the model (required for custom models)
120
- */
121
- context_length?: number | null;
122
- /**
123
- * Input token price per million tokens in USD (required for custom models)
124
- */
125
- input_price?: number | null;
126
- /**
127
- * Whether this is a custom model not in Not Diamond's supported model list
128
- */
129
- is_custom?: boolean;
130
- /**
131
- * Average latency in seconds (required for custom models)
132
- */
133
- latency?: number | null;
134
- /**
135
- * Output token price per million tokens in USD (required for custom models)
136
- */
137
- output_price?: number | null;
138
- }
139
- }
140
- export interface ReportLatencyParams {
141
- /**
142
- * Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
143
- */
144
- feedback: {
145
- [key: string]: unknown;
146
- };
147
- /**
148
- * The provider that was selected by the router
149
- */
150
- provider: ReportLatencyParams.Provider;
151
- /**
152
- * Session ID returned from POST /v2/modelRouter/modelSelect
153
- */
154
- session_id: string;
155
- }
156
- export declare namespace ReportLatencyParams {
157
- /**
158
- * The provider that was selected by the router
159
- */
160
- interface Provider {
161
- /**
162
- * Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
163
- */
164
- model: string;
165
- /**
166
- * Provider name (e.g., 'openai', 'anthropic', 'google')
167
- */
168
- provider: string;
169
- /**
170
- * Maximum context length for the model (required for custom models)
171
- */
172
- context_length?: number | null;
173
- /**
174
- * Input token price per million tokens in USD (required for custom models)
175
- */
176
- input_price?: number | null;
177
- /**
178
- * Whether this is a custom model not in Not Diamond's supported model list
179
- */
180
- is_custom?: boolean;
181
- /**
182
- * Average latency in seconds (required for custom models)
183
- */
184
- latency?: number | null;
185
- /**
186
- * Output token price per million tokens in USD (required for custom models)
187
- */
188
- output_price?: number | null;
189
- }
190
- }
191
- export interface ReportSubmitFeedbackParams {
192
- /**
193
- * Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
194
- */
195
- feedback: {
196
- [key: string]: unknown;
197
- };
198
- /**
199
- * The provider that was selected by the router
200
- */
201
- provider: ReportSubmitFeedbackParams.Provider;
202
- /**
203
- * Session ID returned from POST /v2/modelRouter/modelSelect
204
- */
205
- session_id: string;
206
- }
207
- export declare namespace ReportSubmitFeedbackParams {
208
- /**
209
- * The provider that was selected by the router
210
- */
211
- interface Provider {
212
- /**
213
- * Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
214
- */
215
- model: string;
216
- /**
217
- * Provider name (e.g., 'openai', 'anthropic', 'google')
218
- */
219
- provider: string;
220
- /**
221
- * Maximum context length for the model (required for custom models)
222
- */
223
- context_length?: number | null;
224
- /**
225
- * Input token price per million tokens in USD (required for custom models)
226
- */
227
- input_price?: number | null;
228
- /**
229
- * Whether this is a custom model not in Not Diamond's supported model list
230
- */
231
- is_custom?: boolean;
232
- /**
233
- * Average latency in seconds (required for custom models)
234
- */
235
- latency?: number | null;
236
- /**
237
- * Output token price per million tokens in USD (required for custom models)
238
- */
239
- output_price?: number | null;
240
- }
241
- }
242
- export declare namespace Report {
243
- export { type ReportEvaluateHallucinationResponse as ReportEvaluateHallucinationResponse, type ReportLatencyResponse as ReportLatencyResponse, type ReportSubmitFeedbackResponse as ReportSubmitFeedbackResponse, type ReportEvaluateHallucinationParams as ReportEvaluateHallucinationParams, type ReportLatencyParams as ReportLatencyParams, type ReportSubmitFeedbackParams as ReportSubmitFeedbackParams, };
244
- }
245
- //# sourceMappingURL=report.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"report.d.mts","sourceRoot":"","sources":["../src/resources/report.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;O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,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE/B;;WAEG;QACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE5B;;WAEG;QACH,SAAS,CAAC,EAAE,OAAO,CAAC;QAEpB;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAExB;;WAEG;QACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC9B;CACF;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,KAAK,mCAAmC,IAAI,mCAAmC,EAC/E,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
@@ -1,245 +0,0 @@
1
- import { APIResource } from "../core/resource.js";
2
- import { APIPromise } from "../core/api-promise.js";
3
- import { RequestOptions } from "../internal/request-options.js";
4
- export declare class Report extends APIResource {
5
- /**
6
- * Evaluate Hallucination
7
- *
8
- * @example
9
- * ```ts
10
- * const response = await client.report.evaluateHallucination({
11
- * context: 'context',
12
- * prompt: 'prompt',
13
- * provider: { model: 'gpt-4o', provider: 'openai' },
14
- * response: 'response',
15
- * });
16
- * ```
17
- */
18
- evaluateHallucination(body: ReportEvaluateHallucinationParams, options?: RequestOptions): APIPromise<unknown>;
19
- /**
20
- * Report Latency
21
- *
22
- * @example
23
- * ```ts
24
- * const response = await client.report.latency({
25
- * feedback: { accuracy: 'bar' },
26
- * provider: { model: 'gpt-4o', provider: 'openai' },
27
- * session_id: 'session_id',
28
- * });
29
- * ```
30
- */
31
- latency(body: ReportLatencyParams, options?: RequestOptions): APIPromise<unknown>;
32
- /**
33
- * Submit feedback on a routing decision to improve future recommendations.
34
- *
35
- * This endpoint allows you to provide feedback on whether the router selected the
36
- * right model for your query. Your feedback is used to:
37
- *
38
- * 1. Personalize routing decisions for your preference_id
39
- * 2. Improve the overall routing quality
40
- * 3. Train and refine custom routers
41
- *
42
- * **Feedback Format:**
43
- *
44
- * - `accuracy: 1` - Thumbs up (the model performed well)
45
- * - `accuracy: 0` - Thumbs down (the model did not perform well)
46
- *
47
- * **Requirements:**
48
- *
49
- * - You must have used a preference_id in the original model_select() call
50
- * - The session_id must be valid and belong to your account
51
- * - The provider must match one of the providers returned by model_select()
52
- *
53
- * **How Feedback Works:** When you submit thumbs down, the router will:
54
- *
55
- * - Decrease the ranking of the selected model for similar queries
56
- * - Consider alternative models more favorably
57
- *
58
- * When you submit thumbs up, the router will:
59
- *
60
- * - Increase the ranking of the selected model for similar queries
61
- * - Prioritize this model for similar future requests
62
- *
63
- * **Note:** Feedback requires a valid preference_id. Create one via POST
64
- * /v2/preferences/userPreferenceCreate
65
- *
66
- * @example
67
- * ```ts
68
- * const response = await client.report.submitFeedback({
69
- * feedback: { accuracy: 1 },
70
- * provider: { provider: 'openai', model: 'gpt-4o' },
71
- * session_id: '550e8400-e29b-41d4-a716-446655440000',
72
- * });
73
- * ```
74
- */
75
- submitFeedback(body: ReportSubmitFeedbackParams, options?: RequestOptions): APIPromise<ReportSubmitFeedbackResponse>;
76
- }
77
- export type ReportEvaluateHallucinationResponse = unknown;
78
- export type ReportLatencyResponse = unknown;
79
- /**
80
- * Response from feedback submission endpoint.
81
- */
82
- export interface ReportSubmitFeedbackResponse {
83
- /**
84
- * The processed feedback
85
- */
86
- feedback: {
87
- [key: string]: unknown;
88
- };
89
- /**
90
- * The session ID for which feedback was submitted
91
- */
92
- session_id: string;
93
- }
94
- export interface ReportEvaluateHallucinationParams {
95
- context: string;
96
- prompt: string;
97
- /**
98
- * Model for specifying an LLM provider in API requests.
99
- */
100
- provider: ReportEvaluateHallucinationParams.Provider;
101
- response: string;
102
- cost?: number | null;
103
- latency?: number | null;
104
- }
105
- export declare namespace ReportEvaluateHallucinationParams {
106
- /**
107
- * Model for specifying an LLM provider in API requests.
108
- */
109
- interface Provider {
110
- /**
111
- * Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
112
- */
113
- model: string;
114
- /**
115
- * Provider name (e.g., 'openai', 'anthropic', 'google')
116
- */
117
- provider: string;
118
- /**
119
- * Maximum context length for the model (required for custom models)
120
- */
121
- context_length?: number | null;
122
- /**
123
- * Input token price per million tokens in USD (required for custom models)
124
- */
125
- input_price?: number | null;
126
- /**
127
- * Whether this is a custom model not in Not Diamond's supported model list
128
- */
129
- is_custom?: boolean;
130
- /**
131
- * Average latency in seconds (required for custom models)
132
- */
133
- latency?: number | null;
134
- /**
135
- * Output token price per million tokens in USD (required for custom models)
136
- */
137
- output_price?: number | null;
138
- }
139
- }
140
- export interface ReportLatencyParams {
141
- /**
142
- * Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
143
- */
144
- feedback: {
145
- [key: string]: unknown;
146
- };
147
- /**
148
- * The provider that was selected by the router
149
- */
150
- provider: ReportLatencyParams.Provider;
151
- /**
152
- * Session ID returned from POST /v2/modelRouter/modelSelect
153
- */
154
- session_id: string;
155
- }
156
- export declare namespace ReportLatencyParams {
157
- /**
158
- * The provider that was selected by the router
159
- */
160
- interface Provider {
161
- /**
162
- * Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
163
- */
164
- model: string;
165
- /**
166
- * Provider name (e.g., 'openai', 'anthropic', 'google')
167
- */
168
- provider: string;
169
- /**
170
- * Maximum context length for the model (required for custom models)
171
- */
172
- context_length?: number | null;
173
- /**
174
- * Input token price per million tokens in USD (required for custom models)
175
- */
176
- input_price?: number | null;
177
- /**
178
- * Whether this is a custom model not in Not Diamond's supported model list
179
- */
180
- is_custom?: boolean;
181
- /**
182
- * Average latency in seconds (required for custom models)
183
- */
184
- latency?: number | null;
185
- /**
186
- * Output token price per million tokens in USD (required for custom models)
187
- */
188
- output_price?: number | null;
189
- }
190
- }
191
- export interface ReportSubmitFeedbackParams {
192
- /**
193
- * Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
194
- */
195
- feedback: {
196
- [key: string]: unknown;
197
- };
198
- /**
199
- * The provider that was selected by the router
200
- */
201
- provider: ReportSubmitFeedbackParams.Provider;
202
- /**
203
- * Session ID returned from POST /v2/modelRouter/modelSelect
204
- */
205
- session_id: string;
206
- }
207
- export declare namespace ReportSubmitFeedbackParams {
208
- /**
209
- * The provider that was selected by the router
210
- */
211
- interface Provider {
212
- /**
213
- * Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
214
- */
215
- model: string;
216
- /**
217
- * Provider name (e.g., 'openai', 'anthropic', 'google')
218
- */
219
- provider: string;
220
- /**
221
- * Maximum context length for the model (required for custom models)
222
- */
223
- context_length?: number | null;
224
- /**
225
- * Input token price per million tokens in USD (required for custom models)
226
- */
227
- input_price?: number | null;
228
- /**
229
- * Whether this is a custom model not in Not Diamond's supported model list
230
- */
231
- is_custom?: boolean;
232
- /**
233
- * Average latency in seconds (required for custom models)
234
- */
235
- latency?: number | null;
236
- /**
237
- * Output token price per million tokens in USD (required for custom models)
238
- */
239
- output_price?: number | null;
240
- }
241
- }
242
- export declare namespace Report {
243
- export { type ReportEvaluateHallucinationResponse as ReportEvaluateHallucinationResponse, type ReportLatencyResponse as ReportLatencyResponse, type ReportSubmitFeedbackResponse as ReportSubmitFeedbackResponse, type ReportEvaluateHallucinationParams as ReportEvaluateHallucinationParams, type ReportLatencyParams as ReportLatencyParams, type ReportSubmitFeedbackParams as ReportSubmitFeedbackParams, };
244
- }
245
- //# sourceMappingURL=report.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/resources/report.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;;;;;;;;;;;OAYG;IACH,qBAAqB,CACnB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