@indemn/cli 1.0.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.
- package/.claude-plugin/plugin.json +13 -0
- package/.mcp.json +9 -0
- package/README.md +225 -0
- package/dist/cli/agents.d.ts +3 -0
- package/dist/cli/agents.d.ts.map +1 -0
- package/dist/cli/agents.js +187 -0
- package/dist/cli/agents.js.map +1 -0
- package/dist/cli/auth.d.ts +3 -0
- package/dist/cli/auth.d.ts.map +1 -0
- package/dist/cli/auth.js +161 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/chat.d.ts +3 -0
- package/dist/cli/chat.d.ts.map +1 -0
- package/dist/cli/chat.js +142 -0
- package/dist/cli/chat.js.map +1 -0
- package/dist/cli/config.d.ts +3 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +119 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/eval.d.ts +3 -0
- package/dist/cli/eval.d.ts.map +1 -0
- package/dist/cli/eval.js +717 -0
- package/dist/cli/eval.js.map +1 -0
- package/dist/cli/functions.d.ts +3 -0
- package/dist/cli/functions.d.ts.map +1 -0
- package/dist/cli/functions.js +346 -0
- package/dist/cli/functions.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +64 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/kb.d.ts +3 -0
- package/dist/cli/kb.d.ts.map +1 -0
- package/dist/cli/kb.js +377 -0
- package/dist/cli/kb.js.map +1 -0
- package/dist/cli/utils/output.d.ts +6 -0
- package/dist/cli/utils/output.d.ts.map +1 -0
- package/dist/cli/utils/output.js +36 -0
- package/dist/cli/utils/output.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +15 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +4 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +814 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/sdk/agents.d.ts +13 -0
- package/dist/sdk/agents.d.ts.map +1 -0
- package/dist/sdk/agents.js +27 -0
- package/dist/sdk/agents.js.map +1 -0
- package/dist/sdk/auth.d.ts +18 -0
- package/dist/sdk/auth.d.ts.map +1 -0
- package/dist/sdk/auth.js +98 -0
- package/dist/sdk/auth.js.map +1 -0
- package/dist/sdk/chat.d.ts +17 -0
- package/dist/sdk/chat.d.ts.map +1 -0
- package/dist/sdk/chat.js +113 -0
- package/dist/sdk/chat.js.map +1 -0
- package/dist/sdk/client.d.ts +36 -0
- package/dist/sdk/client.d.ts.map +1 -0
- package/dist/sdk/client.js +219 -0
- package/dist/sdk/client.js.map +1 -0
- package/dist/sdk/config.d.ts +11 -0
- package/dist/sdk/config.d.ts.map +1 -0
- package/dist/sdk/config.js +20 -0
- package/dist/sdk/config.js.map +1 -0
- package/dist/sdk/eval.d.ts +13 -0
- package/dist/sdk/eval.d.ts.map +1 -0
- package/dist/sdk/eval.js +36 -0
- package/dist/sdk/eval.js.map +1 -0
- package/dist/sdk/functions.d.ts +30 -0
- package/dist/sdk/functions.d.ts.map +1 -0
- package/dist/sdk/functions.js +59 -0
- package/dist/sdk/functions.js.map +1 -0
- package/dist/sdk/index.d.ts +12 -0
- package/dist/sdk/index.d.ts.map +1 -0
- package/dist/sdk/index.js +12 -0
- package/dist/sdk/index.js.map +1 -0
- package/dist/sdk/kb.d.ts +30 -0
- package/dist/sdk/kb.d.ts.map +1 -0
- package/dist/sdk/kb.js +102 -0
- package/dist/sdk/kb.js.map +1 -0
- package/dist/sdk/rubrics.d.ts +14 -0
- package/dist/sdk/rubrics.d.ts.map +1 -0
- package/dist/sdk/rubrics.js +29 -0
- package/dist/sdk/rubrics.js.map +1 -0
- package/dist/sdk/test-sets.d.ts +14 -0
- package/dist/sdk/test-sets.d.ts.map +1 -0
- package/dist/sdk/test-sets.js +29 -0
- package/dist/sdk/test-sets.js.map +1 -0
- package/dist/sdk/types.d.ts +305 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +3 -0
- package/dist/sdk/types.js.map +1 -0
- package/package.json +40 -0
- package/skills/agent-setup/SKILL.md +131 -0
- package/skills/eval-orchestration/SKILL.md +257 -0
- package/skills/rubric-creation/SKILL.md +163 -0
- package/skills/test-set-creation/SKILL.md +250 -0
- package/src/cli/agents.ts +206 -0
- package/src/cli/auth.ts +170 -0
- package/src/cli/chat.ts +161 -0
- package/src/cli/config.ts +131 -0
- package/src/cli/eval.ts +750 -0
- package/src/cli/functions.ts +330 -0
- package/src/cli/index.ts +68 -0
- package/src/cli/kb.ts +412 -0
- package/src/cli/utils/output.ts +42 -0
- package/src/mcp/server.ts +17 -0
- package/src/mcp/tools.ts +971 -0
- package/src/sdk/agents.ts +47 -0
- package/src/sdk/auth.ts +132 -0
- package/src/sdk/chat.ts +133 -0
- package/src/sdk/client.ts +238 -0
- package/src/sdk/config.ts +28 -0
- package/src/sdk/eval.ts +57 -0
- package/src/sdk/functions.ts +103 -0
- package/src/sdk/index.ts +11 -0
- package/src/sdk/kb.ts +183 -0
- package/src/sdk/rubrics.ts +35 -0
- package/src/sdk/test-sets.ts +35 -0
- package/src/sdk/types.ts +347 -0
- package/test/fixtures/test-rubric.json +66 -0
- package/test/fixtures/test-testset.json +55 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import type { IndemnClient } from './client.js';
|
|
2
|
+
import type { BotFunction, CreateFunctionInput, UpdateFunctionInput, FunctionParameter } from './types.js';
|
|
3
|
+
|
|
4
|
+
export class FunctionsSDK {
|
|
5
|
+
constructor(private client: IndemnClient) {}
|
|
6
|
+
|
|
7
|
+
async listFunctions(agentId: string): Promise<BotFunction[]> {
|
|
8
|
+
return this.client.copilotGet<BotFunction[]>(
|
|
9
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions`,
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
async createFunction(agentId: string, input: CreateFunctionInput): Promise<BotFunction> {
|
|
14
|
+
return this.client.copilotPost<BotFunction>(
|
|
15
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions`,
|
|
16
|
+
input,
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async updateFunction(agentId: string, funcId: string, input: UpdateFunctionInput): Promise<BotFunction> {
|
|
21
|
+
return this.client.copilotPut<BotFunction>(
|
|
22
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/${funcId}`,
|
|
23
|
+
input,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async deleteFunction(agentId: string, funcId: string): Promise<void> {
|
|
28
|
+
await this.client.copilotDelete(
|
|
29
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/${funcId}`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async testFunction(agentId: string, funcId: string, params?: Record<string, unknown>): Promise<unknown> {
|
|
34
|
+
return this.client.copilotPost(
|
|
35
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/${funcId}/test-rest-api`,
|
|
36
|
+
params,
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async exportFunctions(agentId: string): Promise<unknown> {
|
|
41
|
+
return this.client.copilotPost(
|
|
42
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/export`,
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async importFunctions(agentId: string, url: string): Promise<unknown> {
|
|
47
|
+
return this.client.copilotPost(
|
|
48
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/import`,
|
|
49
|
+
{ url },
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async listParameters(agentId: string, funcId: string): Promise<FunctionParameter[]> {
|
|
54
|
+
return this.client.copilotGet<FunctionParameter[]>(
|
|
55
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/${funcId}/parameters`,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async addParameter(agentId: string, funcId: string, param: { name: string; type: string; description?: string; required?: boolean }): Promise<FunctionParameter> {
|
|
60
|
+
// Server expects an array of parameters
|
|
61
|
+
const payload = [{
|
|
62
|
+
name: param.name,
|
|
63
|
+
type: param.type,
|
|
64
|
+
description: param.description,
|
|
65
|
+
is_required: param.required ?? false,
|
|
66
|
+
}];
|
|
67
|
+
return this.client.copilotPost<FunctionParameter>(
|
|
68
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/${funcId}/parameters`,
|
|
69
|
+
payload,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async updateParameter(agentId: string, funcId: string, paramId: string, param: { name?: string; type?: string; description?: string; required?: boolean }): Promise<FunctionParameter> {
|
|
74
|
+
// Server uses POST upsert (no PUT /:id endpoint exists). Include the param id for upsert matching.
|
|
75
|
+
const payload = [{
|
|
76
|
+
id: paramId,
|
|
77
|
+
...param,
|
|
78
|
+
is_required: param.required ?? false,
|
|
79
|
+
}];
|
|
80
|
+
return this.client.copilotPost<FunctionParameter>(
|
|
81
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/${funcId}/parameters`,
|
|
82
|
+
payload,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async deleteParameter(agentId: string, funcId: string, paramId: string): Promise<void> {
|
|
87
|
+
await this.client.copilotDelete(
|
|
88
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/functions/${funcId}/parameters/${paramId}`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async listMasterFunctions(): Promise<unknown[]> {
|
|
93
|
+
return this.client.copilotGet<unknown[]>(
|
|
94
|
+
'/organization/:org_id/ai-studio/master-functions',
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async listLLMModels(): Promise<unknown[]> {
|
|
99
|
+
return this.client.copilotGet<unknown[]>(
|
|
100
|
+
'/organization/:org_id/ai-studio/llm-models',
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
package/src/sdk/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { IndemnClient } from './client.js';
|
|
2
|
+
export { login, logout, whoami } from './auth.js';
|
|
3
|
+
export { AgentsSDK } from './agents.js';
|
|
4
|
+
export { ConfigSDK } from './config.js';
|
|
5
|
+
export { FunctionsSDK } from './functions.js';
|
|
6
|
+
export { KBSDK } from './kb.js';
|
|
7
|
+
export { RubricsSDK } from './rubrics.js';
|
|
8
|
+
export { TestSetsSDK } from './test-sets.js';
|
|
9
|
+
export { EvalSDK } from './eval.js';
|
|
10
|
+
export { ChatSession } from './chat.js';
|
|
11
|
+
export * from './types.js';
|
package/src/sdk/kb.ts
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type { IndemnClient } from './client.js';
|
|
2
|
+
import type {
|
|
3
|
+
KnowledgeBase,
|
|
4
|
+
CreateKBInput,
|
|
5
|
+
UpdateKBInput,
|
|
6
|
+
DataSource,
|
|
7
|
+
AddDataSourceInput,
|
|
8
|
+
KBMapping,
|
|
9
|
+
} from './types.js';
|
|
10
|
+
|
|
11
|
+
export class KBSDK {
|
|
12
|
+
constructor(private client: IndemnClient) {}
|
|
13
|
+
|
|
14
|
+
async listKBs(): Promise<KnowledgeBase[]> {
|
|
15
|
+
return this.client.copilotGet<KnowledgeBase[]>(
|
|
16
|
+
'/organization/:org_id/knowledge-bases',
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async getKB(id: string): Promise<KnowledgeBase> {
|
|
21
|
+
const result = await this.client.copilotGet<KnowledgeBase | KnowledgeBase[]>(
|
|
22
|
+
`/organization/:org_id/knowledge-bases/${id}`,
|
|
23
|
+
);
|
|
24
|
+
// Server may return an array; extract the first element
|
|
25
|
+
return Array.isArray(result) ? result[0] : result;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async createKB(input: CreateKBInput): Promise<KnowledgeBase> {
|
|
29
|
+
return this.client.copilotPost<KnowledgeBase>(
|
|
30
|
+
'/organization/:org_id/knowledge-bases',
|
|
31
|
+
input,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async updateKB(id: string, input: UpdateKBInput): Promise<KnowledgeBase> {
|
|
36
|
+
return this.client.copilotPut<KnowledgeBase>(
|
|
37
|
+
`/organization/:org_id/knowledge-bases/${id}`,
|
|
38
|
+
input,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async deleteKB(id: string): Promise<void> {
|
|
43
|
+
await this.client.copilotDelete(
|
|
44
|
+
`/organization/:org_id/knowledge-bases/${id}`,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async listDataSources(
|
|
49
|
+
kbId: string,
|
|
50
|
+
query?: { page?: string; limit?: string },
|
|
51
|
+
): Promise<{ dataSources: DataSource[]; total: number; page: number; pages: number }> {
|
|
52
|
+
return this.client.copilotGet<{ dataSources: DataSource[]; total: number; page: number; pages: number }>(
|
|
53
|
+
`/organization/:org_id/knowledge-bases/${kbId}/data-source`,
|
|
54
|
+
query as Record<string, string> | undefined,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async addDataSource(kbId: string, input: AddDataSourceInput): Promise<DataSource> {
|
|
59
|
+
if (input.source_url) {
|
|
60
|
+
// URL type — must use /import endpoint (data-source POST only supports text)
|
|
61
|
+
return this.client.copilotPost<DataSource>(
|
|
62
|
+
`/organization/:org_id/knowledge-bases/${kbId}/import`,
|
|
63
|
+
{
|
|
64
|
+
type: 'url',
|
|
65
|
+
sources: [{ url: input.source_url, crawl_mode: 'full' }],
|
|
66
|
+
},
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Text/QnA type
|
|
71
|
+
return this.client.copilotPost<DataSource>(
|
|
72
|
+
`/organization/:org_id/knowledge-bases/${kbId}/data-source`,
|
|
73
|
+
{ type: 'text', payload: { question: input.question, answer: input.answer, isManual: true } },
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async scrapeUrl(kbId: string, url: string, crawlMode: string = 'full'): Promise<unknown> {
|
|
78
|
+
return this.client.copilotPost(
|
|
79
|
+
`/organization/:org_id/knowledge-bases/${kbId}/import`,
|
|
80
|
+
{
|
|
81
|
+
type: 'url',
|
|
82
|
+
sources: [{ url, crawl_mode: crawlMode }],
|
|
83
|
+
},
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async uploadFile(kbId: string, filePath: string): Promise<unknown> {
|
|
88
|
+
const fs = await import('fs');
|
|
89
|
+
const path = await import('path');
|
|
90
|
+
|
|
91
|
+
if (!fs.existsSync(filePath)) {
|
|
92
|
+
throw new Error(`File not found: ${filePath}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const fileBuffer = fs.readFileSync(filePath);
|
|
96
|
+
const fileName = path.basename(filePath);
|
|
97
|
+
const blob = new Blob([fileBuffer]);
|
|
98
|
+
|
|
99
|
+
const formData = new FormData();
|
|
100
|
+
formData.append('file', blob, fileName);
|
|
101
|
+
|
|
102
|
+
// Need a raw fetch since copilotPost sets Content-Type to JSON
|
|
103
|
+
const hosts = this.client.getHosts();
|
|
104
|
+
const orgId = this.client.getOrgId();
|
|
105
|
+
const apiKey = this.client.getApiKey();
|
|
106
|
+
const url_str = `${hosts.copilot}/organization/${orgId}/knowledge-bases/${kbId}/upload-urls`;
|
|
107
|
+
|
|
108
|
+
const res = await fetch(url_str, {
|
|
109
|
+
method: 'POST',
|
|
110
|
+
headers: {
|
|
111
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
112
|
+
},
|
|
113
|
+
body: formData,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (!res.ok) {
|
|
117
|
+
const text = await res.text();
|
|
118
|
+
throw new Error(`Upload failed (${res.status}): ${text}`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const json = await res.json() as { data?: unknown };
|
|
122
|
+
return json.data || json;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
async updateDataSource(
|
|
126
|
+
kbId: string,
|
|
127
|
+
sourceId: string,
|
|
128
|
+
input: Partial<AddDataSourceInput>,
|
|
129
|
+
): Promise<DataSource> {
|
|
130
|
+
return this.client.copilotPut<DataSource>(
|
|
131
|
+
`/organization/:org_id/knowledge-bases/${kbId}/data-source/${sourceId}`,
|
|
132
|
+
{ payload: { question: input.question, answer: input.answer, isManual: true } },
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async deleteDataSource(kbId: string, sourceId: string): Promise<void> {
|
|
137
|
+
await this.client.copilotDelete(
|
|
138
|
+
`/organization/:org_id/knowledge-bases/${kbId}/data-source/${sourceId}`,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async linkKB(agentId: string, kbIds: string[]): Promise<unknown> {
|
|
143
|
+
return this.client.copilotPost(
|
|
144
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/mappings`,
|
|
145
|
+
{ id_kb: kbIds },
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async unlinkKB(agentId: string, kbId: string): Promise<void> {
|
|
150
|
+
// Mappings response: [{ id: "kb_id", connectedBots: [{ id: "bot_id", id_mapping: "mapping_id" }] }]
|
|
151
|
+
const mappings = await this.client.copilotGet<Array<{
|
|
152
|
+
id: string;
|
|
153
|
+
connectedBots: Array<{ id: string; id_mapping: string }>;
|
|
154
|
+
}>>(
|
|
155
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/mappings`,
|
|
156
|
+
);
|
|
157
|
+
const kbEntry = mappings.find((m) => m.id === kbId);
|
|
158
|
+
if (!kbEntry) {
|
|
159
|
+
throw new Error(`No mapping found for KB ${kbId} on agent ${agentId}`);
|
|
160
|
+
}
|
|
161
|
+
const botMapping = kbEntry.connectedBots.find((b) => b.id === agentId);
|
|
162
|
+
if (!botMapping) {
|
|
163
|
+
throw new Error(`No mapping found for KB ${kbId} on agent ${agentId}`);
|
|
164
|
+
}
|
|
165
|
+
await this.client.copilotDelete(
|
|
166
|
+
`/organization/:org_id/ai-studio/bots/${agentId}/mappings/${botMapping.id_mapping}`,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async exportKB(kbId: string, format: string): Promise<unknown> {
|
|
171
|
+
return this.client.copilotPost(
|
|
172
|
+
`/organization/:org_id/knowledge-bases/${kbId}/export`,
|
|
173
|
+
{ type: format },
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async importKB(kbId: string, data: unknown): Promise<unknown> {
|
|
178
|
+
return this.client.copilotPost(
|
|
179
|
+
`/organization/:org_id/knowledge-bases/${kbId}/import`,
|
|
180
|
+
data,
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { IndemnClient } from './client.js';
|
|
2
|
+
import type { Rubric, CreateRubricInput } from './types.js';
|
|
3
|
+
|
|
4
|
+
export class RubricsSDK {
|
|
5
|
+
constructor(private client: IndemnClient) {}
|
|
6
|
+
|
|
7
|
+
async listRubrics(agentId?: string): Promise<Rubric[]> {
|
|
8
|
+
const query = agentId ? { agent_id: agentId } : undefined;
|
|
9
|
+
return this.client.evalsGet<Rubric[]>('/api/v1/rubrics', query);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getRubric(id: string): Promise<Rubric> {
|
|
13
|
+
return this.client.evalsGet<Rubric>(`/api/v1/rubrics/${id}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async createRubric(input: CreateRubricInput): Promise<Rubric> {
|
|
17
|
+
return this.client.evalsPost<Rubric>('/api/v1/rubrics', input);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async updateRubric(id: string, input: Partial<CreateRubricInput>): Promise<Rubric> {
|
|
21
|
+
return this.client.evalsPut<Rubric>(`/api/v1/rubrics/${id}`, input);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async deleteRubric(id: string): Promise<void> {
|
|
25
|
+
await this.client.evalsDelete(`/api/v1/rubrics/${id}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async listVersions(id: string): Promise<Rubric[]> {
|
|
29
|
+
return this.client.evalsGet<Rubric[]>(`/api/v1/rubrics/${id}/versions`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async getVersion(id: string, version: number): Promise<Rubric> {
|
|
33
|
+
return this.client.evalsGet<Rubric>(`/api/v1/rubrics/${id}/versions/${version}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { IndemnClient } from './client.js';
|
|
2
|
+
import type { TestSet, CreateTestSetInput } from './types.js';
|
|
3
|
+
|
|
4
|
+
export class TestSetsSDK {
|
|
5
|
+
constructor(private client: IndemnClient) {}
|
|
6
|
+
|
|
7
|
+
async listTestSets(agentId?: string): Promise<TestSet[]> {
|
|
8
|
+
const query = agentId ? { agent_id: agentId } : undefined;
|
|
9
|
+
return this.client.evalsGet<TestSet[]>('/api/v1/test-sets', query);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getTestSet(id: string): Promise<TestSet> {
|
|
13
|
+
return this.client.evalsGet<TestSet>(`/api/v1/test-sets/${id}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async createTestSet(input: CreateTestSetInput): Promise<TestSet> {
|
|
17
|
+
return this.client.evalsPost<TestSet>('/api/v1/test-sets', input);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async updateTestSet(id: string, input: Partial<CreateTestSetInput>): Promise<TestSet> {
|
|
21
|
+
return this.client.evalsPut<TestSet>(`/api/v1/test-sets/${id}`, input);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async deleteTestSet(id: string): Promise<void> {
|
|
25
|
+
await this.client.evalsDelete(`/api/v1/test-sets/${id}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async listVersions(id: string): Promise<TestSet[]> {
|
|
29
|
+
return this.client.evalsGet<TestSet[]>(`/api/v1/test-sets/${id}/versions`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async getVersion(id: string, version: number): Promise<TestSet> {
|
|
33
|
+
return this.client.evalsGet<TestSet>(`/api/v1/test-sets/${id}/versions/${version}`);
|
|
34
|
+
}
|
|
35
|
+
}
|