@lightdash-tools/client 0.5.0 → 0.7.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/README.md +2 -2
- package/dist/agentops/apply-agent-change.d.ts +3 -0
- package/dist/agentops/apply-agent-change.js +63 -0
- package/dist/agentops/apply-bundle-diff.d.ts +13 -0
- package/dist/agentops/apply-bundle-diff.js +44 -0
- package/dist/agentops/apply-bundle-diff.test.d.ts +1 -0
- package/dist/agentops/apply-bundle-diff.test.js +397 -0
- package/dist/agentops/apply-context.d.ts +14 -0
- package/dist/agentops/apply-context.js +6 -0
- package/dist/agentops/apply-evaluation-change.d.ts +3 -0
- package/dist/agentops/apply-evaluation-change.js +78 -0
- package/dist/agentops/fetch-bundle-state.d.ts +6 -0
- package/dist/agentops/fetch-bundle-state.js +20 -0
- package/dist/agentops/fetch-bundle-state.test.d.ts +1 -0
- package/dist/agentops/fetch-bundle-state.test.js +44 -0
- package/dist/agentops/index.d.ts +3 -0
- package/dist/agentops/index.js +9 -0
- package/dist/agentops/resolve-evaluation-run.d.ts +15 -0
- package/dist/agentops/resolve-evaluation-run.js +48 -0
- package/dist/api/v1/ai-agents/admin.d.ts +16 -0
- package/dist/api/v1/ai-agents/admin.js +29 -0
- package/dist/api/v1/ai-agents/agents.d.ts +18 -0
- package/dist/api/v1/ai-agents/agents.js +31 -0
- package/dist/api/v1/ai-agents/artifacts.d.ts +26 -0
- package/dist/api/v1/ai-agents/artifacts.js +41 -0
- package/dist/api/v1/ai-agents/artifacts.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/artifacts.test.js +69 -0
- package/dist/api/v1/ai-agents/discovery.d.ts +28 -0
- package/dist/api/v1/ai-agents/discovery.js +46 -0
- package/dist/api/v1/ai-agents/discovery.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/discovery.test.js +90 -0
- package/dist/api/v1/ai-agents/evaluations.d.ts +39 -0
- package/dist/api/v1/ai-agents/evaluations.js +70 -0
- package/dist/api/v1/ai-agents/facade.d.ts +79 -0
- package/dist/api/v1/ai-agents/facade.js +193 -0
- package/dist/api/v1/ai-agents/feedback.d.ts +10 -0
- package/dist/api/v1/ai-agents/feedback.js +15 -0
- package/dist/api/v1/ai-agents/feedback.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/feedback.test.js +23 -0
- package/dist/api/v1/ai-agents/index.d.ts +1 -0
- package/dist/api/v1/ai-agents/index.js +5 -0
- package/dist/api/v1/ai-agents/mcp-servers.d.ts +20 -0
- package/dist/api/v1/ai-agents/mcp-servers.js +35 -0
- package/dist/api/v1/ai-agents/mcp-servers.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/mcp-servers.test.js +66 -0
- package/dist/api/v1/ai-agents/request-options.d.ts +12 -0
- package/dist/api/v1/ai-agents/request-options.js +20 -0
- package/dist/api/v1/ai-agents/sql-approval.d.ts +10 -0
- package/dist/api/v1/ai-agents/sql-approval.js +15 -0
- package/dist/api/v1/ai-agents/sql-approval.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/sql-approval.test.js +25 -0
- package/dist/api/v1/ai-agents/threads.d.ts +56 -0
- package/dist/api/v1/ai-agents/threads.js +97 -0
- package/dist/api/v1/ai-agents/threads.test.d.ts +1 -0
- package/dist/api/v1/ai-agents/threads.test.js +39 -0
- package/dist/api/v1/ai-agents.test.js +172 -89
- package/dist/api/v1/analytics.d.ts +10 -0
- package/dist/api/v1/analytics.js +14 -0
- package/dist/api/v1/analytics.test.d.ts +4 -0
- package/dist/api/v1/analytics.test.js +27 -0
- package/dist/api/v1/charts.d.ts +5 -2
- package/dist/api/v1/charts.js +18 -30
- package/dist/api/v1/charts.test.js +19 -28
- package/dist/api/v1/dashboards.d.ts +11 -2
- package/dist/api/v1/dashboards.js +19 -14
- package/dist/api/v1/dashboards.test.js +54 -12
- package/dist/api/v1/explores.d.ts +4 -2
- package/dist/api/v1/explores.js +20 -29
- package/dist/api/v1/explores.test.js +31 -21
- package/dist/api/v1/groups.d.ts +1 -1
- package/dist/api/v1/groups.js +25 -51
- package/dist/api/v1/groups.test.js +15 -24
- package/dist/api/v1/metrics.d.ts +2 -2
- package/dist/api/v1/metrics.js +4 -17
- package/dist/api/v1/metrics.test.js +6 -15
- package/dist/api/v1/organizations.d.ts +1 -1
- package/dist/api/v1/organizations.js +2 -13
- package/dist/api/v1/organizations.test.js +3 -12
- package/dist/api/v1/project-access.d.ts +1 -1
- package/dist/api/v1/project-access.js +18 -45
- package/dist/api/v1/project-access.test.js +27 -36
- package/dist/api/v1/projects.d.ts +1 -1
- package/dist/api/v1/projects.js +6 -21
- package/dist/api/v1/projects.test.js +9 -18
- package/dist/api/v1/query.d.ts +5 -2
- package/dist/api/v1/query.js +8 -18
- package/dist/api/v1/query.test.js +6 -15
- package/dist/api/v1/schedulers.d.ts +2 -2
- package/dist/api/v1/schedulers.js +4 -17
- package/dist/api/v1/schedulers.test.js +6 -15
- package/dist/api/v1/spaces.d.ts +1 -1
- package/dist/api/v1/spaces.js +18 -45
- package/dist/api/v1/spaces.test.js +27 -36
- package/dist/api/v1/tags.d.ts +1 -1
- package/dist/api/v1/tags.js +4 -17
- package/dist/api/v1/tags.test.js +6 -15
- package/dist/api/v1/users.d.ts +3 -1
- package/dist/api/v1/users.js +22 -39
- package/dist/api/v1/users.test.js +44 -30
- package/dist/api/v1/validation.d.ts +5 -2
- package/dist/api/v1/validation.js +8 -18
- package/dist/api/v1/validation.test.js +6 -15
- package/dist/api/v2/content.d.ts +2 -2
- package/dist/api/v2/content.js +3 -14
- package/dist/api/v2/content.test.js +3 -12
- package/dist/api/v2/dashboards.d.ts +10 -0
- package/dist/api/v2/dashboards.js +14 -0
- package/dist/api/v2/dashboards.test.d.ts +4 -0
- package/dist/api/v2/dashboards.test.js +27 -0
- package/dist/api/v2/organization-roles.d.ts +1 -1
- package/dist/api/v2/organization-roles.js +21 -50
- package/dist/api/v2/organization-roles.test.js +33 -42
- package/dist/api/v2/project-role-assignments.d.ts +1 -1
- package/dist/api/v2/project-role-assignments.js +12 -33
- package/dist/api/v2/project-role-assignments.test.js +18 -27
- package/dist/api/v2/query.d.ts +1 -1
- package/dist/api/v2/query.js +10 -29
- package/dist/api/v2/query.test.js +15 -24
- package/dist/api/v2/validation.d.ts +28 -0
- package/dist/api/v2/validation.js +23 -0
- package/dist/client.d.ts +20 -14
- package/dist/client.js +22 -16
- package/dist/config.d.ts +35 -10
- package/dist/http/axios-client.d.ts +4 -4
- package/dist/http/http-client.d.ts +3 -3
- package/dist/http/http-client.js +19 -40
- package/dist/http/interceptors.d.ts +3 -3
- package/dist/http/interceptors.js +16 -3
- package/dist/http/rate-limiter.js +2 -13
- package/dist/http/rate-limiter.test.js +15 -24
- package/dist/index.d.ts +7 -2
- package/dist/index.js +12 -1
- package/dist/index.test.js +13 -5
- package/dist/pagination/fetch-all-pages.js +18 -29
- package/dist/pagination/fetch-all-pages.test.js +15 -24
- package/dist/types/api.d.ts +1 -1
- package/dist/utils/env.d.ts +11 -2
- package/dist/utils/env.js +41 -8
- package/dist/utils/env.test.js +14 -4
- package/dist/utils/logger.js +5 -4
- package/dist/utils/retry.js +17 -28
- package/dist/utils/retry.test.js +9 -18
- package/dist/utils/secret-string.test.d.ts +1 -0
- package/dist/utils/secret-string.test.js +25 -0
- package/package.json +12 -4
- package/src/agentops/apply-agent-change.ts +82 -0
- package/src/agentops/apply-bundle-diff.test.ts +453 -0
- package/src/agentops/apply-bundle-diff.ts +63 -0
- package/src/agentops/apply-context.ts +23 -0
- package/src/agentops/apply-evaluation-change.ts +125 -0
- package/src/agentops/fetch-bundle-state.test.ts +51 -0
- package/src/agentops/fetch-bundle-state.ts +33 -0
- package/src/agentops/index.ts +11 -0
- package/src/agentops/resolve-evaluation-run.ts +94 -0
- package/src/api/v1/ai-agents/admin.ts +41 -0
- package/src/api/v1/ai-agents/agents.ts +40 -0
- package/src/api/v1/ai-agents/artifacts.test.ts +84 -0
- package/src/api/v1/ai-agents/artifacts.ts +92 -0
- package/src/api/v1/ai-agents/discovery.test.ts +102 -0
- package/src/api/v1/ai-agents/discovery.ts +79 -0
- package/src/api/v1/ai-agents/evaluations.ts +152 -0
- package/src/api/v1/ai-agents/facade.ts +489 -0
- package/src/api/v1/ai-agents/feedback.test.ts +30 -0
- package/src/api/v1/ai-agents/feedback.ts +24 -0
- package/src/api/v1/ai-agents/index.ts +1 -0
- package/src/api/v1/ai-agents/mcp-servers.test.ts +81 -0
- package/src/api/v1/ai-agents/mcp-servers.ts +67 -0
- package/src/api/v1/ai-agents/request-options.ts +32 -0
- package/src/api/v1/ai-agents/sql-approval.test.ts +32 -0
- package/src/api/v1/ai-agents/sql-approval.ts +24 -0
- package/src/api/v1/ai-agents/threads.test.ts +55 -0
- package/src/api/v1/ai-agents/threads.ts +216 -0
- package/src/api/v1/ai-agents.test.ts +189 -13
- package/src/api/v1/analytics.test.ts +32 -0
- package/src/api/v1/analytics.ts +16 -0
- package/src/api/v1/charts.test.ts +8 -6
- package/src/api/v1/charts.ts +8 -4
- package/src/api/v1/dashboards.test.ts +57 -0
- package/src/api/v1/dashboards.ts +41 -2
- package/src/api/v1/explores.test.ts +22 -0
- package/src/api/v1/explores.ts +13 -2
- package/src/api/v1/groups.test.ts +2 -0
- package/src/api/v1/groups.ts +9 -7
- package/src/api/v1/metrics.test.ts +2 -0
- package/src/api/v1/metrics.ts +3 -2
- package/src/api/v1/organizations.test.ts +2 -0
- package/src/api/v1/organizations.ts +2 -1
- package/src/api/v1/project-access.test.ts +3 -1
- package/src/api/v1/project-access.ts +2 -1
- package/src/api/v1/projects.test.ts +2 -0
- package/src/api/v1/projects.ts +2 -1
- package/src/api/v1/query.test.ts +2 -0
- package/src/api/v1/query.ts +6 -2
- package/src/api/v1/schedulers.test.ts +2 -0
- package/src/api/v1/schedulers.ts +3 -2
- package/src/api/v1/spaces.test.ts +2 -0
- package/src/api/v1/spaces.ts +2 -1
- package/src/api/v1/tags.test.ts +2 -0
- package/src/api/v1/tags.ts +2 -1
- package/src/api/v1/users.test.ts +26 -0
- package/src/api/v1/users.ts +8 -2
- package/src/api/v1/validation.test.ts +2 -0
- package/src/api/v1/validation.ts +6 -2
- package/src/api/v2/content.test.ts +2 -0
- package/src/api/v2/content.ts +3 -2
- package/src/api/v2/dashboards.test.ts +32 -0
- package/src/api/v2/dashboards.ts +18 -0
- package/src/api/v2/organization-roles.test.ts +2 -0
- package/src/api/v2/organization-roles.ts +2 -1
- package/src/api/v2/project-role-assignments.test.ts +2 -0
- package/src/api/v2/project-role-assignments.ts +2 -1
- package/src/api/v2/query.test.ts +2 -0
- package/src/api/v2/query.ts +2 -1
- package/src/api/v2/validation.ts +48 -0
- package/src/client.test.ts +1 -0
- package/src/client.ts +27 -17
- package/src/config.ts +38 -10
- package/src/errors.test.ts +1 -0
- package/src/http/axios-client.ts +8 -5
- package/src/http/http-client.ts +8 -6
- package/src/http/interceptors.ts +23 -10
- package/src/http/rate-limiter.test.ts +1 -0
- package/src/http/rate-limiter.ts +3 -1
- package/src/index.test.ts +16 -7
- package/src/index.ts +16 -1
- package/src/pagination/fetch-all-pages.test.ts +2 -0
- package/src/types/api.ts +1 -1
- package/src/utils/env.test.ts +16 -4
- package/src/utils/env.ts +61 -10
- package/src/utils/logger.ts +6 -4
- package/src/utils/retry.test.ts +1 -0
- package/src/utils/retry.ts +2 -1
- package/src/utils/secret-string.test.ts +27 -0
- package/tsconfig.json +4 -2
- package/dist/api/v1/ai-agents.d.ts +0 -63
- package/dist/api/v1/ai-agents.js +0 -173
- package/src/api/v1/ai-agents.ts +0 -252
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project-scoped AI agent evaluation client.
|
|
3
|
+
* Endpoints: /api/v1/projects/{projectUuid}/aiAgents/{agentUuid}/evaluations/...
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { fetchAllPages } from '../../../pagination/fetch-all-pages';
|
|
7
|
+
import { BaseApiClient } from '../../base-client';
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
AiAgentEvaluation,
|
|
11
|
+
AiAgentEvaluationRun,
|
|
12
|
+
AiAgentEvaluationRunSummary,
|
|
13
|
+
AiAgentEvaluationRunsListResponse,
|
|
14
|
+
AiAgentEvaluationSummary,
|
|
15
|
+
AppendEvaluationBody,
|
|
16
|
+
CreateEvaluationBody,
|
|
17
|
+
CreateEvaluationResult,
|
|
18
|
+
UpdateEvaluationBody,
|
|
19
|
+
} from '@lightdash-tools/common';
|
|
20
|
+
|
|
21
|
+
export class AiAgentsEvaluationsClient extends BaseApiClient {
|
|
22
|
+
/** List all evaluations for an agent (GET …/{agentUuid}/evaluations). */
|
|
23
|
+
async listEvaluations(
|
|
24
|
+
projectUuid: string,
|
|
25
|
+
agentUuid: string,
|
|
26
|
+
): Promise<AiAgentEvaluationSummary[]> {
|
|
27
|
+
return this.http.get<AiAgentEvaluationSummary[]>(
|
|
28
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations`,
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Create a new evaluation (POST …/{agentUuid}/evaluations). */
|
|
33
|
+
async createEvaluation(
|
|
34
|
+
projectUuid: string,
|
|
35
|
+
agentUuid: string,
|
|
36
|
+
body: CreateEvaluationBody,
|
|
37
|
+
): Promise<CreateEvaluationResult> {
|
|
38
|
+
return this.http.post<CreateEvaluationResult>(
|
|
39
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations`,
|
|
40
|
+
body,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Get a full evaluation with prompts (GET …/evaluations/{evalUuid}). */
|
|
45
|
+
async getEvaluation(
|
|
46
|
+
projectUuid: string,
|
|
47
|
+
agentUuid: string,
|
|
48
|
+
evalUuid: string,
|
|
49
|
+
): Promise<AiAgentEvaluation> {
|
|
50
|
+
return this.http.get<AiAgentEvaluation>(
|
|
51
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}`,
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Update an evaluation's title, description, or prompts (PATCH …/evaluations/{evalUuid}). */
|
|
56
|
+
async updateEvaluation(
|
|
57
|
+
projectUuid: string,
|
|
58
|
+
agentUuid: string,
|
|
59
|
+
evalUuid: string,
|
|
60
|
+
body: UpdateEvaluationBody,
|
|
61
|
+
): Promise<AiAgentEvaluation> {
|
|
62
|
+
return this.http.patch<AiAgentEvaluation>(
|
|
63
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}`,
|
|
64
|
+
body,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Append additional prompts to an existing evaluation (POST …/evaluations/{evalUuid}/append). */
|
|
69
|
+
async appendToEvaluation(
|
|
70
|
+
projectUuid: string,
|
|
71
|
+
agentUuid: string,
|
|
72
|
+
evalUuid: string,
|
|
73
|
+
body: AppendEvaluationBody,
|
|
74
|
+
): Promise<AiAgentEvaluation> {
|
|
75
|
+
return this.http.post<AiAgentEvaluation>(
|
|
76
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}/append`,
|
|
77
|
+
body,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Delete an evaluation (DELETE …/evaluations/{evalUuid}). */
|
|
82
|
+
async deleteEvaluation(projectUuid: string, agentUuid: string, evalUuid: string): Promise<void> {
|
|
83
|
+
await this.http.delete(
|
|
84
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Trigger a new evaluation run (POST …/evaluations/{evalUuid}/run).
|
|
90
|
+
* Returns a run summary with the new runUuid and initial status.
|
|
91
|
+
*/
|
|
92
|
+
async runEvaluation(
|
|
93
|
+
projectUuid: string,
|
|
94
|
+
agentUuid: string,
|
|
95
|
+
evalUuid: string,
|
|
96
|
+
): Promise<AiAgentEvaluationRunSummary> {
|
|
97
|
+
return this.http.post<AiAgentEvaluationRunSummary>(
|
|
98
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}/run`,
|
|
99
|
+
{},
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** List runs for an evaluation with pagination (GET …/evaluations/{evalUuid}/runs). */
|
|
104
|
+
async listEvaluationRuns(
|
|
105
|
+
projectUuid: string,
|
|
106
|
+
agentUuid: string,
|
|
107
|
+
evalUuid: string,
|
|
108
|
+
params?: { page?: number; pageSize?: number },
|
|
109
|
+
): Promise<AiAgentEvaluationRunsListResponse> {
|
|
110
|
+
return this.http.get<AiAgentEvaluationRunsListResponse>(
|
|
111
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}/runs`,
|
|
112
|
+
{ params },
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* List all runs for an evaluation, returning only the runs array.
|
|
118
|
+
* Convenience wrapper around {@link listEvaluationRuns} for backward compatibility.
|
|
119
|
+
*/
|
|
120
|
+
async listAllEvaluationRuns(
|
|
121
|
+
projectUuid: string,
|
|
122
|
+
agentUuid: string,
|
|
123
|
+
evalUuid: string,
|
|
124
|
+
options?: { pageSize?: number },
|
|
125
|
+
): Promise<AiAgentEvaluationRunSummary[]> {
|
|
126
|
+
return fetchAllPages<AiAgentEvaluationRunSummary>({
|
|
127
|
+
fetchPage: async (page, pageSize) => {
|
|
128
|
+
const response = await this.listEvaluationRuns(projectUuid, agentUuid, evalUuid, {
|
|
129
|
+
page,
|
|
130
|
+
pageSize,
|
|
131
|
+
});
|
|
132
|
+
return {
|
|
133
|
+
data: response.data.runs,
|
|
134
|
+
pagination: response.pagination ? { ...response.pagination, page, pageSize } : undefined,
|
|
135
|
+
};
|
|
136
|
+
},
|
|
137
|
+
pageSize: options?.pageSize,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Get detailed results of a specific run (GET …/evaluations/{evalUuid}/runs/{runUuid}). */
|
|
142
|
+
async getEvaluationRunResults(
|
|
143
|
+
projectUuid: string,
|
|
144
|
+
agentUuid: string,
|
|
145
|
+
evalUuid: string,
|
|
146
|
+
runUuid: string,
|
|
147
|
+
): Promise<AiAgentEvaluationRun> {
|
|
148
|
+
return this.http.get<AiAgentEvaluationRun>(
|
|
149
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/evaluations/${evalUuid}/runs/${runUuid}`,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Facade for the AI agents API client.
|
|
3
|
+
* Delegates to domain-specific clients while preserving the monolithic public API.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseApiClient } from '../../base-client';
|
|
7
|
+
|
|
8
|
+
import { AiAgentsAdminClient } from './admin';
|
|
9
|
+
import { AiAgentsProjectClient } from './agents';
|
|
10
|
+
import { AiAgentsArtifactsClient } from './artifacts';
|
|
11
|
+
import { AiAgentsDiscoveryClient } from './discovery';
|
|
12
|
+
import { AiAgentsEvaluationsClient } from './evaluations';
|
|
13
|
+
import { AiAgentsFeedbackClient } from './feedback';
|
|
14
|
+
import { AiAgentsMcpServersClient } from './mcp-servers';
|
|
15
|
+
import { AiAgentsSqlApprovalClient } from './sql-approval';
|
|
16
|
+
import { AiAgentsThreadsClient, type StartConversationThreadBody } from './threads';
|
|
17
|
+
|
|
18
|
+
import type { RequestOptions } from './request-options';
|
|
19
|
+
import type { HttpClient } from '../../../http/http-client';
|
|
20
|
+
import type {
|
|
21
|
+
AgentSuggestions,
|
|
22
|
+
AiAgent,
|
|
23
|
+
AiAgentEvaluation,
|
|
24
|
+
AiAgentEvaluationRun,
|
|
25
|
+
AiAgentEvaluationRunSummary,
|
|
26
|
+
AiAgentEvaluationRunsListResponse,
|
|
27
|
+
AiAgentEvaluationSummary,
|
|
28
|
+
AiAgentExploreAccessSummary,
|
|
29
|
+
AiAgentMcpServerTool,
|
|
30
|
+
AiAgentsAdminThreadsResult,
|
|
31
|
+
AiAgentSummary,
|
|
32
|
+
AiAgentThread,
|
|
33
|
+
AiAgentThreadMessageVizQuery,
|
|
34
|
+
AiAgentThreadSummary,
|
|
35
|
+
AiAgentUserPreferences,
|
|
36
|
+
AiAgentVerifiedArtifactsListResult,
|
|
37
|
+
AiAgentVerifiedQuestion,
|
|
38
|
+
AiArtifact,
|
|
39
|
+
AiMcpServer,
|
|
40
|
+
AiMcpServerTool,
|
|
41
|
+
AiModelOption,
|
|
42
|
+
AppendEvaluationBody,
|
|
43
|
+
CloneThreadBody,
|
|
44
|
+
CreateAgentThreadBody,
|
|
45
|
+
CreateAgentThreadMessageResult,
|
|
46
|
+
CreateAiAgent,
|
|
47
|
+
CreateEvaluationBody,
|
|
48
|
+
CreateEvaluationResult,
|
|
49
|
+
CreateProjectMcpServerBody,
|
|
50
|
+
ExploreAccessSummaryBody,
|
|
51
|
+
GenerateAgentThreadBody,
|
|
52
|
+
GenerateAgentThreadResult,
|
|
53
|
+
GenerateThreadTitleResult,
|
|
54
|
+
GetAdminThreadsParams,
|
|
55
|
+
GetAgentSuggestionsParams,
|
|
56
|
+
GetAiOrganizationSettingsResult,
|
|
57
|
+
ListVerifiedArtifactsParams,
|
|
58
|
+
ReadinessScore,
|
|
59
|
+
SubmitSqlApprovalBody,
|
|
60
|
+
SubmitSqlApprovalResult,
|
|
61
|
+
UpdateAiAgent,
|
|
62
|
+
UpdateAiOrganizationSettings,
|
|
63
|
+
UpdateAiOrganizationSettingsResult,
|
|
64
|
+
UpdateAgentMcpServerToolsBody,
|
|
65
|
+
UpdateEvaluationBody,
|
|
66
|
+
UpdateMessageFeedbackBody,
|
|
67
|
+
} from '@lightdash-tools/common';
|
|
68
|
+
|
|
69
|
+
export class AiAgentsClient extends BaseApiClient {
|
|
70
|
+
private readonly admin: AiAgentsAdminClient;
|
|
71
|
+
private readonly agents: AiAgentsProjectClient;
|
|
72
|
+
private readonly artifacts: AiAgentsArtifactsClient;
|
|
73
|
+
private readonly discovery: AiAgentsDiscoveryClient;
|
|
74
|
+
private readonly threads: AiAgentsThreadsClient;
|
|
75
|
+
private readonly evaluations: AiAgentsEvaluationsClient;
|
|
76
|
+
private readonly feedback: AiAgentsFeedbackClient;
|
|
77
|
+
private readonly mcpServers: AiAgentsMcpServersClient;
|
|
78
|
+
private readonly sqlApproval: AiAgentsSqlApprovalClient;
|
|
79
|
+
|
|
80
|
+
constructor(http: HttpClient) {
|
|
81
|
+
super(http);
|
|
82
|
+
this.admin = new AiAgentsAdminClient(http);
|
|
83
|
+
this.agents = new AiAgentsProjectClient(http);
|
|
84
|
+
this.artifacts = new AiAgentsArtifactsClient(http);
|
|
85
|
+
this.discovery = new AiAgentsDiscoveryClient(http);
|
|
86
|
+
this.threads = new AiAgentsThreadsClient(http);
|
|
87
|
+
this.evaluations = new AiAgentsEvaluationsClient(http);
|
|
88
|
+
this.feedback = new AiAgentsFeedbackClient(http);
|
|
89
|
+
this.mcpServers = new AiAgentsMcpServersClient(http);
|
|
90
|
+
this.sqlApproval = new AiAgentsSqlApprovalClient(http);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ─── Admin ───────────────────────────────────────────────────────────────────
|
|
94
|
+
|
|
95
|
+
getAdminThreads(params?: GetAdminThreadsParams): Promise<AiAgentsAdminThreadsResult> {
|
|
96
|
+
return this.admin.getAdminThreads(params);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
listAdminAgents(): Promise<AiAgentSummary[]> {
|
|
100
|
+
return this.admin.listAdminAgents();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
getAiOrganizationSettings(): Promise<GetAiOrganizationSettingsResult> {
|
|
104
|
+
return this.admin.getAiOrganizationSettings();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
updateAiOrganizationSettings(
|
|
108
|
+
body: UpdateAiOrganizationSettings,
|
|
109
|
+
): Promise<UpdateAiOrganizationSettingsResult> {
|
|
110
|
+
return this.admin.updateAiOrganizationSettings(body);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ─── Project-scoped: agent CRUD ──────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
listAgents(projectUuid: string): Promise<AiAgentSummary[]> {
|
|
116
|
+
return this.agents.listAgents(projectUuid);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
getAgent(projectUuid: string, agentUuid: string): Promise<AiAgent> {
|
|
120
|
+
return this.agents.getAgent(projectUuid, agentUuid);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
createAgent(projectUuid: string, body: CreateAiAgent): Promise<AiAgent> {
|
|
124
|
+
return this.agents.createAgent(projectUuid, body);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
updateAgent(projectUuid: string, agentUuid: string, body: UpdateAiAgent): Promise<AiAgent> {
|
|
128
|
+
return this.agents.updateAgent(projectUuid, agentUuid, body);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
deleteAgent(projectUuid: string, agentUuid: string): Promise<void> {
|
|
132
|
+
return this.agents.deleteAgent(projectUuid, agentUuid);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ─── Discovery & preferences ─────────────────────────────────────────────────
|
|
136
|
+
|
|
137
|
+
getAgentModelOptions(projectUuid: string, agentUuid: string): Promise<AiModelOption[]> {
|
|
138
|
+
return this.discovery.getAgentModelOptions(projectUuid, agentUuid);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
getAgentSuggestions(
|
|
142
|
+
projectUuid: string,
|
|
143
|
+
agentUuid: string,
|
|
144
|
+
params?: GetAgentSuggestionsParams,
|
|
145
|
+
): Promise<AgentSuggestions> {
|
|
146
|
+
return this.discovery.getAgentSuggestions(projectUuid, agentUuid, params);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
evaluateAgentReadiness(projectUuid: string, agentUuid: string): Promise<ReadinessScore> {
|
|
150
|
+
return this.discovery.evaluateAgentReadiness(projectUuid, agentUuid);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
getExploreAccessSummary(
|
|
154
|
+
projectUuid: string,
|
|
155
|
+
agentUuid: string,
|
|
156
|
+
body?: ExploreAccessSummaryBody,
|
|
157
|
+
): Promise<AiAgentExploreAccessSummary[]> {
|
|
158
|
+
return this.discovery.getExploreAccessSummary(projectUuid, agentUuid, body);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
getUserAgentPreferences(projectUuid: string): Promise<AiAgentUserPreferences | null> {
|
|
162
|
+
return this.discovery.getUserAgentPreferences(projectUuid);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
setUserAgentPreferences(projectUuid: string, body: AiAgentUserPreferences): Promise<void> {
|
|
166
|
+
return this.discovery.setUserAgentPreferences(projectUuid, body);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
deleteUserAgentPreferences(projectUuid: string): Promise<void> {
|
|
170
|
+
return this.discovery.deleteUserAgentPreferences(projectUuid);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ─── Project-scoped: threads ─────────────────────────────────────────────────
|
|
174
|
+
|
|
175
|
+
listAgentThreads(projectUuid: string, agentUuid: string): Promise<AiAgentThreadSummary[]> {
|
|
176
|
+
return this.threads.listAgentThreads(projectUuid, agentUuid);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
createAgentThread(
|
|
180
|
+
projectUuid: string,
|
|
181
|
+
agentUuid: string,
|
|
182
|
+
body?: CreateAgentThreadBody,
|
|
183
|
+
options?: RequestOptions,
|
|
184
|
+
): Promise<AiAgentThreadSummary> {
|
|
185
|
+
return this.threads.createAgentThread(projectUuid, agentUuid, body, options);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
getAgentThread(
|
|
189
|
+
projectUuid: string,
|
|
190
|
+
agentUuid: string,
|
|
191
|
+
threadUuid: string,
|
|
192
|
+
options?: RequestOptions,
|
|
193
|
+
): Promise<AiAgentThread> {
|
|
194
|
+
return this.threads.getAgentThread(projectUuid, agentUuid, threadUuid, options);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
createAgentThreadMessage(
|
|
198
|
+
projectUuid: string,
|
|
199
|
+
agentUuid: string,
|
|
200
|
+
threadUuid: string,
|
|
201
|
+
body: GenerateAgentThreadBody,
|
|
202
|
+
options?: RequestOptions,
|
|
203
|
+
): Promise<CreateAgentThreadMessageResult> {
|
|
204
|
+
return this.threads.createAgentThreadMessage(projectUuid, agentUuid, threadUuid, body, options);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
generateAgentThreadResponse(
|
|
208
|
+
projectUuid: string,
|
|
209
|
+
agentUuid: string,
|
|
210
|
+
threadUuid: string,
|
|
211
|
+
options?: RequestOptions,
|
|
212
|
+
): Promise<GenerateAgentThreadResult>;
|
|
213
|
+
|
|
214
|
+
generateAgentThreadResponse(
|
|
215
|
+
projectUuid: string,
|
|
216
|
+
agentUuid: string,
|
|
217
|
+
threadUuid: string,
|
|
218
|
+
body: GenerateAgentThreadBody,
|
|
219
|
+
options?: RequestOptions,
|
|
220
|
+
): Promise<GenerateAgentThreadResult>;
|
|
221
|
+
|
|
222
|
+
generateAgentThreadResponse(
|
|
223
|
+
projectUuid: string,
|
|
224
|
+
agentUuid: string,
|
|
225
|
+
threadUuid: string,
|
|
226
|
+
bodyOrOptions?: GenerateAgentThreadBody | RequestOptions,
|
|
227
|
+
maybeOptions?: RequestOptions,
|
|
228
|
+
): Promise<GenerateAgentThreadResult> {
|
|
229
|
+
if (
|
|
230
|
+
bodyOrOptions !== undefined &&
|
|
231
|
+
typeof bodyOrOptions === 'object' &&
|
|
232
|
+
'prompt' in bodyOrOptions
|
|
233
|
+
) {
|
|
234
|
+
return this.threads.generateAgentThreadResponse(
|
|
235
|
+
projectUuid,
|
|
236
|
+
agentUuid,
|
|
237
|
+
threadUuid,
|
|
238
|
+
bodyOrOptions,
|
|
239
|
+
maybeOptions,
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return this.threads.generateAgentThreadResponse(
|
|
244
|
+
projectUuid,
|
|
245
|
+
agentUuid,
|
|
246
|
+
threadUuid,
|
|
247
|
+
bodyOrOptions as RequestOptions | undefined,
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
startConversation(
|
|
252
|
+
projectUuid: string,
|
|
253
|
+
agentUuid: string,
|
|
254
|
+
body: GenerateAgentThreadBody,
|
|
255
|
+
options?: RequestOptions & { threadBody?: StartConversationThreadBody },
|
|
256
|
+
): Promise<{ thread: AiAgentThreadSummary; result: GenerateAgentThreadResult }> {
|
|
257
|
+
return this.threads.startConversation(projectUuid, agentUuid, body, options);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
continueConversation(
|
|
261
|
+
projectUuid: string,
|
|
262
|
+
agentUuid: string,
|
|
263
|
+
threadUuid: string,
|
|
264
|
+
body: GenerateAgentThreadBody,
|
|
265
|
+
options?: RequestOptions,
|
|
266
|
+
): Promise<GenerateAgentThreadResult> {
|
|
267
|
+
return this.threads.continueConversation(projectUuid, agentUuid, threadUuid, body, options);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
generateThreadTitle(
|
|
271
|
+
projectUuid: string,
|
|
272
|
+
agentUuid: string,
|
|
273
|
+
threadUuid: string,
|
|
274
|
+
options?: RequestOptions,
|
|
275
|
+
): Promise<GenerateThreadTitleResult> {
|
|
276
|
+
return this.threads.generateThreadTitle(projectUuid, agentUuid, threadUuid, options);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
cloneThread(
|
|
280
|
+
projectUuid: string,
|
|
281
|
+
agentUuid: string,
|
|
282
|
+
threadUuid: string,
|
|
283
|
+
body?: CloneThreadBody,
|
|
284
|
+
): Promise<AiAgentThreadSummary> {
|
|
285
|
+
return this.threads.cloneThread(projectUuid, agentUuid, threadUuid, body);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
// ─── Artifacts ───────────────────────────────────────────────────────────────
|
|
289
|
+
|
|
290
|
+
listVerifiedArtifacts(
|
|
291
|
+
projectUuid: string,
|
|
292
|
+
agentUuid: string,
|
|
293
|
+
params?: ListVerifiedArtifactsParams,
|
|
294
|
+
): Promise<AiAgentVerifiedArtifactsListResult> {
|
|
295
|
+
return this.artifacts.listVerifiedArtifacts(projectUuid, agentUuid, params);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
listVerifiedQuestions(
|
|
299
|
+
projectUuid: string,
|
|
300
|
+
agentUuid: string,
|
|
301
|
+
): Promise<AiAgentVerifiedQuestion[]> {
|
|
302
|
+
return this.artifacts.listVerifiedQuestions(projectUuid, agentUuid);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
getArtifact(projectUuid: string, agentUuid: string, artifactUuid: string): Promise<AiArtifact> {
|
|
306
|
+
return this.artifacts.getArtifact(projectUuid, agentUuid, artifactUuid);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
getArtifactVersion(
|
|
310
|
+
projectUuid: string,
|
|
311
|
+
agentUuid: string,
|
|
312
|
+
artifactUuid: string,
|
|
313
|
+
versionUuid: string,
|
|
314
|
+
): Promise<AiArtifact> {
|
|
315
|
+
return this.artifacts.getArtifactVersion(projectUuid, agentUuid, artifactUuid, versionUuid);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
getArtifactVersionVizQuery(
|
|
319
|
+
projectUuid: string,
|
|
320
|
+
agentUuid: string,
|
|
321
|
+
artifactUuid: string,
|
|
322
|
+
versionUuid: string,
|
|
323
|
+
): Promise<AiAgentThreadMessageVizQuery> {
|
|
324
|
+
return this.artifacts.getArtifactVersionVizQuery(
|
|
325
|
+
projectUuid,
|
|
326
|
+
agentUuid,
|
|
327
|
+
artifactUuid,
|
|
328
|
+
versionUuid,
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
getDashboardArtifactChartVizQuery(
|
|
333
|
+
projectUuid: string,
|
|
334
|
+
agentUuid: string,
|
|
335
|
+
artifactUuid: string,
|
|
336
|
+
versionUuid: string,
|
|
337
|
+
chartIndex: number,
|
|
338
|
+
): Promise<AiAgentThreadMessageVizQuery> {
|
|
339
|
+
return this.artifacts.getDashboardArtifactChartVizQuery(
|
|
340
|
+
projectUuid,
|
|
341
|
+
agentUuid,
|
|
342
|
+
artifactUuid,
|
|
343
|
+
versionUuid,
|
|
344
|
+
chartIndex,
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// ─── Message feedback ────────────────────────────────────────────────────────
|
|
349
|
+
|
|
350
|
+
updateMessageFeedback(
|
|
351
|
+
projectUuid: string,
|
|
352
|
+
agentUuid: string,
|
|
353
|
+
threadUuid: string,
|
|
354
|
+
messageUuid: string,
|
|
355
|
+
body: UpdateMessageFeedbackBody,
|
|
356
|
+
): Promise<void> {
|
|
357
|
+
return this.feedback.updateMessageFeedback(
|
|
358
|
+
projectUuid,
|
|
359
|
+
agentUuid,
|
|
360
|
+
threadUuid,
|
|
361
|
+
messageUuid,
|
|
362
|
+
body,
|
|
363
|
+
);
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// ─── MCP servers (EE-guarded upstream) ───────────────────────────────────────
|
|
367
|
+
|
|
368
|
+
listProjectMcpServers(projectUuid: string): Promise<AiMcpServer[]> {
|
|
369
|
+
return this.mcpServers.listProjectMcpServers(projectUuid);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
createProjectMcpServer(
|
|
373
|
+
projectUuid: string,
|
|
374
|
+
body: CreateProjectMcpServerBody,
|
|
375
|
+
): Promise<AiMcpServer> {
|
|
376
|
+
return this.mcpServers.createProjectMcpServer(projectUuid, body);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
listMcpServerTools(projectUuid: string, mcpServerUuid: string): Promise<AiMcpServerTool[]> {
|
|
380
|
+
return this.mcpServers.listMcpServerTools(projectUuid, mcpServerUuid);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
refreshMcpServerTools(projectUuid: string, mcpServerUuid: string): Promise<AiMcpServerTool[]> {
|
|
384
|
+
return this.mcpServers.refreshMcpServerTools(projectUuid, mcpServerUuid);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
listAgentMcpServers(projectUuid: string, agentUuid: string): Promise<AiMcpServer[]> {
|
|
388
|
+
return this.mcpServers.listAgentMcpServers(projectUuid, agentUuid);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
updateAgentMcpServerTools(
|
|
392
|
+
projectUuid: string,
|
|
393
|
+
agentUuid: string,
|
|
394
|
+
mcpServerUuid: string,
|
|
395
|
+
body: UpdateAgentMcpServerToolsBody,
|
|
396
|
+
): Promise<AiAgentMcpServerTool[]> {
|
|
397
|
+
return this.mcpServers.updateAgentMcpServerTools(projectUuid, agentUuid, mcpServerUuid, body);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// ─── SQL approval ────────────────────────────────────────────────────────────
|
|
401
|
+
|
|
402
|
+
submitSqlApproval(
|
|
403
|
+
projectUuid: string,
|
|
404
|
+
agentUuid: string,
|
|
405
|
+
threadUuid: string,
|
|
406
|
+
toolCallId: string,
|
|
407
|
+
body: SubmitSqlApprovalBody,
|
|
408
|
+
): Promise<SubmitSqlApprovalResult> {
|
|
409
|
+
return this.sqlApproval.submitSqlApproval(projectUuid, agentUuid, threadUuid, toolCallId, body);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// ─── Project-scoped: evaluations ─────────────────────────────────────────────
|
|
413
|
+
|
|
414
|
+
listEvaluations(projectUuid: string, agentUuid: string): Promise<AiAgentEvaluationSummary[]> {
|
|
415
|
+
return this.evaluations.listEvaluations(projectUuid, agentUuid);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
createEvaluation(
|
|
419
|
+
projectUuid: string,
|
|
420
|
+
agentUuid: string,
|
|
421
|
+
body: CreateEvaluationBody,
|
|
422
|
+
): Promise<CreateEvaluationResult> {
|
|
423
|
+
return this.evaluations.createEvaluation(projectUuid, agentUuid, body);
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
getEvaluation(
|
|
427
|
+
projectUuid: string,
|
|
428
|
+
agentUuid: string,
|
|
429
|
+
evalUuid: string,
|
|
430
|
+
): Promise<AiAgentEvaluation> {
|
|
431
|
+
return this.evaluations.getEvaluation(projectUuid, agentUuid, evalUuid);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
updateEvaluation(
|
|
435
|
+
projectUuid: string,
|
|
436
|
+
agentUuid: string,
|
|
437
|
+
evalUuid: string,
|
|
438
|
+
body: UpdateEvaluationBody,
|
|
439
|
+
): Promise<AiAgentEvaluation> {
|
|
440
|
+
return this.evaluations.updateEvaluation(projectUuid, agentUuid, evalUuid, body);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
appendToEvaluation(
|
|
444
|
+
projectUuid: string,
|
|
445
|
+
agentUuid: string,
|
|
446
|
+
evalUuid: string,
|
|
447
|
+
body: AppendEvaluationBody,
|
|
448
|
+
): Promise<AiAgentEvaluation> {
|
|
449
|
+
return this.evaluations.appendToEvaluation(projectUuid, agentUuid, evalUuid, body);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
deleteEvaluation(projectUuid: string, agentUuid: string, evalUuid: string): Promise<void> {
|
|
453
|
+
return this.evaluations.deleteEvaluation(projectUuid, agentUuid, evalUuid);
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
runEvaluation(
|
|
457
|
+
projectUuid: string,
|
|
458
|
+
agentUuid: string,
|
|
459
|
+
evalUuid: string,
|
|
460
|
+
): Promise<AiAgentEvaluationRunSummary> {
|
|
461
|
+
return this.evaluations.runEvaluation(projectUuid, agentUuid, evalUuid);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
listEvaluationRuns(
|
|
465
|
+
projectUuid: string,
|
|
466
|
+
agentUuid: string,
|
|
467
|
+
evalUuid: string,
|
|
468
|
+
params?: { page?: number; pageSize?: number },
|
|
469
|
+
): Promise<AiAgentEvaluationRunsListResponse> {
|
|
470
|
+
return this.evaluations.listEvaluationRuns(projectUuid, agentUuid, evalUuid, params);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
listAllEvaluationRuns(
|
|
474
|
+
projectUuid: string,
|
|
475
|
+
agentUuid: string,
|
|
476
|
+
evalUuid: string,
|
|
477
|
+
): Promise<AiAgentEvaluationRunSummary[]> {
|
|
478
|
+
return this.evaluations.listAllEvaluationRuns(projectUuid, agentUuid, evalUuid);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
getEvaluationRunResults(
|
|
482
|
+
projectUuid: string,
|
|
483
|
+
agentUuid: string,
|
|
484
|
+
evalUuid: string,
|
|
485
|
+
runUuid: string,
|
|
486
|
+
): Promise<AiAgentEvaluationRun> {
|
|
487
|
+
return this.evaluations.getEvaluationRunResults(projectUuid, agentUuid, evalUuid, runUuid);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { AiAgentsFeedbackClient } from './feedback';
|
|
4
|
+
|
|
5
|
+
import type { HttpClient } from '../../../http/http-client';
|
|
6
|
+
|
|
7
|
+
describe('AiAgentsFeedbackClient', () => {
|
|
8
|
+
let mockHttp: HttpClient;
|
|
9
|
+
|
|
10
|
+
beforeEach(() => {
|
|
11
|
+
mockHttp = {
|
|
12
|
+
get: vi.fn(),
|
|
13
|
+
post: vi.fn(),
|
|
14
|
+
put: vi.fn(),
|
|
15
|
+
patch: vi.fn(),
|
|
16
|
+
delete: vi.fn(),
|
|
17
|
+
} as unknown as HttpClient;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('updateMessageFeedback should call PATCH …/messages/{messageUuid}/feedback', async () => {
|
|
21
|
+
const client = new AiAgentsFeedbackClient(mockHttp);
|
|
22
|
+
const body = { humanScore: 5, humanFeedback: 'Great answer' };
|
|
23
|
+
vi.mocked(mockHttp.patch).mockResolvedValue(undefined);
|
|
24
|
+
await client.updateMessageFeedback('proj1', 'a1', 't1', 'm1', body);
|
|
25
|
+
expect(mockHttp.patch).toHaveBeenCalledWith(
|
|
26
|
+
'/projects/proj1/aiAgents/a1/threads/t1/messages/m1/feedback',
|
|
27
|
+
body,
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI agent message feedback client.
|
|
3
|
+
* Endpoints: …/threads/{threadUuid}/messages/{messageUuid}/feedback
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { BaseApiClient } from '../../base-client';
|
|
7
|
+
|
|
8
|
+
import type { UpdateMessageFeedbackBody } from '@lightdash-tools/common';
|
|
9
|
+
|
|
10
|
+
export class AiAgentsFeedbackClient extends BaseApiClient {
|
|
11
|
+
/** Update human feedback on an assistant message (PATCH …/messages/{messageUuid}/feedback). */
|
|
12
|
+
async updateMessageFeedback(
|
|
13
|
+
projectUuid: string,
|
|
14
|
+
agentUuid: string,
|
|
15
|
+
threadUuid: string,
|
|
16
|
+
messageUuid: string,
|
|
17
|
+
body: UpdateMessageFeedbackBody,
|
|
18
|
+
): Promise<void> {
|
|
19
|
+
await this.http.patch<void>(
|
|
20
|
+
`/projects/${projectUuid}/aiAgents/${agentUuid}/threads/${threadUuid}/messages/${messageUuid}/feedback`,
|
|
21
|
+
body,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AiAgentsClient } from './facade';
|