notdiamond 2.0.0-rc2 → 2.0.0-rc5

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 +45 -0
  2. package/README.md +14 -16
  3. package/client.d.mts +20 -34
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +20 -34
  6. package/client.d.ts.map +1 -1
  7. package/client.js +22 -38
  8. package/client.js.map +1 -1
  9. package/client.mjs +22 -38
  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 +70 -119
  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,245 +1,2 @@
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
- }
1
+ export * from "./report/index.mjs";
245
2
  //# sourceMappingURL=report.d.mts.map
@@ -1 +1 @@
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;;;;;;;;;;;;OAYG;IACH,qBAAqB,CACnB,IAAI,EAAE,iCAAiC,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,OAAO,CAAC;IAItB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IAIjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,cAAc,CACZ,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,4BAA4B,CAAC;CAG5C;AAED,MAAM,MAAM,mCAAmC,GAAG,OAAO,CAAC;AAE1D,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAErC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,iCAAiC,CAAC,QAAQ,CAAC;IAErD,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,OAAO,CAAC,EAAE,MAAM,GAAG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,GAAG,OAAO,CAAA;KAAE,CAAC;IAErC;;OAEG;IACH,QAAQ,EAAE,0BAA0B,CAAC,QAAQ,CAAC;IAE9C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,yBAAiB,0BAA0B,CAAC;IAC1C;;OAEG;IACH,UAAiB,QAAQ;QACvB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,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
+ {"version":3,"file":"report.d.mts","sourceRoot":"","sources":["../src/resources/report.ts"],"names":[],"mappings":""}
@@ -1,245 +1,2 @@
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
- }
1
+ export * from "./report/index.js";
245
2
  //# sourceMappingURL=report.d.ts.map
