notdiamond 2.0.0-rc1 → 2.0.0-rc11

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 (175) hide show
  1. package/CHANGELOG.md +102 -0
  2. package/LICENSE +1 -1
  3. package/README.md +327 -124
  4. package/client.d.mts +28 -42
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +28 -42
  7. package/client.d.ts.map +1 -1
  8. package/client.js +52 -68
  9. package/client.js.map +1 -1
  10. package/client.mjs +50 -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/tslib.js +17 -17
  29. package/internal/uploads.d.mts +4 -4
  30. package/internal/uploads.d.ts +4 -4
  31. package/internal/utils/base64.js +2 -2
  32. package/internal/utils/base64.mjs +3 -3
  33. package/internal/utils/env.d.mts.map +1 -1
  34. package/internal/utils/env.d.ts.map +1 -1
  35. package/internal/utils/env.js +4 -2
  36. package/internal/utils/env.js.map +1 -1
  37. package/internal/utils/env.mjs +4 -2
  38. package/internal/utils/env.mjs.map +1 -1
  39. package/internal/utils/log.d.mts +3 -3
  40. package/internal/utils/log.d.ts +3 -3
  41. package/internal/utils/path.js +1 -1
  42. package/internal/utils/path.mjs +2 -2
  43. package/internal/utils/values.js +5 -5
  44. package/internal/utils/values.mjs +6 -6
  45. package/package.json +11 -12
  46. package/resources/custom-router.d.mts +145 -0
  47. package/resources/custom-router.d.mts.map +1 -0
  48. package/resources/custom-router.d.ts +145 -0
  49. package/resources/custom-router.d.ts.map +1 -0
  50. package/resources/custom-router.js +83 -0
  51. package/resources/custom-router.js.map +1 -0
  52. package/resources/custom-router.mjs +79 -0
  53. package/resources/custom-router.mjs.map +1 -0
  54. package/resources/index.d.mts +6 -6
  55. package/resources/index.d.mts.map +1 -1
  56. package/resources/index.d.ts +6 -6
  57. package/resources/index.d.ts.map +1 -1
  58. package/resources/index.js +6 -6
  59. package/resources/index.js.map +1 -1
  60. package/resources/index.mjs +3 -3
  61. package/resources/index.mjs.map +1 -1
  62. package/resources/model-router.d.mts +196 -0
  63. package/resources/model-router.d.mts.map +1 -0
  64. package/resources/model-router.d.ts +196 -0
  65. package/resources/model-router.d.ts.map +1 -0
  66. package/resources/model-router.js +70 -0
  67. package/resources/model-router.js.map +1 -0
  68. package/resources/model-router.mjs +66 -0
  69. package/resources/model-router.mjs.map +1 -0
  70. package/resources/models.d.mts +50 -25
  71. package/resources/models.d.mts.map +1 -1
  72. package/resources/models.d.ts +50 -25
  73. package/resources/models.d.ts.map +1 -1
  74. package/resources/models.js +5 -0
  75. package/resources/models.js.map +1 -1
  76. package/resources/models.mjs +5 -0
  77. package/resources/models.mjs.map +1 -1
  78. package/resources/preferences.d.mts +34 -48
  79. package/resources/preferences.d.mts.map +1 -1
  80. package/resources/preferences.d.ts +34 -48
  81. package/resources/preferences.d.ts.map +1 -1
  82. package/resources/preferences.js +14 -36
  83. package/resources/preferences.js.map +1 -1
  84. package/resources/preferences.mjs +14 -36
  85. package/resources/preferences.mjs.map +1 -1
  86. package/resources/prompt-adaptation.d.mts +339 -234
  87. package/resources/prompt-adaptation.d.mts.map +1 -1
  88. package/resources/prompt-adaptation.d.ts +339 -234
  89. package/resources/prompt-adaptation.d.ts.map +1 -1
  90. package/resources/prompt-adaptation.js +30 -53
  91. package/resources/prompt-adaptation.js.map +1 -1
  92. package/resources/prompt-adaptation.mjs +30 -53
  93. package/resources/prompt-adaptation.mjs.map +1 -1
  94. package/resources/report/index.d.mts +3 -0
  95. package/resources/report/index.d.mts.map +1 -0
  96. package/resources/report/index.d.ts +3 -0
  97. package/resources/report/index.d.ts.map +1 -0
  98. package/resources/report/index.js +9 -0
  99. package/resources/report/index.js.map +1 -0
  100. package/resources/report/index.mjs +4 -0
  101. package/resources/report/index.mjs.map +1 -0
  102. package/resources/report/metrics.d.mts +87 -0
  103. package/resources/report/metrics.d.mts.map +1 -0
  104. package/resources/report/metrics.d.ts +87 -0
  105. package/resources/report/metrics.d.ts.map +1 -0
  106. package/resources/report/metrics.js +57 -0
  107. package/resources/report/metrics.js.map +1 -0
  108. package/resources/report/metrics.mjs +53 -0
  109. package/resources/report/metrics.mjs.map +1 -0
  110. package/resources/report/report.d.mts +10 -0
  111. package/resources/report/report.d.mts.map +1 -0
  112. package/resources/report/report.d.ts +10 -0
  113. package/resources/report/report.d.ts.map +1 -0
  114. package/resources/report/report.js +17 -0
  115. package/resources/report/report.js.map +1 -0
  116. package/resources/report/report.mjs +12 -0
  117. package/resources/report/report.mjs.map +1 -0
  118. package/resources/report.d.mts +1 -244
  119. package/resources/report.d.mts.map +1 -1
  120. package/resources/report.d.ts +1 -244
  121. package/resources/report.d.ts.map +1 -1
  122. package/resources/report.js +2 -82
  123. package/resources/report.js.map +1 -1
  124. package/resources/report.mjs +1 -80
  125. package/resources/report.mjs.map +1 -1
  126. package/src/client.ts +80 -131
  127. package/src/core/api-promise.ts +4 -4
  128. package/src/core/error.ts +2 -2
  129. package/src/core/resource.ts +3 -3
  130. package/src/index.ts +3 -3
  131. package/src/internal/parse.ts +2 -2
  132. package/src/internal/shims.ts +1 -1
  133. package/src/internal/uploads.ts +5 -5
  134. package/src/internal/utils/base64.ts +3 -3
  135. package/src/internal/utils/env.ts +4 -2
  136. package/src/internal/utils/log.ts +3 -3
  137. package/src/internal/utils/path.ts +2 -2
  138. package/src/internal/utils/values.ts +6 -6
  139. package/src/resources/custom-router.ts +168 -0
  140. package/src/resources/index.ts +23 -34
  141. package/src/resources/model-router.ts +224 -0
  142. package/src/resources/models.ts +55 -32
  143. package/src/resources/preferences.ts +40 -77
  144. package/src/resources/prompt-adaptation.ts +361 -291
  145. package/src/resources/report/index.ts +4 -0
  146. package/src/resources/report/metrics.ts +99 -0
  147. package/src/resources/report/report.ts +19 -0
  148. package/src/resources/report.ts +1 -298
  149. package/src/version.ts +1 -1
  150. package/version.d.mts +1 -1
  151. package/version.d.mts.map +1 -1
  152. package/version.d.ts +1 -1
  153. package/version.d.ts.map +1 -1
  154. package/version.js +1 -1
  155. package/version.js.map +1 -1
  156. package/version.mjs +1 -1
  157. package/version.mjs.map +1 -1
  158. package/resources/admin.d.mts +0 -4
  159. package/resources/admin.d.mts.map +0 -1
  160. package/resources/admin.d.ts +0 -4
  161. package/resources/admin.d.ts.map +0 -1
  162. package/resources/admin.js +0 -9
  163. package/resources/admin.js.map +0 -1
  164. package/resources/admin.mjs +0 -5
  165. package/resources/admin.mjs.map +0 -1
  166. package/resources/routing.d.mts +0 -391
  167. package/resources/routing.d.mts.map +0 -1
  168. package/resources/routing.d.ts +0 -391
  169. package/resources/routing.d.ts.map +0 -1
  170. package/resources/routing.js +0 -163
  171. package/resources/routing.js.map +0 -1
  172. package/resources/routing.mjs +0 -159
  173. package/resources/routing.mjs.map +0 -1
  174. package/src/resources/admin.ts +0 -5
  175. package/src/resources/routing.ts +0 -476
