@chanl/eval-sdk 0.4.0

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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/dist/client.d.ts +75 -0
  3. package/dist/client.d.ts.map +1 -0
  4. package/dist/client.js +124 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/errors.d.ts +32 -0
  7. package/dist/errors.d.ts.map +1 -0
  8. package/dist/errors.js +51 -0
  9. package/dist/errors.js.map +1 -0
  10. package/dist/index.d.ts +21 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +37 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/modules/chat.d.ts +32 -0
  15. package/dist/modules/chat.d.ts.map +1 -0
  16. package/dist/modules/chat.js +41 -0
  17. package/dist/modules/chat.js.map +1 -0
  18. package/dist/modules/datasets.d.ts +114 -0
  19. package/dist/modules/datasets.d.ts.map +1 -0
  20. package/dist/modules/datasets.js +93 -0
  21. package/dist/modules/datasets.js.map +1 -0
  22. package/dist/modules/executions.d.ts +54 -0
  23. package/dist/modules/executions.d.ts.map +1 -0
  24. package/dist/modules/executions.js +119 -0
  25. package/dist/modules/executions.js.map +1 -0
  26. package/dist/modules/generation.d.ts +82 -0
  27. package/dist/modules/generation.d.ts.map +1 -0
  28. package/dist/modules/generation.js +32 -0
  29. package/dist/modules/generation.js.map +1 -0
  30. package/dist/modules/personas.d.ts +43 -0
  31. package/dist/modules/personas.d.ts.map +1 -0
  32. package/dist/modules/personas.js +98 -0
  33. package/dist/modules/personas.js.map +1 -0
  34. package/dist/modules/prompts.d.ts +17 -0
  35. package/dist/modules/prompts.d.ts.map +1 -0
  36. package/dist/modules/prompts.js +48 -0
  37. package/dist/modules/prompts.js.map +1 -0
  38. package/dist/modules/scenarios.d.ts +47 -0
  39. package/dist/modules/scenarios.d.ts.map +1 -0
  40. package/dist/modules/scenarios.js +100 -0
  41. package/dist/modules/scenarios.js.map +1 -0
  42. package/dist/modules/scorecards.d.ts +83 -0
  43. package/dist/modules/scorecards.d.ts.map +1 -0
  44. package/dist/modules/scorecards.js +154 -0
  45. package/dist/modules/scorecards.js.map +1 -0
  46. package/dist/modules/settings.d.ts +13 -0
  47. package/dist/modules/settings.d.ts.map +1 -0
  48. package/dist/modules/settings.js +29 -0
  49. package/dist/modules/settings.js.map +1 -0
  50. package/dist/modules/tool-fixtures.d.ts +39 -0
  51. package/dist/modules/tool-fixtures.d.ts.map +1 -0
  52. package/dist/modules/tool-fixtures.js +77 -0
  53. package/dist/modules/tool-fixtures.js.map +1 -0
  54. package/dist/types.d.ts +583 -0
  55. package/dist/types.d.ts.map +1 -0
  56. package/dist/types.js +9 -0
  57. package/dist/types.js.map +1 -0
  58. package/package.json +30 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 chanl.ai
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,75 @@
1
+ /**
2
+ * EvalClient - Main entry point for the chanl-eval SDK.
3
+ *
4
+ * Uses axios for HTTP requests with X-API-Key authentication.
5
+ * Each domain module (scenarios, personas, scorecards, executions) receives
6
+ * the shared axios instance and provides typed methods for API calls.
7
+ */
8
+ import { AxiosResponse } from 'axios';
9
+ import { PromptsModule } from './modules/prompts';
10
+ import { ScenariosModule } from './modules/scenarios';
11
+ import { PersonasModule } from './modules/personas';
12
+ import { ScorecardsModule } from './modules/scorecards';
13
+ import { ExecutionsModule } from './modules/executions';
14
+ import { ToolFixturesModule } from './modules/tool-fixtures';
15
+ import { SettingsModule } from './modules/settings';
16
+ import { ChatModule } from './modules/chat';
17
+ import { DatasetsModule } from './modules/datasets';
18
+ import { GenerationModule } from './modules/generation';
19
+ import type { EvalClientConfig } from './types';
20
+ /**
21
+ * Unwrap the axios response data.
22
+ *
23
+ * The chanl-eval server returns responses in various shapes:
24
+ * - Direct object: { scenarios: [...], total: N, pagination: {...} }
25
+ * - Wrapped: { success: true, data: {...} }
26
+ *
27
+ * This helper extracts the meaningful payload from any of these shapes.
28
+ */
29
+ export declare function unwrapResponse<T>(response: AxiosResponse): T;
30
+ /**
31
+ * Main SDK client for the chanl-eval server.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * import { EvalClient } from '@chanl/eval-sdk';
36
+ *
37
+ * const client = new EvalClient({
38
+ * baseUrl: 'http://localhost:18005',
39
+ * apiKey: 'your-api-key',
40
+ * });
41
+ *
42
+ * // List scenarios
43
+ * const { scenarios } = await client.scenarios.list();
44
+ *
45
+ * // Execute a scenario
46
+ * const execution = await client.scenarios.execute(scenarioId, { mode: 'text' });
47
+ *
48
+ * // Wait for completion
49
+ * const result = await client.executions.waitForCompletion(execution.id);
50
+ * ```
51
+ */
52
+ export declare class EvalClient {
53
+ private readonly http;
54
+ readonly prompts: PromptsModule;
55
+ readonly scenarios: ScenariosModule;
56
+ readonly personas: PersonasModule;
57
+ readonly scorecards: ScorecardsModule;
58
+ readonly executions: ExecutionsModule;
59
+ readonly toolFixtures: ToolFixturesModule;
60
+ readonly settings: SettingsModule;
61
+ readonly chat: ChatModule;
62
+ readonly datasets: DatasetsModule;
63
+ readonly generation: GenerationModule;
64
+ constructor(config: EvalClientConfig);
65
+ /**
66
+ * Health check - verifies the server is reachable.
67
+ * Health endpoint is at the server root (/health), not under /api/v1.
68
+ */
69
+ health(): Promise<{
70
+ status: string;
71
+ timestamp: string;
72
+ version: string;
73
+ }>;
74
+ }
75
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAc,EAAiB,aAAa,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,GAAG,CAAC,CAa5D;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgB;IAErC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,kBAAkB,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAAC;gBAE1B,MAAM,EAAE,gBAAgB;IAkDpC;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAOhF"}
package/dist/client.js ADDED
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ /**
3
+ * EvalClient - Main entry point for the chanl-eval SDK.
4
+ *
5
+ * Uses axios for HTTP requests with X-API-Key authentication.
6
+ * Each domain module (scenarios, personas, scorecards, executions) receives
7
+ * the shared axios instance and provides typed methods for API calls.
8
+ */
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.EvalClient = void 0;
14
+ exports.unwrapResponse = unwrapResponse;
15
+ const axios_1 = __importDefault(require("axios"));
16
+ const errors_1 = require("./errors");
17
+ const prompts_1 = require("./modules/prompts");
18
+ const scenarios_1 = require("./modules/scenarios");
19
+ const personas_1 = require("./modules/personas");
20
+ const scorecards_1 = require("./modules/scorecards");
21
+ const executions_1 = require("./modules/executions");
22
+ const tool_fixtures_1 = require("./modules/tool-fixtures");
23
+ const settings_1 = require("./modules/settings");
24
+ const chat_1 = require("./modules/chat");
25
+ const datasets_1 = require("./modules/datasets");
26
+ const generation_1 = require("./modules/generation");
27
+ /**
28
+ * Unwrap the axios response data.
29
+ *
30
+ * The chanl-eval server returns responses in various shapes:
31
+ * - Direct object: { scenarios: [...], total: N, pagination: {...} }
32
+ * - Wrapped: { success: true, data: {...} }
33
+ *
34
+ * This helper extracts the meaningful payload from any of these shapes.
35
+ */
36
+ function unwrapResponse(response) {
37
+ const body = response.data;
38
+ if (!body || typeof body !== 'object') {
39
+ return body;
40
+ }
41
+ // Standard { success, data } wrapper
42
+ if ('success' in body && 'data' in body) {
43
+ return body.data;
44
+ }
45
+ return body;
46
+ }
47
+ /**
48
+ * Main SDK client for the chanl-eval server.
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * import { EvalClient } from '@chanl/eval-sdk';
53
+ *
54
+ * const client = new EvalClient({
55
+ * baseUrl: 'http://localhost:18005',
56
+ * apiKey: 'your-api-key',
57
+ * });
58
+ *
59
+ * // List scenarios
60
+ * const { scenarios } = await client.scenarios.list();
61
+ *
62
+ * // Execute a scenario
63
+ * const execution = await client.scenarios.execute(scenarioId, { mode: 'text' });
64
+ *
65
+ * // Wait for completion
66
+ * const result = await client.executions.waitForCompletion(execution.id);
67
+ * ```
68
+ */
69
+ class EvalClient {
70
+ constructor(config) {
71
+ const headers = {
72
+ 'Content-Type': 'application/json',
73
+ };
74
+ if (config.apiKey) {
75
+ headers['X-API-Key'] = config.apiKey;
76
+ }
77
+ this.http = axios_1.default.create({
78
+ baseURL: config.baseUrl,
79
+ headers,
80
+ });
81
+ // Response interceptor to convert HTTP errors into typed SDK errors
82
+ this.http.interceptors.response.use((response) => response, (error) => {
83
+ if (axios_1.default.isAxiosError(error) && error.response) {
84
+ const status = error.response.status;
85
+ const body = error.response.data;
86
+ const rawMessage = body?.message || body?.error?.message || error.message;
87
+ const message = Array.isArray(rawMessage) ? rawMessage.join('. ') : String(rawMessage);
88
+ if (status === 401) {
89
+ throw new errors_1.EvalAuthError(message);
90
+ }
91
+ if (status === 404) {
92
+ throw new errors_1.EvalNotFoundError(message);
93
+ }
94
+ throw new errors_1.EvalApiError(message, status, body?.error?.code);
95
+ }
96
+ // Re-throw network errors and other non-HTTP errors
97
+ throw error;
98
+ });
99
+ // Register modules
100
+ this.prompts = new prompts_1.PromptsModule(this.http);
101
+ this.scenarios = new scenarios_1.ScenariosModule(this.http);
102
+ this.personas = new personas_1.PersonasModule(this.http);
103
+ this.scorecards = new scorecards_1.ScorecardsModule(this.http);
104
+ this.executions = new executions_1.ExecutionsModule(this.http);
105
+ this.toolFixtures = new tool_fixtures_1.ToolFixturesModule(this.http);
106
+ this.settings = new settings_1.SettingsModule(this.http);
107
+ this.chat = new chat_1.ChatModule(this.http);
108
+ this.datasets = new datasets_1.DatasetsModule(this.http);
109
+ this.generation = new generation_1.GenerationModule(this.http);
110
+ }
111
+ /**
112
+ * Health check - verifies the server is reachable.
113
+ * Health endpoint is at the server root (/health), not under /api/v1.
114
+ */
115
+ async health() {
116
+ // Strip /api/v1 suffix from baseURL to reach the root health endpoint
117
+ const base = this.http.defaults.baseURL || '';
118
+ const rootUrl = base.replace(/\/api\/v\d+\/?$/, '');
119
+ const response = await this.http.get(`${rootUrl}/health`);
120
+ return response.data;
121
+ }
122
+ }
123
+ exports.EvalClient = EvalClient;
124
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAyBH,wCAaC;AApCD,kDAA4D;AAC5D,qCAA0E;AAC1E,+CAAkD;AAClD,mDAAsD;AACtD,iDAAoD;AACpD,qDAAwD;AACxD,qDAAwD;AACxD,2DAA6D;AAC7D,iDAAoD;AACpD,yCAA4C;AAC5C,iDAAoD;AACpD,qDAAwD;AAGxD;;;;;;;;GAQG;AACH,SAAgB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AC9C,IAAI,CAAC,UAAU,GAAG,IAAI,6BAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,MAAM;QACV,sEAAsE;QACtE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;QACpD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,SAAS,CAAC,CAAC;QAC1D,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AA3ED,gCA2EC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Error classes for the eval SDK.
3
+ */
4
+ /**
5
+ * Base error for all eval SDK errors.
6
+ */
7
+ export declare class EvalApiError extends Error {
8
+ readonly statusCode: number;
9
+ readonly code?: string | undefined;
10
+ constructor(message: string, statusCode: number, code?: string | undefined);
11
+ }
12
+ /**
13
+ * Thrown when the server returns a 401 Unauthorized response.
14
+ */
15
+ export declare class EvalAuthError extends EvalApiError {
16
+ constructor(message?: string);
17
+ }
18
+ /**
19
+ * Thrown when the server returns a 404 Not Found response.
20
+ */
21
+ export declare class EvalNotFoundError extends EvalApiError {
22
+ constructor(message?: string);
23
+ }
24
+ /**
25
+ * Thrown when waitForCompletion times out.
26
+ */
27
+ export declare class EvalTimeoutError extends Error {
28
+ readonly executionId: string;
29
+ readonly timeoutMs: number;
30
+ constructor(executionId: string, timeoutMs: number);
31
+ }
32
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;aAGnB,UAAU,EAAE,MAAM;aAClB,IAAI,CAAC,EAAE,MAAM;gBAF7B,OAAO,EAAE,MAAM,EACC,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,YAAA;CAKhC;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,SAAiB;CAIrC;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,SAAc;CAIlC;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;aAEvB,WAAW,EAAE,MAAM;aACnB,SAAS,EAAE,MAAM;gBADjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM;CAKpC"}
package/dist/errors.js ADDED
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ /**
3
+ * Error classes for the eval SDK.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EvalTimeoutError = exports.EvalNotFoundError = exports.EvalAuthError = exports.EvalApiError = void 0;
7
+ /**
8
+ * Base error for all eval SDK errors.
9
+ */
10
+ class EvalApiError extends Error {
11
+ constructor(message, statusCode, code) {
12
+ super(message);
13
+ this.statusCode = statusCode;
14
+ this.code = code;
15
+ this.name = 'EvalApiError';
16
+ }
17
+ }
18
+ exports.EvalApiError = EvalApiError;
19
+ /**
20
+ * Thrown when the server returns a 401 Unauthorized response.
21
+ */
22
+ class EvalAuthError extends EvalApiError {
23
+ constructor(message = 'Unauthorized') {
24
+ super(message, 401, 'UNAUTHORIZED');
25
+ this.name = 'EvalAuthError';
26
+ }
27
+ }
28
+ exports.EvalAuthError = EvalAuthError;
29
+ /**
30
+ * Thrown when the server returns a 404 Not Found response.
31
+ */
32
+ class EvalNotFoundError extends EvalApiError {
33
+ constructor(message = 'Not found') {
34
+ super(message, 404, 'NOT_FOUND');
35
+ this.name = 'EvalNotFoundError';
36
+ }
37
+ }
38
+ exports.EvalNotFoundError = EvalNotFoundError;
39
+ /**
40
+ * Thrown when waitForCompletion times out.
41
+ */
42
+ class EvalTimeoutError extends Error {
43
+ constructor(executionId, timeoutMs) {
44
+ super(`Execution ${executionId} did not complete within ${timeoutMs}ms`);
45
+ this.executionId = executionId;
46
+ this.timeoutMs = timeoutMs;
47
+ this.name = 'EvalTimeoutError';
48
+ }
49
+ }
50
+ exports.EvalTimeoutError = EvalTimeoutError;
51
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH;;GAEG;AACH,MAAa,YAAa,SAAQ,KAAK;IACrC,YACE,OAAe,EACC,UAAkB,EAClB,IAAa;QAE7B,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,eAAU,GAAV,UAAU,CAAQ;QAClB,SAAI,GAAJ,IAAI,CAAS;QAG7B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AATD,oCASC;AAED;;GAEG;AACH,MAAa,aAAc,SAAQ,YAAY;IAC7C,YAAY,OAAO,GAAG,cAAc;QAClC,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC;AAED;;GAEG;AACH,MAAa,iBAAkB,SAAQ,YAAY;IACjD,YAAY,OAAO,GAAG,WAAW;QAC/B,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC;AAED;;GAEG;AACH,MAAa,gBAAiB,SAAQ,KAAK;IACzC,YACkB,WAAmB,EACnB,SAAiB;QAEjC,KAAK,CAAC,aAAa,WAAW,4BAA4B,SAAS,IAAI,CAAC,CAAC;QAHzD,gBAAW,GAAX,WAAW,CAAQ;QACnB,cAAS,GAAT,SAAS,CAAQ;QAGjC,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AARD,4CAQC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @chanl/eval-sdk
3
+ *
4
+ * TypeScript SDK for the chanl-eval server.
5
+ */
6
+ export { EvalClient, unwrapResponse } from './client';
7
+ export { PromptsModule } from './modules/prompts';
8
+ export { ScenariosModule } from './modules/scenarios';
9
+ export { PersonasModule } from './modules/personas';
10
+ export { ScorecardsModule } from './modules/scorecards';
11
+ export { ExecutionsModule } from './modules/executions';
12
+ export { ToolFixturesModule } from './modules/tool-fixtures';
13
+ export { SettingsModule } from './modules/settings';
14
+ export { ChatModule } from './modules/chat';
15
+ export { DatasetsModule } from './modules/datasets';
16
+ export { GenerationModule } from './modules/generation';
17
+ export type { GenerateOptions, GeneratedScenario, GeneratedPersona, GeneratedCriterion, GeneratedScorecard, GeneratedSuite, PersistResult, } from './modules/generation';
18
+ export type { GenerateDatasetOptions, GenerateDatasetResponse, BatchStatusResponse, ExportDatasetOptions, ExportPreviewResponse, DatasetBatch, BatchConversation, BatchConversationsResponse, } from './modules/datasets';
19
+ export { EvalApiError, EvalAuthError, EvalNotFoundError, EvalTimeoutError, } from './errors';
20
+ export type { EvalClientConfig, Pagination, PaginatedResponse, Prompt, CreatePromptDto, UpdatePromptDto, ListPromptsParams, ListPromptsResponse, Scenario, CreateScenarioDto, UpdateScenarioDto, ListScenariosParams, ListScenariosResponse, Execution, ExecuteScenarioDto, ListExecutionsParams, ListExecutionsResponse, WaitForCompletionOptions, EvaluateExecutionRequest, ScorecardEvaluationResult, Persona, CreatePersonaDto, UpdatePersonaDto, ListPersonasParams, ListPersonasResponse, Scorecard, ScorecardCategory, ScorecardCriteria, ScorecardCriteriaResult, ScorecardResult, CreateScorecardDto, UpdateScorecardDto, ListScorecardsParams, ListScorecardsResponse, ScorecardDefaultResponse, EvaluateRequest, CreateScorecardResultDto, ToolFixture, CreateToolFixtureDto, UpdateToolFixtureDto, ListToolFixturesParams, ListToolFixturesResponse, ToolFixtureStats, Settings, UpdateSettingsDto, ChatSession, ChatRequest, ChatResponse, } from './types';
21
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,cAAc,EACd,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,sBAAsB,EACtB,uBAAuB,EACvB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,YAAY,EAEV,gBAAgB,EAEhB,UAAU,EACV,iBAAiB,EAEjB,MAAM,EACN,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EAEnB,QAAQ,EACR,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EAErB,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,EAEzB,OAAO,EACP,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EAEpB,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,wBAAwB,EAExB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAEhB,QAAQ,EACR,iBAAiB,EAEjB,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * @chanl/eval-sdk
4
+ *
5
+ * TypeScript SDK for the chanl-eval server.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.EvalTimeoutError = exports.EvalNotFoundError = exports.EvalAuthError = exports.EvalApiError = exports.GenerationModule = exports.DatasetsModule = exports.ChatModule = exports.SettingsModule = exports.ToolFixturesModule = exports.ExecutionsModule = exports.ScorecardsModule = exports.PersonasModule = exports.ScenariosModule = exports.PromptsModule = exports.unwrapResponse = exports.EvalClient = void 0;
9
+ var client_1 = require("./client");
10
+ Object.defineProperty(exports, "EvalClient", { enumerable: true, get: function () { return client_1.EvalClient; } });
11
+ Object.defineProperty(exports, "unwrapResponse", { enumerable: true, get: function () { return client_1.unwrapResponse; } });
12
+ var prompts_1 = require("./modules/prompts");
13
+ Object.defineProperty(exports, "PromptsModule", { enumerable: true, get: function () { return prompts_1.PromptsModule; } });
14
+ var scenarios_1 = require("./modules/scenarios");
15
+ Object.defineProperty(exports, "ScenariosModule", { enumerable: true, get: function () { return scenarios_1.ScenariosModule; } });
16
+ var personas_1 = require("./modules/personas");
17
+ Object.defineProperty(exports, "PersonasModule", { enumerable: true, get: function () { return personas_1.PersonasModule; } });
18
+ var scorecards_1 = require("./modules/scorecards");
19
+ Object.defineProperty(exports, "ScorecardsModule", { enumerable: true, get: function () { return scorecards_1.ScorecardsModule; } });
20
+ var executions_1 = require("./modules/executions");
21
+ Object.defineProperty(exports, "ExecutionsModule", { enumerable: true, get: function () { return executions_1.ExecutionsModule; } });
22
+ var tool_fixtures_1 = require("./modules/tool-fixtures");
23
+ Object.defineProperty(exports, "ToolFixturesModule", { enumerable: true, get: function () { return tool_fixtures_1.ToolFixturesModule; } });
24
+ var settings_1 = require("./modules/settings");
25
+ Object.defineProperty(exports, "SettingsModule", { enumerable: true, get: function () { return settings_1.SettingsModule; } });
26
+ var chat_1 = require("./modules/chat");
27
+ Object.defineProperty(exports, "ChatModule", { enumerable: true, get: function () { return chat_1.ChatModule; } });
28
+ var datasets_1 = require("./modules/datasets");
29
+ Object.defineProperty(exports, "DatasetsModule", { enumerable: true, get: function () { return datasets_1.DatasetsModule; } });
30
+ var generation_1 = require("./modules/generation");
31
+ Object.defineProperty(exports, "GenerationModule", { enumerable: true, get: function () { return generation_1.GenerationModule; } });
32
+ var errors_1 = require("./errors");
33
+ Object.defineProperty(exports, "EvalApiError", { enumerable: true, get: function () { return errors_1.EvalApiError; } });
34
+ Object.defineProperty(exports, "EvalAuthError", { enumerable: true, get: function () { return errors_1.EvalAuthError; } });
35
+ Object.defineProperty(exports, "EvalNotFoundError", { enumerable: true, get: function () { return errors_1.EvalNotFoundError; } });
36
+ Object.defineProperty(exports, "EvalTimeoutError", { enumerable: true, get: function () { return errors_1.EvalTimeoutError; } });
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,mCAAsD;AAA7C,oGAAA,UAAU,OAAA;AAAE,wGAAA,cAAc,OAAA;AACnC,6CAAkD;AAAzC,wGAAA,aAAa,OAAA;AACtB,iDAAsD;AAA7C,4GAAA,eAAe,OAAA;AACxB,+CAAoD;AAA3C,0GAAA,cAAc,OAAA;AACvB,mDAAwD;AAA/C,8GAAA,gBAAgB,OAAA;AACzB,mDAAwD;AAA/C,8GAAA,gBAAgB,OAAA;AACzB,yDAA6D;AAApD,mHAAA,kBAAkB,OAAA;AAC3B,+CAAoD;AAA3C,0GAAA,cAAc,OAAA;AACvB,uCAA4C;AAAnC,kGAAA,UAAU,OAAA;AACnB,+CAAoD;AAA3C,0GAAA,cAAc,OAAA;AACvB,mDAAwD;AAA/C,8GAAA,gBAAgB,OAAA;AAoBzB,mCAKkB;AAJhB,sGAAA,YAAY,OAAA;AACZ,uGAAA,aAAa,OAAA;AACb,2GAAA,iBAAiB,OAAA;AACjB,0GAAA,gBAAgB,OAAA"}
@@ -0,0 +1,32 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export interface ChatSession {
3
+ sessionId: string;
4
+ executionId: string;
5
+ }
6
+ export interface ChatResponse {
7
+ content: string;
8
+ latencyMs?: number;
9
+ toolCalls?: Array<{
10
+ id: string;
11
+ name: string;
12
+ arguments: Record<string, any>;
13
+ result?: any;
14
+ }>;
15
+ }
16
+ export declare class ChatModule {
17
+ private readonly http;
18
+ constructor(http: AxiosInstance);
19
+ createSession(dto: {
20
+ promptId: string;
21
+ toolFixtureIds?: string[];
22
+ }): Promise<ChatSession>;
23
+ sendMessage(sessionId: string, message: string): Promise<ChatResponse>;
24
+ endSession(sessionId: string): Promise<any>;
25
+ getSession(sessionId: string): Promise<any>;
26
+ /** Find the last active (un-ended) manual chat session */
27
+ getActiveSession(): Promise<{
28
+ sessionId: string;
29
+ execution: any;
30
+ } | null>;
31
+ }
32
+ //# sourceMappingURL=chat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/modules/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,KAAK,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,CAAC,CAAC;CACJ;AAED,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,aAAa;IAE1C,aAAa,CAAC,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAMzF,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAQtE,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAM3C,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAMjD,0DAA0D;IACpD,gBAAgB,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,GAAG,CAAA;KAAE,GAAG,IAAI,CAAC;CAOhF"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChatModule = void 0;
4
+ class ChatModule {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async createSession(dto) {
9
+ const response = await this.http.post('/chat/sessions', dto);
10
+ const body = response.data;
11
+ return body?.session ?? body?.data?.session ?? body;
12
+ }
13
+ async sendMessage(sessionId, message) {
14
+ const response = await this.http.post(`/chat/sessions/${sessionId}/messages`, {
15
+ message,
16
+ });
17
+ const body = response.data;
18
+ return body?.response ?? body?.data?.response ?? body;
19
+ }
20
+ async endSession(sessionId) {
21
+ const response = await this.http.post(`/chat/sessions/${sessionId}/end`);
22
+ const body = response.data;
23
+ return body?.execution ?? body?.data?.execution ?? body;
24
+ }
25
+ async getSession(sessionId) {
26
+ const response = await this.http.get(`/chat/sessions/${sessionId}`);
27
+ const body = response.data;
28
+ return body?.execution ?? body?.data?.execution ?? body;
29
+ }
30
+ /** Find the last active (un-ended) manual chat session */
31
+ async getActiveSession() {
32
+ const response = await this.http.get('/chat/sessions/active');
33
+ const body = response.data;
34
+ const data = body?.data ?? body;
35
+ if (!data || !data.sessionId)
36
+ return null;
37
+ return data;
38
+ }
39
+ }
40
+ exports.ChatModule = ChatModule;
41
+ //# sourceMappingURL=chat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/modules/chat.ts"],"names":[],"mappings":";;;AAkBA,MAAa,UAAU;IACrB,YAA6B,IAAmB;QAAnB,SAAI,GAAJ,IAAI,CAAe;IAAG,CAAC;IAEpD,KAAK,CAAC,aAAa,CAAC,GAAoD;QACtE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC3B,OAAO,IAAI,EAAE,OAAO,IAAI,IAAI,EAAE,IAAI,EAAE,OAAO,IAAI,IAAI,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,SAAiB,EAAE,OAAe;QAClD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CA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ions.
5
+ */
6
+ import type { AxiosInstance } from 'axios';
7
+ export interface GenerateDatasetOptions {
8
+ scenarioId: string;
9
+ promptId: string;
10
+ personaIds?: string[];
11
+ count?: number;
12
+ }
13
+ export interface GenerateDatasetResponse {
14
+ batchId: string;
15
+ batchName: string;
16
+ executionIds: string[];
17
+ total: number;
18
+ }
19
+ export interface DatasetBatch {
20
+ batchId: string;
21
+ batchName: string;
22
+ conversations: number;
23
+ completed: number;
24
+ failed: number;
25
+ avgScore: number;
26
+ scenarioId: string;
27
+ createdAt: string;
28
+ }
29
+ export interface BatchConversation {
30
+ executionId: string;
31
+ personaId: string;
32
+ status: string;
33
+ score: number | undefined;
34
+ turns: number;
35
+ duration: number | undefined;
36
+ preview: string;
37
+ createdAt: string | undefined;
38
+ }
39
+ export interface BatchConversationsResponse {
40
+ conversations: BatchConversation[];
41
+ total: number;
42
+ page: number;
43
+ limit: number;
44
+ }
45
+ export interface BatchStatusResponse {
46
+ batchId: string;
47
+ total: number;
48
+ completed: number;
49
+ failed: number;
50
+ running: number;
51
+ queued: number;
52
+ status: 'running' | 'completed' | 'partial' | 'failed';
53
+ }
54
+ export interface ExportDatasetOptions {
55
+ format: 'openai' | 'openai-tools' | 'sharegpt' | 'dpo';
56
+ filters?: {
57
+ scenarioIds?: string[];
58
+ personaIds?: string[];
59
+ minScore?: number;
60
+ status?: string;
61
+ fromDate?: string;
62
+ toDate?: string;
63
+ batchId?: string;
64
+ };
65
+ options?: {
66
+ systemPrompt?: string;
67
+ includeMetadata?: boolean;
68
+ };
69
+ }
70
+ export interface ExportPreviewResponse {
71
+ count: number;
72
+ avgScore: number;
73
+ sampleLine: string | null;
74
+ format: string;
75
+ }
76
+ export declare class DatasetsModule {
77
+ private readonly http;
78
+ constructor(http: AxiosInstance);
79
+ /**
80
+ * List all dataset batches with aggregated stats.
81
+ */
82
+ list(): Promise<DatasetBatch[]>;
83
+ /**
84
+ * Get paginated conversations within a batch.
85
+ */
86
+ conversations(batchId: string, pagination?: {
87
+ page?: number;
88
+ limit?: number;
89
+ }): Promise<BatchConversationsResponse>;
90
+ /**
91
+ * Generate a batch of conversations for dataset creation.
92
+ */
93
+ generate(options: GenerateDatasetOptions): Promise<GenerateDatasetResponse>;
94
+ /**
95
+ * Get the status of a batch generation run.
96
+ */
97
+ generationStatus(batchId: string): Promise<BatchStatusResponse>;
98
+ /**
99
+ * Wait for a batch generation to complete.
100
+ */
101
+ waitForBatch(batchId: string, options?: {
102
+ pollIntervalMs?: number;
103
+ timeoutMs?: number;
104
+ }): Promise<BatchStatusResponse>;
105
+ /**
106
+ * Export executions as a training data file (returns raw response for streaming).
107
+ */
108
+ export(options: ExportDatasetOptions): Promise<string>;
109
+ /**
110
+ * Preview what an export would contain without downloading.
111
+ */
112
+ preview(format?: string, filters?: ExportDatasetOptions['filters']): Promise<ExportPreviewResponse>;
113
+ }
114
+ //# sourceMappingURL=datasets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../src/modules/datasets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;I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