@@ -1 +1 @@
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,IAAI,EAAE,iCAAiC,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,OAAO,CAAC;IAItB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IAIjF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,cAAc,CACZ,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,4BAA4B,CAAC;CAG5C;AAED,MAAM,MAAM,mCAAmC,GAAG,OAAO,CAAC;AAE1D,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAErC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iCAAiC;IAChD,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,QAAQ,EAAE,iCAAiC,CAAC,QAAQ,CAAC;IAErD,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,CAA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BAA0B;IACzC;;OAEG;IACH,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAErC;;OAEG;IACH,QAAQ,EAAE,0BAA0B,CAAC,QAAQ,CAAC;IAE9C;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,yBAAiB,0BAA0B,CAAC;IAC1C;;OAEG;IACH,UAAiB,QAAQ;QACvB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB;;WAEG;QACH,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
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../src/resources/report.ts"],"names":[],"mappings":""}
@@ -1,86 +1,6 @@
1
1
  "use strict";
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Report = void 0;
5
- const resource_1 = require("../core/resource.js");
6
- class Report extends resource_1.APIResource {
7
- /**
8
- * Evaluate Hallucination
9
- *
10
- * @example
11
- * ```ts
12
- * const response = await client.report.evaluateHallucination({
13
- * context: 'context',
14
- * prompt: 'prompt',
15
- * provider: { model: 'gpt-4o', provider: 'openai' },
16
- * response: 'response',
17
- * });
18
- * ```
19
- */
20
- evaluateHallucination(body, options) {
21
- return this._client.post('/v2/report/hallucination', { body, ...options });
22
- }
23
- /**
24
- * Report Latency
25
- *
26
- * @example
27
- * ```ts
28
- * const response = await client.report.latency({
29
- * feedback: { accuracy: 'bar' },
30
- * provider: { model: 'gpt-4o', provider: 'openai' },
31
- * session_id: 'session_id',
32
- * });
33
- * ```
34
- */
35
- latency(body, options) {
36
- return this._client.post('/v2/report/metrics/latency', { body, ...options });
37
- }
38
- /**
39
- * Submit feedback on a routing decision to improve future recommendations.
40
- *
41
- * This endpoint allows you to provide feedback on whether the router selected the
42
- * right model for your query. Your feedback is used to:
43
- *
44
- * 1. Personalize routing decisions for your preference_id
45
- * 2. Improve the overall routing quality
46
- * 3. Train and refine custom routers
47
- *
48
- * **Feedback Format:**
49
- *
50
- * - `accuracy: 1` - Thumbs up (the model performed well)
51
- * - `accuracy: 0` - Thumbs down (the model did not perform well)
52
- *
53
- * **Requirements:**
54
- *
55
- * - You must have used a preference_id in the original model_select() call
56
- * - The session_id must be valid and belong to your account
57
- * - The provider must match one of the providers returned by model_select()
58
- *
59
- * **How Feedback Works:** When you submit thumbs down, the router will:
60
- *
61
- * - Decrease the ranking of the selected model for similar queries
62
- * - Consider alternative models more favorably
63
- *
64
- * When you submit thumbs up, the router will:
65
- *
66
- * - Increase the ranking of the selected model for similar queries
67
- * - Prioritize this model for similar future requests
68
- *
69
- * **Note:** Feedback requires a valid preference_id. Create one via POST
70
- * /v2/preferences/userPreferenceCreate
71
- *
72
- * @example
73
- * ```ts
74
- * const response = await client.report.submitFeedback({
75
- * feedback: { accuracy: 1 },
76
- * provider: { provider: 'openai', model: 'gpt-4o' },
77
- * session_id: '550e8400-e29b-41d4-a716-446655440000',
78
- * });
79
- * ```
80
- */
81
- submitFeedback(body, options) {
82
- return this._client.post('/v2/report/metrics/feedback', { body, ...options });
83
- }
84
- }
85
- exports.Report = Report;
4
+ const tslib_1 = require("../internal/tslib.js");
5
+ tslib_1.__exportStar(require("./report/index.js"), exports);
86
6
  //# sourceMappingURL=report.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"report.js","sourceRoot":"","sources":["../src/resources/report.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;;;;;;;;OAYG;IACH,qBAAqB,CACnB,IAAuC,EACvC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,IAAyB,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,cAAc,CACZ,IAAgC,EAChC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AAtFD,wBAsFC"}
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../src/resources/report.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4DAA+B"}
@@ -1,82 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../core/resource.mjs";
3
- export class Report extends APIResource {
4
- /**
5
- * Evaluate Hallucination
6
- *
7
- * @example
8
- * ```ts
9
- * const response = await client.report.evaluateHallucination({
10
- * context: 'context',
11
- * prompt: 'prompt',
12
- * provider: { model: 'gpt-4o', provider: 'openai' },
13
- * response: 'response',
14
- * });
15
- * ```
16
- */
17
- evaluateHallucination(body, options) {
18
- return this._client.post('/v2/report/hallucination', { body, ...options });
19
- }
20
- /**
21
- * Report Latency
22
- *
23
- * @example
24
- * ```ts
25
- * const response = await client.report.latency({
26
- * feedback: { accuracy: 'bar' },
27
- * provider: { model: 'gpt-4o', provider: 'openai' },
28
- * session_id: 'session_id',
29
- * });
30
- * ```
31
- */
32
- latency(body, options) {
33
- return this._client.post('/v2/report/metrics/latency', { body, ...options });
34
- }
35
- /**
36
- * Submit feedback on a routing decision to improve future recommendations.
37
- *
38
- * This endpoint allows you to provide feedback on whether the router selected the
39
- * right model for your query. Your feedback is used to:
40
- *
41
- * 1. Personalize routing decisions for your preference_id
42
- * 2. Improve the overall routing quality
43
- * 3. Train and refine custom routers
44
- *
45
- * **Feedback Format:**
46
- *
47
- * - `accuracy: 1` - Thumbs up (the model performed well)
48
- * - `accuracy: 0` - Thumbs down (the model did not perform well)
49
- *
50
- * **Requirements:**
51
- *
52
- * - You must have used a preference_id in the original model_select() call
53
- * - The session_id must be valid and belong to your account
54
- * - The provider must match one of the providers returned by model_select()
55
- *
56
- * **How Feedback Works:** When you submit thumbs down, the router will:
57
- *
58
- * - Decrease the ranking of the selected model for similar queries
59
- * - Consider alternative models more favorably
60
- *
61
- * When you submit thumbs up, the router will:
62
- *
63
- * - Increase the ranking of the selected model for similar queries
64
- * - Prioritize this model for similar future requests
65
- *
66
- * **Note:** Feedback requires a valid preference_id. Create one via POST
67
- * /v2/preferences/userPreferenceCreate
68
- *
69
- * @example
70
- * ```ts
71
- * const response = await client.report.submitFeedback({
72
- * feedback: { accuracy: 1 },
73
- * provider: { provider: 'openai', model: 'gpt-4o' },
74
- * session_id: '550e8400-e29b-41d4-a716-446655440000',
75
- * });
76
- * ```
77
- */
78
- submitFeedback(body, options) {
79
- return this._client.post('/v2/report/metrics/feedback', { body, ...options });
80
- }
81
- }
2
+ export * from "./report/index.mjs";
82
3
  //# sourceMappingURL=report.mjs.map