@@ -0,0 +1,53 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ export class Metrics extends APIResource {
4
+ /**
5
+ * Submit feedback on a routing decision to improve future recommendations.
6
+ *
7
+ * This endpoint allows you to provide feedback on whether the router selected the
8
+ * right model for your query. Your feedback is used to:
9
+ *
10
+ * 1. Personalize routing decisions for your preference_id
11
+ * 2. Improve the overall routing quality
12
+ * 3. Train and refine custom routers
13
+ *
14
+ * **Feedback Format:**
15
+ *
16
+ * - `accuracy: 1` - Thumbs up (the model performed well)
17
+ * - `accuracy: 0` - Thumbs down (the model did not perform well)
18
+ *
19
+ * **Requirements:**
20
+ *
21
+ * - You must have used a preference_id in the original model_select() call
22
+ * - The session_id must be valid and belong to your account
23
+ * - The provider must match one of the providers returned by model_select()
24
+ *
25
+ * **How Feedback Works:** When you submit thumbs down, the router will:
26
+ *
27
+ * - Decrease the ranking of the selected model for similar queries
28
+ * - Consider alternative models more favorably
29
+ *
30
+ * When you submit thumbs up, the router will:
31
+ *
32
+ * - Increase the ranking of the selected model for similar queries
33
+ * - Prioritize this model for similar future requests
34
+ *
35
+ * **Note:** Feedback requires a valid preference_id. Create one via POST
36
+ * /v2/preferences/userPreferenceCreate
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const response = await client.report.metrics.submitFeedback(
41
+ * {
42
+ * feedback: { accuracy: 1 },
43
+ * provider: { provider: 'openai', model: 'gpt-4o' },
44
+ * session_id: '550e8400-e29b-41d4-a716-446655440000',
45
+ * },
46
+ * );
47
+ * ```
48
+ */
49
+ submitFeedback(body, options) {
50
+ return this._client.post('/v2/report/metrics/feedback', { body, ...options });
51
+ }
52
+ }
53
+ //# sourceMappingURL=metrics.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metrics.mjs","sourceRoot":"","sources":["../../src/resources/report/metrics.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAKtB,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;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"}
@@ -0,0 +1,10 @@
1
+ import { APIResource } from "../../core/resource.mjs";
2
+ import * as MetricsAPI from "./metrics.mjs";
3
+ import { MetricSubmitFeedbackParams, MetricSubmitFeedbackResponse, Metrics } from "./metrics.mjs";
4
+ export declare class Report extends APIResource {
5
+ metrics: MetricsAPI.Metrics;
6
+ }
7
+ export declare namespace Report {
8
+ export { Metrics as Metrics, type MetricSubmitFeedbackResponse as MetricSubmitFeedbackResponse, type MetricSubmitFeedbackParams as MetricSubmitFeedbackParams, };
9
+ }
10
+ //# sourceMappingURL=report.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.mts","sourceRoot":"","sources":["../../src/resources/report/report.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,OAAO,EAAE;AAE5E,qBAAa,MAAO,SAAQ,WAAW;IACrC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;CACpE;AAID,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
@@ -0,0 +1,10 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as MetricsAPI from "./metrics.js";
3
+ import { MetricSubmitFeedbackParams, MetricSubmitFeedbackResponse, Metrics } from "./metrics.js";
4
+ export declare class Report extends APIResource {
5
+ metrics: MetricsAPI.Metrics;
6
+ }
7
+ export declare namespace Report {
8
+ export { Metrics as Metrics, type MetricSubmitFeedbackResponse as MetricSubmitFeedbackResponse, type MetricSubmitFeedbackParams as MetricSubmitFeedbackParams, };
9
+ }
10
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/resources/report/report.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,OAAO,EAAE;AAE5E,qBAAa,MAAO,SAAQ,WAAW;IACrC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;CACpE;AAID,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
@@ -0,0 +1,17 @@
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.Report = void 0;
5
+ const tslib_1 = require("../../internal/tslib.js");
6
+ const resource_1 = require("../../core/resource.js");
7
+ const MetricsAPI = tslib_1.__importStar(require("./metrics.js"));
8
+ const metrics_1 = require("./metrics.js");
9
+ class Report extends resource_1.APIResource {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.metrics = new MetricsAPI.Metrics(this._client);
13
+ }
14
+ }
15
+ exports.Report = Report;
16
+ Report.Metrics = metrics_1.Metrics;
17
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/resources/report/report.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,iEAAwC;AACxC,0CAA8F;AAE9F,MAAa,MAAO,SAAQ,sBAAW;IAAvC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;CAAA;AAFD,wBAEC;AAED,MAAM,CAAC,OAAO,GAAG,iBAAO,CAAC"}
@@ -0,0 +1,12 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import * as MetricsAPI from "./metrics.mjs";
4
+ import { Metrics } from "./metrics.mjs";
5
+ export class Report extends APIResource {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.metrics = new MetricsAPI.Metrics(this._client);
9
+ }
10
+ }
11
+ Report.Metrics = Metrics;
12
+ //# sourceMappingURL=report.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.mjs","sourceRoot":"","sources":["../../src/resources/report/report.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EAA4D,OAAO,EAAE;AAE5E,MAAM,OAAO,MAAO,SAAQ,WAAW;IAAvC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrE,CAAC;CAAA;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC"}
@@ -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-3-5-sonnet-20241022')
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-3-5-sonnet-20241022')
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-3-5-sonnet-20241022')
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,CAA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AAO,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-3-5-sonnet-20241022')
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-3-5-sonnet-20241022')
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-3-5-sonnet-20241022')
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,G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