notdiamond 2.0.0-rc1 → 2.0.0-rc4
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 +45 -0
- package/README.md +19 -21
- package/client.d.mts +21 -35
- package/client.d.mts.map +1 -1
- package/client.d.ts +21 -35
- package/client.d.ts.map +1 -1
- package/client.js +23 -39
- package/client.js.map +1 -1
- package/client.mjs +23 -39
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- 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/package.json +10 -11
- package/resources/index.d.mts +6 -6
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +6 -6
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +8 -8
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +4 -4
- package/resources/index.mjs.map +1 -1
- package/resources/model-router.d.mts +311 -0
- package/resources/model-router.d.mts.map +1 -0
- package/resources/model-router.d.ts +311 -0
- package/resources/model-router.d.ts.map +1 -0
- package/resources/model-router.js +97 -0
- package/resources/model-router.js.map +1 -0
- package/resources/model-router.mjs +93 -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 +49 -47
- package/resources/preferences.d.mts.map +1 -1
- package/resources/preferences.d.ts +49 -47
- package/resources/preferences.d.ts.map +1 -1
- package/resources/preferences.js +30 -33
- package/resources/preferences.js.map +1 -1
- package/resources/preferences.mjs +30 -33
- package/resources/preferences.mjs.map +1 -1
- package/resources/prompt/adapt.d.mts +352 -0
- package/resources/prompt/adapt.d.mts.map +1 -0
- package/resources/prompt/adapt.d.ts +352 -0
- package/resources/prompt/adapt.d.ts.map +1 -0
- package/resources/prompt/adapt.js +154 -0
- package/resources/prompt/adapt.js.map +1 -0
- package/resources/prompt/adapt.mjs +150 -0
- package/resources/prompt/adapt.mjs.map +1 -0
- package/resources/prompt/index.d.mts +3 -0
- package/resources/prompt/index.d.mts.map +1 -0
- package/resources/prompt/index.d.ts +3 -0
- package/resources/prompt/index.d.ts.map +1 -0
- package/resources/prompt/index.js +9 -0
- package/resources/prompt/index.js.map +1 -0
- package/resources/prompt/index.mjs +4 -0
- package/resources/prompt/index.mjs.map +1 -0
- package/resources/prompt/prompt.d.mts +338 -0
- package/resources/prompt/prompt.d.mts.map +1 -0
- package/resources/prompt/prompt.d.ts +338 -0
- package/resources/prompt/prompt.d.ts.map +1 -0
- package/resources/prompt/prompt.js +128 -0
- package/resources/prompt/prompt.js.map +1 -0
- package/resources/prompt/prompt.mjs +123 -0
- package/resources/prompt/prompt.mjs.map +1 -0
- package/resources/prompt.d.mts +2 -0
- package/resources/prompt.d.mts.map +1 -0
- package/resources/prompt.d.ts +2 -0
- package/resources/prompt.d.ts.map +1 -0
- package/resources/prompt.js +6 -0
- package/resources/prompt.js.map +1 -0
- package/resources/prompt.mjs +3 -0
- package/resources/prompt.mjs.map +1 -0
- package/resources/pzn.d.mts +225 -0
- package/resources/pzn.d.mts.map +1 -0
- package/resources/pzn.d.ts +225 -0
- package/resources/pzn.d.ts.map +1 -0
- package/resources/{routing.js → pzn.js} +28 -71
- package/resources/pzn.js.map +1 -0
- package/resources/{routing.mjs → pzn.mjs} +26 -69
- package/resources/pzn.mjs.map +1 -0
- package/resources/report/index.d.mts +3 -0
- package/resources/report/index.d.mts.map +1 -0
- package/resources/report/index.d.ts +3 -0
- package/resources/report/index.d.ts.map +1 -0
- package/resources/report/index.js +9 -0
- package/resources/report/index.js.map +1 -0
- package/resources/report/index.mjs +4 -0
- package/resources/report/index.mjs.map +1 -0
- package/resources/report/metrics.d.mts +87 -0
- package/resources/report/metrics.d.mts.map +1 -0
- package/resources/report/metrics.d.ts +87 -0
- package/resources/report/metrics.d.ts.map +1 -0
- package/resources/report/metrics.js +57 -0
- package/resources/report/metrics.js.map +1 -0
- package/resources/report/metrics.mjs +53 -0
- package/resources/report/metrics.mjs.map +1 -0
- package/resources/report/report.d.mts +10 -0
- package/resources/report/report.d.mts.map +1 -0
- package/resources/report/report.d.ts +10 -0
- package/resources/report/report.d.ts.map +1 -0
- package/resources/report/report.js +17 -0
- package/resources/report/report.js.map +1 -0
- package/resources/report/report.mjs +12 -0
- package/resources/report/report.mjs.map +1 -0
- package/resources/report.d.mts +1 -244
- package/resources/report.d.mts.map +1 -1
- package/resources/report.d.ts +1 -244
- package/resources/report.d.ts.map +1 -1
- package/resources/report.js +2 -82
- package/resources/report.js.map +1 -1
- package/resources/report.mjs +1 -80
- package/resources/report.mjs.map +1 -1
- package/src/client.ts +71 -120
- package/src/internal/utils/env.ts +4 -2
- package/src/resources/index.ts +24 -34
- package/src/resources/model-router.ts +356 -0
- package/src/resources/models.ts +55 -32
- package/src/resources/preferences.ts +61 -70
- package/src/resources/prompt/adapt.ts +402 -0
- package/src/resources/prompt/index.ts +16 -0
- package/src/resources/prompt/prompt.ts +398 -0
- package/src/resources/prompt.ts +3 -0
- package/src/resources/pzn.ts +273 -0
- package/src/resources/report/index.ts +4 -0
- package/src/resources/report/metrics.ts +99 -0
- package/src/resources/report/report.ts +19 -0
- package/src/resources/report.ts +1 -298
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +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/prompt-adaptation.d.mts +0 -574
- package/resources/prompt-adaptation.d.mts.map +0 -1
- package/resources/prompt-adaptation.d.ts +0 -574
- package/resources/prompt-adaptation.d.ts.map +0 -1
- package/resources/prompt-adaptation.js +0 -289
- package/resources/prompt-adaptation.js.map +0 -1
- package/resources/prompt-adaptation.mjs +0 -285
- package/resources/prompt-adaptation.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.map +0 -1
- package/resources/routing.mjs.map +0 -1
- package/src/resources/admin.ts +0 -5
- package/src/resources/prompt-adaptation.ts +0 -700
- package/src/resources/routing.ts +0 -476
|
@@ -2,13 +2,31 @@
|
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
3
|
import { buildHeaders } from "../internal/headers.mjs";
|
|
4
4
|
import { multipartFormRequestOptions } from "../internal/uploads.mjs";
|
|
5
|
-
export class
|
|
5
|
+
export class Pzn extends APIResource {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Submit a survey response for personalized routing setup.
|
|
8
|
+
*
|
|
9
|
+
* This admin endpoint processes survey responses to set up personalized routing
|
|
10
|
+
* configurations for users based on their use case, LLM preferences, and
|
|
11
|
+
* constraints.
|
|
12
|
+
*
|
|
13
|
+
* **Survey Data:**
|
|
14
|
+
*
|
|
15
|
+
* - User information and use case description
|
|
16
|
+
* - Preferred LLM providers and models
|
|
17
|
+
* - Constraint priorities (quality, cost, latency)
|
|
18
|
+
* - Optional prompts and evaluation datasets
|
|
19
|
+
*
|
|
20
|
+
* **File Uploads:**
|
|
21
|
+
*
|
|
22
|
+
* - `prompt_file`: Optional CSV file with prompts
|
|
23
|
+
* - `dataset_file`: Optional CSV file with evaluation dataset
|
|
24
|
+
*
|
|
25
|
+
* **Note:** This is an admin-only endpoint for internal use.
|
|
8
26
|
*
|
|
9
27
|
* @example
|
|
10
28
|
* ```ts
|
|
11
|
-
* const response = await client.
|
|
29
|
+
* const response = await client.pzn.submitSurveyResponse({
|
|
12
30
|
* constraint_priorities: 'constraint_priorities',
|
|
13
31
|
* email: 'email',
|
|
14
32
|
* llm_providers: 'llm_providers',
|
|
@@ -18,71 +36,10 @@ export class Routing extends APIResource {
|
|
|
18
36
|
* });
|
|
19
37
|
* ```
|
|
20
38
|
*/
|
|
21
|
-
|
|
39
|
+
submitSurveyResponse(params, options) {
|
|
22
40
|
const { 'x-token': xToken, ...body } = params;
|
|
23
41
|
return this._client.post('/v2/pzn/surveyResponse', multipartFormRequestOptions({ body, ...options, headers: buildHeaders([{ 'x-token': xToken }, options?.headers]) }, this._client));
|
|
24
42
|
}
|
|
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-3-5-sonnet-20241022',
|
|
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
43
|
/**
|
|
87
44
|
* Train a custom router on your evaluation data to optimize routing for your
|
|
88
45
|
* specific use case.
|
|
@@ -111,7 +68,7 @@ export class Routing extends APIResource {
|
|
|
111
68
|
* **Example CSV structure:**
|
|
112
69
|
*
|
|
113
70
|
* ```
|
|
114
|
-
* prompt,openai/gpt-4o/score,openai/gpt-4o/response,anthropic/claude-
|
|
71
|
+
* prompt,openai/gpt-4o/score,openai/gpt-4o/response,anthropic/claude-sonnet-4-5-20250929/score,anthropic/claude-sonnet-4-5-20250929/response
|
|
115
72
|
* "Explain quantum computing",0.95,"Quantum computing uses...",0.87,"Quantum computers leverage..."
|
|
116
73
|
* "Write a Python function",0.82,"def my_function()...",0.91,"Here's a Python function..."
|
|
117
74
|
* ```
|
|
@@ -142,11 +99,11 @@ export class Routing extends APIResource {
|
|
|
142
99
|
*
|
|
143
100
|
* @example
|
|
144
101
|
* ```ts
|
|
145
|
-
* const response = await client.
|
|
102
|
+
* const response = await client.pzn.trainCustomRouter({
|
|
146
103
|
* dataset_file: fs.createReadStream('path/to/file'),
|
|
147
104
|
* language: 'english',
|
|
148
105
|
* llm_providers:
|
|
149
|
-
* '[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-
|
|
106
|
+
* '[{"provider": "openai", "model": "gpt-4o"}, {"provider": "anthropic", "model": "claude-sonnet-4-5-20250929"}]',
|
|
150
107
|
* maximize: true,
|
|
151
108
|
* prompt_column: 'prompt',
|
|
152
109
|
* });
|
|
@@ -156,4 +113,4 @@ export class Routing extends APIResource {
|
|
|
156
113
|
return this._client.post('/v2/pzn/trainCustomRouter', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
157
114
|
}
|
|
158
115
|
}
|
|
159
|
-
//# sourceMappingURL=
|
|
116
|
+
//# sourceMappingURL=pzn.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pzn.mjs","sourceRoot":"","sources":["../src/resources/pzn.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,YAAY,EAAE;OAEhB,EAAE,2BAA2B,EAAE;AAEtC,MAAM,OAAO,GAAI,SAAQ,WAAW;IAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,oBAAoB,CAAC,MAAqC,EAAE,OAAwB;QAClF,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoEG;IACH,iBAAiB,CACf,IAAgC,EAChC,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/report/index.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAE,KAAK,4BAA4B,EAAE,KAAK,0BAA0B,EAAE;OAC/E,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/report/index.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,EAAE,KAAK,4BAA4B,EAAE,KAAK,0BAA0B,EAAE;OAC/E,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
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 = exports.Metrics = void 0;
|
|
5
|
+
var metrics_1 = require("./metrics.js");
|
|
6
|
+
Object.defineProperty(exports, "Metrics", { enumerable: true, get: function () { return metrics_1.Metrics; } });
|
|
7
|
+
var report_1 = require("./report.js");
|
|
8
|
+
Object.defineProperty(exports, "Report", { enumerable: true, get: function () { return report_1.Report; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/report/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wCAAwG;AAA/F,kGAAA,OAAO,OAAA;AAChB,sCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/report/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,OAAO,EAAsE;OAC/E,EAAE,MAAM,EAAE"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import * as AdaptAPI from "../prompt/adapt.mjs";
|
|
3
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
4
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
5
|
+
export declare class Metrics extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Submit feedback on a routing decision to improve future recommendations.
|
|
8
|
+
*
|
|
9
|
+
* This endpoint allows you to provide feedback on whether the router selected the
|
|
10
|
+
* right model for your query. Your feedback is used to:
|
|
11
|
+
*
|
|
12
|
+
* 1. Personalize routing decisions for your preference_id
|
|
13
|
+
* 2. Improve the overall routing quality
|
|
14
|
+
* 3. Train and refine custom routers
|
|
15
|
+
*
|
|
16
|
+
* **Feedback Format:**
|
|
17
|
+
*
|
|
18
|
+
* - `accuracy: 1` - Thumbs up (the model performed well)
|
|
19
|
+
* - `accuracy: 0` - Thumbs down (the model did not perform well)
|
|
20
|
+
*
|
|
21
|
+
* **Requirements:**
|
|
22
|
+
*
|
|
23
|
+
* - You must have used a preference_id in the original model_select() call
|
|
24
|
+
* - The session_id must be valid and belong to your account
|
|
25
|
+
* - The provider must match one of the providers returned by model_select()
|
|
26
|
+
*
|
|
27
|
+
* **How Feedback Works:** When you submit thumbs down, the router will:
|
|
28
|
+
*
|
|
29
|
+
* - Decrease the ranking of the selected model for similar queries
|
|
30
|
+
* - Consider alternative models more favorably
|
|
31
|
+
*
|
|
32
|
+
* When you submit thumbs up, the router will:
|
|
33
|
+
*
|
|
34
|
+
* - Increase the ranking of the selected model for similar queries
|
|
35
|
+
* - Prioritize this model for similar future requests
|
|
36
|
+
*
|
|
37
|
+
* **Note:** Feedback requires a valid preference_id. Create one via POST
|
|
38
|
+
* /v2/preferences/userPreferenceCreate
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const response = await client.report.metrics.submitFeedback(
|
|
43
|
+
* {
|
|
44
|
+
* feedback: { accuracy: 1 },
|
|
45
|
+
* provider: { provider: 'openai', model: 'gpt-4o' },
|
|
46
|
+
* session_id: '550e8400-e29b-41d4-a716-446655440000',
|
|
47
|
+
* },
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
submitFeedback(body: MetricSubmitFeedbackParams, options?: RequestOptions): APIPromise<MetricSubmitFeedbackResponse>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Response from feedback submission endpoint.
|
|
55
|
+
*/
|
|
56
|
+
export interface MetricSubmitFeedbackResponse {
|
|
57
|
+
/**
|
|
58
|
+
* The processed feedback
|
|
59
|
+
*/
|
|
60
|
+
feedback: {
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The session ID for which feedback was submitted
|
|
65
|
+
*/
|
|
66
|
+
session_id: string;
|
|
67
|
+
}
|
|
68
|
+
export interface MetricSubmitFeedbackParams {
|
|
69
|
+
/**
|
|
70
|
+
* Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
|
|
71
|
+
*/
|
|
72
|
+
feedback: {
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The provider that was selected by the router
|
|
77
|
+
*/
|
|
78
|
+
provider: AdaptAPI.RequestProvider;
|
|
79
|
+
/**
|
|
80
|
+
* Session ID returned from POST /v2/modelRouter/modelSelect
|
|
81
|
+
*/
|
|
82
|
+
session_id: string;
|
|
83
|
+
}
|
|
84
|
+
export declare namespace Metrics {
|
|
85
|
+
export { type MetricSubmitFeedbackResponse as MetricSubmitFeedbackResponse, type MetricSubmitFeedbackParams as MetricSubmitFeedbackParams, };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=metrics.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.mts","sourceRoot":"","sources":["../../src/resources/report/metrics.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,QAAQ;OACb,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,cAAc,CACZ,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,4BAA4B,CAAC;CAG5C;AAED;;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,0BAA0B;IACzC;;OAEG;IACH,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAErC;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC;IAEnC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import * as AdaptAPI from "../prompt/adapt.js";
|
|
3
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
5
|
+
export declare class Metrics extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Submit feedback on a routing decision to improve future recommendations.
|
|
8
|
+
*
|
|
9
|
+
* This endpoint allows you to provide feedback on whether the router selected the
|
|
10
|
+
* right model for your query. Your feedback is used to:
|
|
11
|
+
*
|
|
12
|
+
* 1. Personalize routing decisions for your preference_id
|
|
13
|
+
* 2. Improve the overall routing quality
|
|
14
|
+
* 3. Train and refine custom routers
|
|
15
|
+
*
|
|
16
|
+
* **Feedback Format:**
|
|
17
|
+
*
|
|
18
|
+
* - `accuracy: 1` - Thumbs up (the model performed well)
|
|
19
|
+
* - `accuracy: 0` - Thumbs down (the model did not perform well)
|
|
20
|
+
*
|
|
21
|
+
* **Requirements:**
|
|
22
|
+
*
|
|
23
|
+
* - You must have used a preference_id in the original model_select() call
|
|
24
|
+
* - The session_id must be valid and belong to your account
|
|
25
|
+
* - The provider must match one of the providers returned by model_select()
|
|
26
|
+
*
|
|
27
|
+
* **How Feedback Works:** When you submit thumbs down, the router will:
|
|
28
|
+
*
|
|
29
|
+
* - Decrease the ranking of the selected model for similar queries
|
|
30
|
+
* - Consider alternative models more favorably
|
|
31
|
+
*
|
|
32
|
+
* When you submit thumbs up, the router will:
|
|
33
|
+
*
|
|
34
|
+
* - Increase the ranking of the selected model for similar queries
|
|
35
|
+
* - Prioritize this model for similar future requests
|
|
36
|
+
*
|
|
37
|
+
* **Note:** Feedback requires a valid preference_id. Create one via POST
|
|
38
|
+
* /v2/preferences/userPreferenceCreate
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const response = await client.report.metrics.submitFeedback(
|
|
43
|
+
* {
|
|
44
|
+
* feedback: { accuracy: 1 },
|
|
45
|
+
* provider: { provider: 'openai', model: 'gpt-4o' },
|
|
46
|
+
* session_id: '550e8400-e29b-41d4-a716-446655440000',
|
|
47
|
+
* },
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
submitFeedback(body: MetricSubmitFeedbackParams, options?: RequestOptions): APIPromise<MetricSubmitFeedbackResponse>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Response from feedback submission endpoint.
|
|
55
|
+
*/
|
|
56
|
+
export interface MetricSubmitFeedbackResponse {
|
|
57
|
+
/**
|
|
58
|
+
* The processed feedback
|
|
59
|
+
*/
|
|
60
|
+
feedback: {
|
|
61
|
+
[key: string]: unknown;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* The session ID for which feedback was submitted
|
|
65
|
+
*/
|
|
66
|
+
session_id: string;
|
|
67
|
+
}
|
|
68
|
+
export interface MetricSubmitFeedbackParams {
|
|
69
|
+
/**
|
|
70
|
+
* Feedback dictionary with 'accuracy' key (0 for thumbs down, 1 for thumbs up)
|
|
71
|
+
*/
|
|
72
|
+
feedback: {
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The provider that was selected by the router
|
|
77
|
+
*/
|
|
78
|
+
provider: AdaptAPI.RequestProvider;
|
|
79
|
+
/**
|
|
80
|
+
* Session ID returned from POST /v2/modelRouter/modelSelect
|
|
81
|
+
*/
|
|
82
|
+
session_id: string;
|
|
83
|
+
}
|
|
84
|
+
export declare namespace Metrics {
|
|
85
|
+
export { type MetricSubmitFeedbackResponse as MetricSubmitFeedbackResponse, type MetricSubmitFeedbackParams as MetricSubmitFeedbackParams, };
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../src/resources/report/metrics.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,QAAQ;OACb,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,cAAc,CACZ,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,4BAA4B,CAAC;CAG5C;AAED;;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,0BAA0B;IACzC;;OAEG;IACH,QAAQ,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAErC;;OAEG;IACH,QAAQ,EAAE,QAAQ,CAAC,eAAe,CAAC;IAEnC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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.Metrics = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
class Metrics extends resource_1.APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Submit feedback on a routing decision to improve future recommendations.
|
|
9
|
+
*
|
|
10
|
+
* This endpoint allows you to provide feedback on whether the router selected the
|
|
11
|
+
* right model for your query. Your feedback is used to:
|
|
12
|
+
*
|
|
13
|
+
* 1. Personalize routing decisions for your preference_id
|
|
14
|
+
* 2. Improve the overall routing quality
|
|
15
|
+
* 3. Train and refine custom routers
|
|
16
|
+
*
|
|
17
|
+
* **Feedback Format:**
|
|
18
|
+
*
|
|
19
|
+
* - `accuracy: 1` - Thumbs up (the model performed well)
|
|
20
|
+
* - `accuracy: 0` - Thumbs down (the model did not perform well)
|
|
21
|
+
*
|
|
22
|
+
* **Requirements:**
|
|
23
|
+
*
|
|
24
|
+
* - You must have used a preference_id in the original model_select() call
|
|
25
|
+
* - The session_id must be valid and belong to your account
|
|
26
|
+
* - The provider must match one of the providers returned by model_select()
|
|
27
|
+
*
|
|
28
|
+
* **How Feedback Works:** When you submit thumbs down, the router will:
|
|
29
|
+
*
|
|
30
|
+
* - Decrease the ranking of the selected model for similar queries
|
|
31
|
+
* - Consider alternative models more favorably
|
|
32
|
+
*
|
|
33
|
+
* When you submit thumbs up, the router will:
|
|
34
|
+
*
|
|
35
|
+
* - Increase the ranking of the selected model for similar queries
|
|
36
|
+
* - Prioritize this model for similar future requests
|
|
37
|
+
*
|
|
38
|
+
* **Note:** Feedback requires a valid preference_id. Create one via POST
|
|
39
|
+
* /v2/preferences/userPreferenceCreate
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const response = await client.report.metrics.submitFeedback(
|
|
44
|
+
* {
|
|
45
|
+
* feedback: { accuracy: 1 },
|
|
46
|
+
* provider: { provider: 'openai', model: 'gpt-4o' },
|
|
47
|
+
* session_id: '550e8400-e29b-41d4-a716-446655440000',
|
|
48
|
+
* },
|
|
49
|
+
* );
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
submitFeedback(body, options) {
|
|
53
|
+
return this._client.post('/v2/report/metrics/feedback', { body, ...options });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.Metrics = Metrics;
|
|
57
|
+
//# sourceMappingURL=metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../src/resources/report/metrics.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAKlD,MAAa,OAAQ,SAAQ,sBAAW;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;AApDD,0BAoDC"}
|
|
@@ -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"}
|