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.
- package/CHANGELOG.md +185 -0
- package/LICENSE +1 -1
- package/README.md +261 -168
- package/client.d.mts +26 -43
- package/client.d.mts.map +1 -1
- package/client.d.ts +26 -43
- package/client.d.ts.map +1 -1
- package/client.js +49 -68
- package/client.js.map +1 -1
- package/client.mjs +47 -66
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts +2 -2
- package/core/api-promise.d.ts +2 -2
- package/core/error.d.mts +2 -2
- package/core/error.d.ts +2 -2
- package/core/error.js +4 -4
- package/core/error.mjs +2 -2
- package/core/resource.d.mts +3 -3
- package/core/resource.d.ts +3 -3
- package/index.d.mts +3 -3
- package/index.d.ts +3 -3
- package/index.js +4 -4
- package/index.mjs +3 -3
- package/internal/parse.d.mts +2 -2
- package/internal/parse.d.ts +2 -2
- package/internal/shims.js +1 -1
- package/internal/shims.mjs +1 -1
- package/internal/uploads.d.mts +4 -4
- package/internal/uploads.d.ts +4 -4
- package/internal/utils/base64.js +2 -2
- package/internal/utils/base64.mjs +3 -3
- package/internal/utils/env.d.mts.map +1 -1
- package/internal/utils/env.d.ts.map +1 -1
- package/internal/utils/env.js +4 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +4 -2
- package/internal/utils/env.mjs.map +1 -1
- package/internal/utils/log.d.mts +3 -3
- package/internal/utils/log.d.ts +3 -3
- package/internal/utils/path.js +1 -1
- package/internal/utils/path.mjs +2 -2
- package/internal/utils/values.js +5 -5
- package/internal/utils/values.mjs +6 -6
- package/package.json +11 -12
- package/resources/custom-router.d.mts +145 -0
- package/resources/custom-router.d.mts.map +1 -0
- package/resources/custom-router.d.ts +145 -0
- package/resources/custom-router.d.ts.map +1 -0
- package/resources/custom-router.js +83 -0
- package/resources/custom-router.js.map +1 -0
- package/resources/custom-router.mjs +79 -0
- package/resources/custom-router.mjs.map +1 -0
- package/resources/index.d.mts +5 -6
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +5 -6
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -7
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -3
- package/resources/index.mjs.map +1 -1
- package/resources/model-router.d.mts +194 -0
- package/resources/model-router.d.mts.map +1 -0
- package/resources/model-router.d.ts +194 -0
- package/resources/model-router.d.ts.map +1 -0
- package/resources/model-router.js +68 -0
- package/resources/model-router.js.map +1 -0
- package/resources/model-router.mjs +64 -0
- package/resources/model-router.mjs.map +1 -0
- package/resources/models.d.mts +50 -25
- package/resources/models.d.mts.map +1 -1
- package/resources/models.d.ts +50 -25
- package/resources/models.d.ts.map +1 -1
- package/resources/models.js +5 -0
- package/resources/models.js.map +1 -1
- package/resources/models.mjs +5 -0
- package/resources/models.mjs.map +1 -1
- package/resources/preferences.d.mts +37 -54
- package/resources/preferences.d.mts.map +1 -1
- package/resources/preferences.d.ts +37 -54
- package/resources/preferences.d.ts.map +1 -1
- package/resources/preferences.js +17 -42
- package/resources/preferences.js.map +1 -1
- package/resources/preferences.mjs +17 -42
- package/resources/preferences.mjs.map +1 -1
- package/resources/prompt-adaptation.d.mts +340 -249
- package/resources/prompt-adaptation.d.mts.map +1 -1
- package/resources/prompt-adaptation.d.ts +340 -249
- package/resources/prompt-adaptation.d.ts.map +1 -1
- package/resources/prompt-adaptation.js +36 -79
- package/resources/prompt-adaptation.js.map +1 -1
- package/resources/prompt-adaptation.mjs +36 -79
- package/resources/prompt-adaptation.mjs.map +1 -1
- package/src/client.ts +72 -128
- package/src/core/api-promise.ts +4 -4
- package/src/core/error.ts +2 -2
- package/src/core/resource.ts +3 -3
- package/src/index.ts +3 -3
- package/src/internal/parse.ts +2 -2
- package/src/internal/shims.ts +1 -1
- package/src/internal/uploads.ts +5 -5
- package/src/internal/utils/base64.ts +3 -3
- package/src/internal/utils/env.ts +4 -2
- package/src/internal/utils/log.ts +3 -3
- package/src/internal/utils/path.ts +2 -2
- package/src/internal/utils/values.ts +6 -6
- package/src/resources/custom-router.ts +168 -0
- package/src/resources/index.ts +20 -32
- package/src/resources/model-router.ts +222 -0
- package/src/resources/models.ts +55 -32
- package/src/resources/preferences.ts +43 -83
- package/src/resources/prompt-adaptation.ts +358 -300
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/admin.d.mts +0 -4
- package/resources/admin.d.mts.map +0 -1
- package/resources/admin.d.ts +0 -4
- package/resources/admin.d.ts.map +0 -1
- package/resources/admin.js +0 -9
- package/resources/admin.js.map +0 -1
- package/resources/admin.mjs +0 -5
- package/resources/admin.mjs.map +0 -1
- package/resources/report.d.mts +0 -245
- package/resources/report.d.mts.map +0 -1
- package/resources/report.d.ts +0 -245
- package/resources/report.d.ts.map +0 -1
- package/resources/report.js +0 -86
- package/resources/report.js.map +0 -1
- package/resources/report.mjs +0 -82
- package/resources/report.mjs.map +0 -1
- package/resources/routing.d.mts +0 -391
- package/resources/routing.d.mts.map +0 -1
- package/resources/routing.d.ts +0 -391
- package/resources/routing.d.ts.map +0 -1
- package/resources/routing.js +0 -163
- package/resources/routing.js.map +0 -1
- package/resources/routing.mjs +0 -159
- package/resources/routing.mjs.map +0 -1
- package/src/resources/admin.ts +0 -5
- package/src/resources/report.ts +0 -300
- package/src/resources/routing.ts +0 -476
package/resources/routing.mjs
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { APIResource } from "../core/resource.mjs";
|
|
3
|
-
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
|
-
import { multipartFormRequestOptions } from "../internal/uploads.mjs";
|
|
5
|
-
export class Routing extends APIResource {
|
|
6
|
-
/**
|
|
7
|
-
* Survey Response
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* const response = await client.routing.createSurveyResponse({
|
|
12
|
-
* constraint_priorities: 'constraint_priorities',
|
|
13
|
-
* email: 'email',
|
|
14
|
-
* llm_providers: 'llm_providers',
|
|
15
|
-
* use_case_desc: 'use_case_desc',
|
|
16
|
-
* user_id: 'user_id',
|
|
17
|
-
* 'x-token': 'x-token',
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
createSurveyResponse(params, options) {
|
|
22
|
-
const { 'x-token': xToken, ...body } = params;
|
|
23
|
-
return this._client.post('/v2/pzn/surveyResponse', multipartFormRequestOptions({ body, ...options, headers: buildHeaders([{ 'x-token': xToken }, options?.headers]) }, this._client));
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Select the optimal LLM to handle your query based on Not Diamond's routing
|
|
27
|
-
* algorithm.
|
|
28
|
-
*
|
|
29
|
-
* This endpoint analyzes your messages and returns the best-suited model from your
|
|
30
|
-
* specified providers. The router considers factors like query complexity, model
|
|
31
|
-
* capabilities, cost, and latency based on your preferences.
|
|
32
|
-
*
|
|
33
|
-
* **Key Features:**
|
|
34
|
-
*
|
|
35
|
-
* - Intelligent routing across multiple LLM providers
|
|
36
|
-
* - Support for custom routers trained on your evaluation data
|
|
37
|
-
* - Optional cost/latency optimization
|
|
38
|
-
* - Function calling support for compatible models
|
|
39
|
-
* - Privacy-preserving content hashing
|
|
40
|
-
*
|
|
41
|
-
* **Usage:**
|
|
42
|
-
*
|
|
43
|
-
* 1. Pass your messages in OpenAI format (array of objects with 'role' and
|
|
44
|
-
* 'content')
|
|
45
|
-
* 2. Specify which LLM providers you want to route between
|
|
46
|
-
* 3. Optionally provide a preference_id for personalized routing
|
|
47
|
-
* 4. Receive a recommended model and session_id
|
|
48
|
-
* 5. Use the session_id to submit feedback and improve routing
|
|
49
|
-
*
|
|
50
|
-
* **Related Endpoints:**
|
|
51
|
-
*
|
|
52
|
-
* - `POST /v2/preferences/userPreferenceCreate` - Create a preference ID for
|
|
53
|
-
* personalized routing
|
|
54
|
-
* - `POST /v2/report/metrics/feedback` - Submit feedback on routing decisions
|
|
55
|
-
* - `POST /v2/pzn/trainCustomRouter` - Train a custom router on your evaluation
|
|
56
|
-
* data
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* const response = await client.routing.selectModel({
|
|
61
|
-
* llm_providers: [
|
|
62
|
-
* { provider: 'openai', model: 'gpt-4o' },
|
|
63
|
-
* {
|
|
64
|
-
* provider: 'anthropic',
|
|
65
|
-
* model: 'claude-sonnet-4-5-20250929',
|
|
66
|
-
* },
|
|
67
|
-
* { provider: 'google', model: 'gemini-1.5-pro' },
|
|
68
|
-
* ],
|
|
69
|
-
* messages: [
|
|
70
|
-
* {
|
|
71
|
-
* role: 'system',
|
|
72
|
-
* content: 'You are a helpful assistant.',
|
|
73
|
-
* },
|
|
74
|
-
* {
|
|
75
|
-
* role: 'user',
|
|
76
|
-
* content: 'Explain quantum computing in simple terms',
|
|
77
|
-
* },
|
|
78
|
-
* ],
|
|
79
|
-
* });
|
|
80
|
-
* ```
|
|
81
|
-
*/
|
|
82
|
-
selectModel(params, options) {
|
|
83
|
-
const { type, ...body } = params;
|
|
84
|
-
return this._client.post('/v2/modelRouter/modelSelect', { query: { type }, body, ...options });
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Train a custom router on your evaluation data to optimize routing for your
|
|
88
|
-
* specific use case.
|
|
89
|
-
*
|
|
90
|
-
* This endpoint allows you to train a domain-specific router that learns which
|
|
91
|
-
* models perform best for different types of queries in your application. The
|
|
92
|
-
* router analyzes your evaluation dataset, clusters similar queries, and learns
|
|
93
|
-
* model performance patterns.
|
|
94
|
-
*
|
|
95
|
-
* **Training Process:**
|
|
96
|
-
*
|
|
97
|
-
* 1. Upload a CSV file with your evaluation data
|
|
98
|
-
* 2. Specify which models to route between
|
|
99
|
-
* 3. Define the evaluation metric (score column)
|
|
100
|
-
* 4. The system trains asynchronously and returns a preference_id
|
|
101
|
-
* 5. Use the preference_id in model_select() calls once training completes
|
|
102
|
-
*
|
|
103
|
-
* **Dataset Requirements:**
|
|
104
|
-
*
|
|
105
|
-
* - Format: CSV file
|
|
106
|
-
* - Minimum samples: 25 (more is better for accuracy)
|
|
107
|
-
* - Required columns:
|
|
108
|
-
* - Prompt column (specified in prompt_column parameter)
|
|
109
|
-
* - For each model: `{provider}/{model}/score` and `{provider}/{model}/response`
|
|
110
|
-
*
|
|
111
|
-
* **Example CSV structure:**
|
|
112
|
-
*
|
|
113
|
-
* ```
|
|
114
|
-
* prompt,openai/gpt-4o/score,openai/gpt-4o/response,anthropic/claude-sonnet-4-5-20250929/score,anthropic/claude-sonnet-4-5-20250929/response
|
|
115
|
-
* "Explain quantum computing",0.95,"Quantum computing uses...",0.87,"Quantum computers leverage..."
|
|
116
|
-
* "Write a Python function",0.82,"def my_function()...",0.91,"Here's a Python function..."
|
|
117
|
-
* ```
|
|
118
|
-
*
|
|
119
|
-
* **Model Selection:**
|
|
120
|
-
*
|
|
121
|
-
* - Specify standard models: `{"provider": "openai", "model": "gpt-4o"}`
|
|
122
|
-
* - Or custom models with pricing:
|
|
123
|
-
* `{"provider": "custom", "model": "my-model", "is_custom": true, "input_price": 10.0, "output_price": 30.0, "context_length": 8192, "latency": 1.5}`
|
|
124
|
-
*
|
|
125
|
-
* **Training Time:**
|
|
126
|
-
*
|
|
127
|
-
* - Training is asynchronous and typically takes 5-15 minutes
|
|
128
|
-
* - Larger datasets or more models take longer
|
|
129
|
-
* - You'll receive a preference_id immediately
|
|
130
|
-
* - Check training status by attempting to use the preference_id in model_select()
|
|
131
|
-
*
|
|
132
|
-
* **Best Practices:**
|
|
133
|
-
*
|
|
134
|
-
* 1. Use diverse, representative examples from your production workload
|
|
135
|
-
* 2. Include at least 50-100 samples for best results
|
|
136
|
-
* 3. Ensure consistent evaluation metrics across all models
|
|
137
|
-
* 4. Use the same models you plan to route between in production
|
|
138
|
-
*
|
|
139
|
-
* **Related Documentation:** See
|
|
140
|
-
* https://docs.notdiamond.ai/docs/adapting-prompts-to-new-models for detailed
|
|
141
|
-
* guide.
|
|
142
|
-
*
|
|
143
|
-
* @example
|
|
144
|
-
* ```ts
|
|
145
|
-
* const response = await client.routing.trainCustomRouter({
|
|
146
|
-
* dataset_file: fs.createReadStream('path/to/file'),
|
|
147
|
-
* language: 'english',
|
|
148
|
-
* llm_providers:
|
|
149
|
-
* '[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}]',
|
|
150
|
-
* maximize: true,
|
|
151
|
-
* prompt_column: 'prompt',
|
|
152
|
-
* });
|
|
153
|
-
* ```
|
|
154
|
-
*/
|
|
155
|
-
trainCustomRouter(body, options) {
|
|
156
|
-
return this._client.post('/v2/pzn/trainCustomRouter', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
//# sourceMappingURL=routing.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"routing.mjs","sourceRoot":"","sources":["../src/resources/routing.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;AAEtC,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,CAClB,MAAyC,EACzC,OAAwB;QAExB,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC9C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,wBAAwB,EACxB,2BAA2B,CACzB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,EAAE,EACtF,IAAI,CAAC,OAAO,CACb,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwDG;IACH,WAAW,CACT,MAAgC,EAChC,OAAwB;QAExB,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjG,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoEG;IACH,iBAAiB,CACf,IAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CACtB,2BAA2B,EAC3B,2BAA2B,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,CAChE,CAAC;IACJ,CAAC;CACF"}
|
package/src/resources/admin.ts
DELETED
package/src/resources/report.ts
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../core/resource';
|
|
4
|
-
import { APIPromise } from '../core/api-promise';
|
|
5
|
-
import { RequestOptions } from '../internal/request-options';
|
|
6
|
-
|
|
7
|
-
export class Report extends APIResource {
|
|
8
|
-
/**
|
|
9
|
-
* Evaluate Hallucination
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* const response = await client.report.evaluateHallucination({
|
|
14
|
-
* context: 'context',
|
|
15
|
-
* prompt: 'prompt',
|
|
16
|
-
* provider: { model: 'gpt-4o', provider: 'openai' },
|
|
17
|
-
* response: 'response',
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
evaluateHallucination(
|
|
22
|
-
body: ReportEvaluateHallucinationParams,
|
|
23
|
-
options?: RequestOptions,
|
|
24
|
-
): APIPromise<unknown> {
|
|
25
|
-
return this._client.post('/v2/report/hallucination', { body, ...options });
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Report Latency
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```ts
|
|
33
|
-
* const response = await client.report.latency({
|
|
34
|
-
* feedback: { accuracy: 'bar' },
|
|
35
|
-
* provider: { model: 'gpt-4o', provider: 'openai' },
|
|
36
|
-
* session_id: 'session_id',
|
|
37
|
-
* });
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
latency(body: ReportLatencyParams, options?: RequestOptions): APIPromise<unknown> {
|
|
41
|
-
return this._client.post('/v2/report/metrics/latency', { body, ...options });
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Submit feedback on a routing decision to improve future recommendations.
|
|
46
|
-
*
|
|
47
|
-
* This endpoint allows you to provide feedback on whether the router selected the
|
|
48
|
-
* right model for your query. Your feedback is used to:
|
|
49
|
-
*
|
|
50
|
-
* 1. Personalize routing decisions for your preference_id
|
|
51
|
-
* 2. Improve the overall routing quality
|
|
52
|
-
* 3. Train and refine custom routers
|
|
53
|
-
*
|
|
54
|
-
* **Feedback Format:**
|
|
55
|
-
*
|
|
56
|
-
* - `accuracy: 1` - Thumbs up (the model performed well)
|
|
57
|
-
* - `accuracy: 0` - Thumbs down (the model did not perform well)
|
|
58
|
-
*
|
|
59
|
-
* **Requirements:**
|
|
60
|
-
*
|
|
61
|
-
* - You must have used a preference_id in the original model_select() call
|
|
62
|
-
* - The session_id must be valid and belong to your account
|
|
63
|
-
* - The provider must match one of the providers returned by model_select()
|
|
64
|
-
*
|
|
65
|
-
* **How Feedback Works:** When you submit thumbs down, the router will:
|
|
66
|
-
*
|
|
67
|
-
* - Decrease the ranking of the selected model for similar queries
|
|
68
|
-
* - Consider alternative models more favorably
|
|
69
|
-
*
|
|
70
|
-
* When you submit thumbs up, the router will:
|
|
71
|
-
*
|
|
72
|
-
* - Increase the ranking of the selected model for similar queries
|
|
73
|
-
* - Prioritize this model for similar future requests
|
|
74
|
-
*
|
|
75
|
-
* **Note:** Feedback requires a valid preference_id. Create one via POST
|
|
76
|
-
* /v2/preferences/userPreferenceCreate
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* ```ts
|
|
80
|
-
* const response = await client.report.submitFeedback({
|
|
81
|
-
* feedback: { accuracy: 1 },
|
|
82
|
-
* provider: { provider: 'openai', model: 'gpt-4o' },
|
|
83
|
-
* session_id: '550e8400-e29b-41d4-a716-446655440000',
|
|
84
|
-
* });
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
submitFeedback(
|
|
88
|
-
body: ReportSubmitFeedbackParams,
|
|
89
|
-
options?: RequestOptions,
|
|
90
|
-
): APIPromise<ReportSubmitFeedbackResponse> {
|
|
91
|
-
return this._client.post('/v2/report/metrics/feedback', { body, ...options });
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export type ReportEvaluateHallucinationResponse = unknown;
|
|
96
|
-
|
|
97
|
-
export type ReportLatencyResponse = unknown;
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Response from feedback submission endpoint.
|
|
101
|
-
*/
|
|
102
|
-
export interface ReportSubmitFeedbackResponse {
|
|
103
|
-
/**
|
|
104
|
-
* The processed feedback
|
|
105
|
-
*/
|
|
106
|
-
feedback: { [key: string]: unknown };
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* The session ID for which feedback was submitted
|
|
110
|
-
*/
|
|
111
|
-
session_id: string;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface ReportEvaluateHallucinationParams {
|
|
115
|
-
context: string;
|
|
116
|
-
|
|
117
|
-
prompt: string;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Model for specifying an LLM provider in API requests.
|
|
121
|
-
*/
|
|
122
|
-
provider: ReportEvaluateHallucinationParams.Provider;
|
|
123
|
-
|
|
124
|
-
response: string;
|
|
125
|
-
|
|
126
|
-
cost?: number | null;
|
|
127
|
-
|
|
128
|
-
latency?: number | null;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export namespace ReportEvaluateHallucinationParams {
|
|
132
|
-
/**
|
|
133
|
-
* Model for specifying an LLM provider in API requests.
|
|
134
|
-
*/
|
|
135
|
-
export interface Provider {
|
|
136
|
-
/**
|
|
137
|
-
* Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
|
|
138
|
-
*/
|
|
139
|
-
model: string;
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Provider name (e.g., 'openai', 'anthropic', 'google')
|
|
143
|
-
*/
|
|
144
|
-
provider: string;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Maximum context length for the model (required for custom models)
|
|
148
|
-
*/
|
|
149
|
-
context_length?: number | null;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Input token price per million tokens in USD (required for custom models)
|
|
153
|
-
*/
|
|
154
|
-
input_price?: number | null;
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Whether this is a custom model not in Not Diamond's supported model list
|
|
158
|
-
*/
|
|
159
|
-
is_custom?: boolean;
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* Average latency in seconds (required for custom models)
|
|
163
|
-
*/
|
|
164
|
-
latency?: number | null;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Output token price per million tokens in USD (required for custom models)
|
|
168
|
-
*/
|
|
169
|
-
output_price?: number | null;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export interface ReportLatencyParams {
|
|
174
|
-
/**
|
|
175
|
-
* Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
|
|
176
|
-
*/
|
|
177
|
-
feedback: { [key: string]: unknown };
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* The provider that was selected by the router
|
|
181
|
-
*/
|
|
182
|
-
provider: ReportLatencyParams.Provider;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Session ID returned from POST /v2/modelRouter/modelSelect
|
|
186
|
-
*/
|
|
187
|
-
session_id: string;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export namespace ReportLatencyParams {
|
|
191
|
-
/**
|
|
192
|
-
* The provider that was selected by the router
|
|
193
|
-
*/
|
|
194
|
-
export interface Provider {
|
|
195
|
-
/**
|
|
196
|
-
* Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
|
|
197
|
-
*/
|
|
198
|
-
model: string;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Provider name (e.g., 'openai', 'anthropic', 'google')
|
|
202
|
-
*/
|
|
203
|
-
provider: string;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Maximum context length for the model (required for custom models)
|
|
207
|
-
*/
|
|
208
|
-
context_length?: number | null;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Input token price per million tokens in USD (required for custom models)
|
|
212
|
-
*/
|
|
213
|
-
input_price?: number | null;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Whether this is a custom model not in Not Diamond's supported model list
|
|
217
|
-
*/
|
|
218
|
-
is_custom?: boolean;
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Average latency in seconds (required for custom models)
|
|
222
|
-
*/
|
|
223
|
-
latency?: number | null;
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Output token price per million tokens in USD (required for custom models)
|
|
227
|
-
*/
|
|
228
|
-
output_price?: number | null;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export interface ReportSubmitFeedbackParams {
|
|
233
|
-
/**
|
|
234
|
-
* Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
|
|
235
|
-
*/
|
|
236
|
-
feedback: { [key: string]: unknown };
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* The provider that was selected by the router
|
|
240
|
-
*/
|
|
241
|
-
provider: ReportSubmitFeedbackParams.Provider;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Session ID returned from POST /v2/modelRouter/modelSelect
|
|
245
|
-
*/
|
|
246
|
-
session_id: string;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
export namespace ReportSubmitFeedbackParams {
|
|
250
|
-
/**
|
|
251
|
-
* The provider that was selected by the router
|
|
252
|
-
*/
|
|
253
|
-
export interface Provider {
|
|
254
|
-
/**
|
|
255
|
-
* Model name (e.g., 'gpt-4o', 'claude-sonnet-4-5-20250929')
|
|
256
|
-
*/
|
|
257
|
-
model: string;
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* Provider name (e.g., 'openai', 'anthropic', 'google')
|
|
261
|
-
*/
|
|
262
|
-
provider: string;
|
|
263
|
-
|
|
264
|
-
/**
|
|
265
|
-
* Maximum context length for the model (required for custom models)
|
|
266
|
-
*/
|
|
267
|
-
context_length?: number | null;
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Input token price per million tokens in USD (required for custom models)
|
|
271
|
-
*/
|
|
272
|
-
input_price?: number | null;
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Whether this is a custom model not in Not Diamond's supported model list
|
|
276
|
-
*/
|
|
277
|
-
is_custom?: boolean;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Average latency in seconds (required for custom models)
|
|
281
|
-
*/
|
|
282
|
-
latency?: number | null;
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Output token price per million tokens in USD (required for custom models)
|
|
286
|
-
*/
|
|
287
|
-
output_price?: number | null;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export declare namespace Report {
|
|
292
|
-
export {
|
|
293
|
-
type ReportEvaluateHallucinationResponse as ReportEvaluateHallucinationResponse,
|
|
294
|
-
type ReportLatencyResponse as ReportLatencyResponse,
|
|
295
|
-
type ReportSubmitFeedbackResponse as ReportSubmitFeedbackResponse,
|
|
296
|
-
type ReportEvaluateHallucinationParams as ReportEvaluateHallucinationParams,
|
|
297
|
-
type ReportLatencyParams as ReportLatencyParams,
|
|
298
|
-
type ReportSubmitFeedbackParams as ReportSubmitFeedbackParams,
|
|
299
|
-
};
|
|
300
|
-
}
|