@vertesia/client 0.78.0-dev-28b447d → 0.79.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/lib/cjs/AccountApi.js +85 -0
- package/lib/cjs/AccountApi.js.map +1 -0
- package/lib/cjs/AccountsApi.js +16 -0
- package/lib/cjs/AccountsApi.js.map +1 -0
- package/lib/cjs/AnalyticsApi.js +13 -0
- package/lib/cjs/AnalyticsApi.js.map +1 -0
- package/lib/cjs/ApiKeysApi.js +63 -0
- package/lib/cjs/ApiKeysApi.js.map +1 -0
- package/lib/cjs/AppsApi.js +119 -0
- package/lib/cjs/AppsApi.js.map +1 -0
- package/lib/cjs/CommandsApi.js +19 -0
- package/lib/cjs/CommandsApi.js.map +1 -0
- package/lib/cjs/EnvironmentsApi.js +58 -0
- package/lib/cjs/EnvironmentsApi.js.map +1 -0
- package/lib/cjs/GroupsApi.js +78 -0
- package/lib/cjs/GroupsApi.js.map +1 -0
- package/lib/cjs/IamApi.js +53 -0
- package/lib/cjs/IamApi.js.map +1 -0
- package/lib/cjs/InteractionBase.js +44 -0
- package/lib/cjs/InteractionBase.js.map +1 -0
- package/lib/cjs/InteractionsApi.js +217 -0
- package/lib/cjs/InteractionsApi.js.map +1 -0
- package/lib/cjs/ProjectsApi.js +48 -0
- package/lib/cjs/ProjectsApi.js.map +1 -0
- package/lib/cjs/PromptsApi.js +133 -0
- package/lib/cjs/PromptsApi.js.map +1 -0
- package/lib/cjs/RefsApi.js +14 -0
- package/lib/cjs/RefsApi.js.map +1 -0
- package/lib/cjs/RunsApi.js +105 -0
- package/lib/cjs/RunsApi.js.map +1 -0
- package/lib/cjs/StreamSource.js +17 -0
- package/lib/cjs/StreamSource.js.map +1 -0
- package/lib/cjs/TrainingApi.js +54 -0
- package/lib/cjs/TrainingApi.js.map +1 -0
- package/lib/cjs/UsersApi.js +13 -0
- package/lib/cjs/UsersApi.js.map +1 -0
- package/lib/cjs/client.js +279 -0
- package/lib/cjs/client.js.map +1 -0
- package/lib/cjs/execute.js +158 -0
- package/lib/cjs/execute.js.map +1 -0
- package/lib/cjs/index.js +21 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/nodejs/NodeStreamSource.js +45 -0
- package/lib/cjs/nodejs/NodeStreamSource.js.map +1 -0
- package/lib/cjs/nodejs/index.js +18 -0
- package/lib/cjs/nodejs/index.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/store/AgentsApi.js +16 -0
- package/lib/cjs/store/AgentsApi.js.map +1 -0
- package/lib/cjs/store/AnalyzeDocApi.js +56 -0
- package/lib/cjs/store/AnalyzeDocApi.js.map +1 -0
- package/lib/cjs/store/CollectionsApi.js +101 -0
- package/lib/cjs/store/CollectionsApi.js.map +1 -0
- package/lib/cjs/store/CommandsApi.js +17 -0
- package/lib/cjs/store/CommandsApi.js.map +1 -0
- package/lib/cjs/store/EmbeddingsApi.js +29 -0
- package/lib/cjs/store/EmbeddingsApi.js.map +1 -0
- package/lib/cjs/store/FilesApi.js +147 -0
- package/lib/cjs/store/FilesApi.js.map +1 -0
- package/lib/cjs/store/ObjectsApi.js +281 -0
- package/lib/cjs/store/ObjectsApi.js.map +1 -0
- package/lib/cjs/store/TypesApi.js +57 -0
- package/lib/cjs/store/TypesApi.js.map +1 -0
- package/lib/cjs/store/WorkflowsApi.js +265 -0
- package/lib/cjs/store/WorkflowsApi.js.map +1 -0
- package/lib/cjs/store/client.js +71 -0
- package/lib/cjs/store/client.js.map +1 -0
- package/lib/cjs/store/errors.js +11 -0
- package/lib/cjs/store/errors.js.map +1 -0
- package/lib/cjs/store/index.js +22 -0
- package/lib/cjs/store/index.js.map +1 -0
- package/lib/cjs/store/version.js +6 -0
- package/lib/cjs/store/version.js.map +1 -0
- package/lib/esm/AccountApi.js +82 -0
- package/lib/esm/AccountApi.js.map +1 -0
- package/lib/esm/AccountsApi.js +13 -0
- package/lib/esm/AccountsApi.js.map +1 -0
- package/lib/esm/AnalyticsApi.js +10 -0
- package/lib/esm/AnalyticsApi.js.map +1 -0
- package/lib/esm/ApiKeysApi.js +59 -0
- package/lib/esm/ApiKeysApi.js.map +1 -0
- package/lib/esm/AppsApi.js +116 -0
- package/lib/esm/AppsApi.js.map +1 -0
- package/lib/esm/CommandsApi.js +16 -0
- package/lib/esm/CommandsApi.js.map +1 -0
- package/lib/esm/EnvironmentsApi.js +55 -0
- package/lib/esm/EnvironmentsApi.js.map +1 -0
- package/lib/esm/GroupsApi.js +74 -0
- package/lib/esm/GroupsApi.js.map +1 -0
- package/lib/esm/IamApi.js +47 -0
- package/lib/esm/IamApi.js.map +1 -0
- package/lib/esm/InteractionBase.js +40 -0
- package/lib/esm/InteractionBase.js.map +1 -0
- package/lib/esm/InteractionsApi.js +214 -0
- package/lib/esm/InteractionsApi.js.map +1 -0
- package/lib/esm/ProjectsApi.js +45 -0
- package/lib/esm/ProjectsApi.js.map +1 -0
- package/lib/esm/PromptsApi.js +130 -0
- package/lib/esm/PromptsApi.js.map +1 -0
- package/lib/esm/RefsApi.js +10 -0
- package/lib/esm/RefsApi.js.map +1 -0
- package/lib/esm/RunsApi.js +101 -0
- package/lib/esm/RunsApi.js.map +1 -0
- package/lib/esm/StreamSource.js +13 -0
- package/lib/esm/StreamSource.js.map +1 -0
- package/lib/esm/TrainingApi.js +51 -0
- package/lib/esm/TrainingApi.js.map +1 -0
- package/lib/esm/UsersApi.js +10 -0
- package/lib/esm/UsersApi.js.map +1 -0
- package/lib/esm/client.js +270 -0
- package/lib/esm/client.js.map +1 -0
- package/lib/esm/execute.js +118 -0
- package/lib/esm/execute.js.map +1 -0
- package/lib/esm/index.js +5 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/nodejs/NodeStreamSource.js +41 -0
- package/lib/esm/nodejs/NodeStreamSource.js.map +1 -0
- package/lib/esm/nodejs/index.js +2 -0
- package/lib/esm/nodejs/index.js.map +1 -0
- package/lib/esm/store/AgentsApi.js +12 -0
- package/lib/esm/store/AgentsApi.js.map +1 -0
- package/lib/esm/store/AnalyzeDocApi.js +52 -0
- package/lib/esm/store/AnalyzeDocApi.js.map +1 -0
- package/lib/esm/store/CollectionsApi.js +97 -0
- package/lib/esm/store/CollectionsApi.js.map +1 -0
- package/lib/esm/store/CommandsApi.js +13 -0
- package/lib/esm/store/CommandsApi.js.map +1 -0
- package/lib/esm/store/EmbeddingsApi.js +25 -0
- package/lib/esm/store/EmbeddingsApi.js.map +1 -0
- package/lib/esm/store/FilesApi.js +142 -0
- package/lib/esm/store/FilesApi.js.map +1 -0
- package/lib/esm/store/ObjectsApi.js +277 -0
- package/lib/esm/store/ObjectsApi.js.map +1 -0
- package/lib/esm/store/TypesApi.js +53 -0
- package/lib/esm/store/TypesApi.js.map +1 -0
- package/lib/esm/store/WorkflowsApi.js +259 -0
- package/lib/esm/store/WorkflowsApi.js.map +1 -0
- package/lib/esm/store/client.js +67 -0
- package/lib/esm/store/client.js.map +1 -0
- package/lib/esm/store/errors.js +7 -0
- package/lib/esm/store/errors.js.map +1 -0
- package/lib/esm/store/index.js +6 -0
- package/lib/esm/store/index.js.map +1 -0
- package/lib/esm/store/version.js +3 -0
- package/lib/esm/store/version.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/AccountApi.d.ts +59 -0
- package/lib/types/AccountApi.d.ts.map +1 -0
- package/lib/types/AccountsApi.d.ts +7 -0
- package/lib/types/AccountsApi.d.ts.map +1 -0
- package/lib/types/AnalyticsApi.d.ts +6 -0
- package/lib/types/AnalyticsApi.d.ts.map +1 -0
- package/lib/types/ApiKeysApi.d.ts +42 -0
- package/lib/types/ApiKeysApi.d.ts.map +1 -0
- package/lib/types/AppsApi.d.ts +65 -0
- package/lib/types/AppsApi.d.ts.map +1 -0
- package/lib/types/CommandsApi.d.ts +10 -0
- package/lib/types/CommandsApi.d.ts.map +1 -0
- package/lib/types/EnvironmentsApi.d.ts +30 -0
- package/lib/types/EnvironmentsApi.d.ts.map +1 -0
- package/lib/types/GroupsApi.d.ts +65 -0
- package/lib/types/GroupsApi.d.ts.map +1 -0
- package/lib/types/IamApi.d.ts +41 -0
- package/lib/types/IamApi.d.ts.map +1 -0
- package/lib/types/InteractionBase.d.ts +22 -0
- package/lib/types/InteractionBase.d.ts.map +1 -0
- package/lib/types/InteractionsApi.d.ts +156 -0
- package/lib/types/InteractionsApi.d.ts.map +1 -0
- package/lib/types/ProjectsApi.d.ts +17 -0
- package/lib/types/ProjectsApi.d.ts.map +1 -0
- package/lib/types/PromptsApi.d.ts +106 -0
- package/lib/types/PromptsApi.d.ts.map +1 -0
- package/lib/types/RefsApi.d.ts +6 -0
- package/lib/types/RefsApi.d.ts.map +1 -0
- package/lib/types/RunsApi.d.ts +77 -0
- package/lib/types/RunsApi.d.ts.map +1 -0
- package/lib/types/StreamSource.d.ts +7 -0
- package/lib/types/StreamSource.d.ts.map +1 -0
- package/lib/types/TrainingApi.d.ts +27 -0
- package/lib/types/TrainingApi.d.ts.map +1 -0
- package/lib/types/UsersApi.d.ts +6 -0
- package/lib/types/UsersApi.d.ts.map +1 -0
- package/lib/types/client.d.ts +119 -0
- package/lib/types/client.d.ts.map +1 -0
- package/lib/types/execute.d.ts +37 -0
- package/lib/types/execute.d.ts.map +1 -0
- package/lib/types/index.d.ts +8 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/nodejs/NodeStreamSource.d.ts +9 -0
- package/lib/types/nodejs/NodeStreamSource.d.ts.map +1 -0
- package/lib/types/nodejs/index.d.ts +1 -0
- package/lib/types/nodejs/index.d.ts.map +1 -0
- package/lib/types/store/AgentsApi.d.ts +6 -0
- package/lib/types/store/AgentsApi.d.ts.map +1 -0
- package/lib/types/store/AnalyzeDocApi.d.ts +17 -0
- package/lib/types/store/AnalyzeDocApi.d.ts.map +1 -0
- package/lib/types/store/CollectionsApi.d.ts +66 -0
- package/lib/types/store/CollectionsApi.d.ts.map +1 -0
- package/lib/types/store/CommandsApi.d.ts +10 -0
- package/lib/types/store/CommandsApi.d.ts.map +1 -0
- package/lib/types/store/EmbeddingsApi.d.ts +12 -0
- package/lib/types/store/EmbeddingsApi.d.ts.map +1 -0
- package/lib/types/store/FilesApi.d.ts +47 -0
- package/lib/types/store/FilesApi.d.ts.map +1 -0
- package/lib/types/store/ObjectsApi.d.ts +122 -0
- package/lib/types/store/ObjectsApi.d.ts.map +1 -0
- package/lib/types/store/TypesApi.d.ts +23 -0
- package/lib/types/store/TypesApi.d.ts.map +1 -0
- package/lib/types/store/WorkflowsApi.d.ts +50 -0
- package/lib/types/store/WorkflowsApi.d.ts.map +1 -0
- package/lib/types/store/client.d.ts +34 -0
- package/lib/types/store/client.d.ts.map +1 -0
- package/lib/types/store/errors.d.ts +4 -0
- package/lib/types/store/errors.d.ts.map +1 -0
- package/lib/types/store/index.d.ts +5 -0
- package/lib/types/store/index.d.ts.map +1 -0
- package/lib/types/store/version.d.ts +2 -0
- package/lib/types/store/version.d.ts.map +1 -0
- package/lib/vertesia-client.js +2 -0
- package/lib/vertesia-client.js.map +1 -0
- package/package.json +54 -59
- package/src/InteractionsApi.ts +1 -2
- package/src/RunsApi.ts +1 -8
- package/src/client.test.ts +0 -2
- package/src/client.ts +69 -129
- package/src/store/FilesApi.ts +2 -2
- package/src/store/WorkflowsApi.ts +0 -166
- package/src/store/client.ts +12 -3
- package/src/store/version.ts +2 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export default class AppsApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/apps");
|
|
5
|
+
}
|
|
6
|
+
create(manifest) {
|
|
7
|
+
return this.post('/', { payload: manifest });
|
|
8
|
+
}
|
|
9
|
+
update(id, manifest) {
|
|
10
|
+
return this.put(`/${id}`, { payload: manifest });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get the list if tools provided by the given app.
|
|
14
|
+
* @param appId
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
listAppInstallationTools(appInstallId) {
|
|
18
|
+
return this.get(`/installations/${appInstallId}/tools`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @param ids - ids to filter by
|
|
22
|
+
* @returns the app manifests but without the agent.tool property which can be big.
|
|
23
|
+
*/
|
|
24
|
+
list() {
|
|
25
|
+
return this.get('/');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Install the app with the given id in the current project.
|
|
29
|
+
* @param appId - the id of the app to install
|
|
30
|
+
*/
|
|
31
|
+
install(appId, settings) {
|
|
32
|
+
return this.post(`/install`, {
|
|
33
|
+
payload: {
|
|
34
|
+
app_id: appId,
|
|
35
|
+
settings
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Remove the given app from the current project.
|
|
41
|
+
* @param installationId - the id of the app installation
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
uninstall(installationId) {
|
|
45
|
+
return this.del(`/install/${installationId}`);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* get an app unstallation given its name or null if the app is not installed
|
|
49
|
+
* @returns
|
|
50
|
+
*/
|
|
51
|
+
getAppInstallationByName(appName) {
|
|
52
|
+
return this.get(`/installations/name/${appName}`).catch((err) => {
|
|
53
|
+
if (err.status === 404) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Get the project refs where the application is visible by the current user.
|
|
63
|
+
* The application is specified either by id or by name.
|
|
64
|
+
* @param param0
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
getAppInstallationProjects(app) {
|
|
68
|
+
if (!app.id && !app.name) {
|
|
69
|
+
throw new Error("Invalid arguments: appId or appName must be specified");
|
|
70
|
+
}
|
|
71
|
+
const query = app.id ? {
|
|
72
|
+
id: app.id
|
|
73
|
+
} : {
|
|
74
|
+
name: app.name
|
|
75
|
+
};
|
|
76
|
+
return this.get("/installations/projects", {
|
|
77
|
+
query
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get the apps installed for the current authenticated project
|
|
82
|
+
* @param kind - the kind of app installations to filter by (e.g., 'agent', 'tool', etc.)
|
|
83
|
+
*/
|
|
84
|
+
getInstalledApps(kind) {
|
|
85
|
+
return this.get('/installations', {
|
|
86
|
+
query: {
|
|
87
|
+
kind,
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* This operation will return an array of all the found AppInstallations in the current project
|
|
93
|
+
* including orphaned installations
|
|
94
|
+
* This requires project admin since access is not checked on the insytallations.
|
|
95
|
+
* For a user level list of available installations (with user permission check) use getInstalledApps
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
getAllAppInstallations() {
|
|
99
|
+
return this.get('/installations/all');
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* List the app installations of the current project.
|
|
103
|
+
*/
|
|
104
|
+
listInstallations() {
|
|
105
|
+
return this.get('/installations/refs');
|
|
106
|
+
}
|
|
107
|
+
updateInstallationSettings(settingsPayload) {
|
|
108
|
+
return this.put(`/installations/settings/${settingsPayload.app_id}`, {
|
|
109
|
+
payload: {
|
|
110
|
+
app_id: settingsPayload.app_id,
|
|
111
|
+
settings: settingsPayload.settings
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=AppsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppsApi.js","sourceRoot":"","sources":["../../src/AppsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAA2B,MAAM,4BAA4B,CAAC;AAO/E,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,Q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B,CAAC,GAAqE;QAC5F,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC7E,CAAC;QACD,MAAM,KAAK,GAAG,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YACnB,EAAE,EAAE,GAAG,CAAC,EAAE;SACb,CAAC,CAAC,CAAC;YACA,IAAI,EAAE,GAAG,CAAC,IAAI;SACjB,CAAA;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,yBAAyB,EAAE;YACvC,KAAK;SACR,CAAC,CAAC;IACP,CAAC;IAED;;;OAGG;IACH,gBAAgB,CAAC,IAA0B;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE;YAC9B,KAAK,EAAE;gBACH,IAAI;aACP;SACJ,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACH,sBAAsB;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,iBAAiB;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAC3C,CAAC;IAED,0BAA0B,CAAC,eAAuC;QAC9D,OAAO,IAAI,CAAC,GAAG,CAAC,2BAA2B,eAAe,CAAC,MAAM,EAAE,EAAE;YACjE,OAAO,EAAE;gBACL,MAAM,EAAE,eAAe,CAAC,MAAM;gBAC9B,QAAQ,EAAE,eAAe,CAAC,QAAQ;aACJ;SACrC,CAAC,CAAC;IACP,CAAC;CAEJ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
/**
|
|
3
|
+
* Various utility commands
|
|
4
|
+
*/
|
|
5
|
+
export default class CommandsApi extends ApiTopic {
|
|
6
|
+
constructor(parent) {
|
|
7
|
+
super(parent, "/api/v1/commands");
|
|
8
|
+
}
|
|
9
|
+
async isNamespaceAvailable(name) {
|
|
10
|
+
return this.get(`/namespaces/${name}/is_available`).then((response) => response.available);
|
|
11
|
+
}
|
|
12
|
+
async initSamples() {
|
|
13
|
+
return this.post("/onboarding/init-samples");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=CommandsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandsApi.js","sourceRoot":"","sources":["../../src/CommandsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAIlE;;GAEG;AAEH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,QAAQ;IAE7C,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,oBAAoB,CAAC,IAAY;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,eAAe,IAAI,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/F,CAAC;IAED,KAAK,CAAC,WAAW;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACjD,CAAC;CAEJ"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export default class EnvironmentsApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/environments");
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* List all environments for the current project
|
|
8
|
+
* @param all if true, list all environments, otherwise only the ones for the current project
|
|
9
|
+
*/
|
|
10
|
+
list(all = false) {
|
|
11
|
+
const query = all ? { all: true } : undefined;
|
|
12
|
+
return this.get('/', { query });
|
|
13
|
+
}
|
|
14
|
+
create(payload) {
|
|
15
|
+
return this.post('/', {
|
|
16
|
+
payload
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
retrieve(id) {
|
|
20
|
+
return this.get('/' + id);
|
|
21
|
+
}
|
|
22
|
+
update(id, payload) {
|
|
23
|
+
return this.put('/' + id, {
|
|
24
|
+
payload
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Update enabled models and / or config. If enabled_models is not provided, the existing enabled models will not change.
|
|
29
|
+
* Same, if config is not provided the exiting config is not changed.
|
|
30
|
+
* If the config is provided then it will be updated without removing fields that are not provided.
|
|
31
|
+
*
|
|
32
|
+
* @param id
|
|
33
|
+
* @param payload
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
updateConfig(id, payload) {
|
|
37
|
+
return this.put('/' + id + '/config', {
|
|
38
|
+
payload
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
listModels(id, payload) {
|
|
42
|
+
return this.get('/' + id + '/models', {
|
|
43
|
+
query: payload ? { ...payload } : undefined
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
listTrainableModels(id) {
|
|
47
|
+
return this.get(`/${id}/trainable-models`);
|
|
48
|
+
}
|
|
49
|
+
embeddings(id, payload) {
|
|
50
|
+
return this.post('/' + id + '/embeddings', {
|
|
51
|
+
payload
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=EnvironmentsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnvironmentsApi.js","sourceRoot":"","sources":["../../src/EnvironmentsApi.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,QAAQ;IACjD,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,MAAe,KAAK;QAC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@@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export class GroupsApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/groups");
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* List all groups in the current account
|
|
8
|
+
* @param options Query options for filtering and pagination
|
|
9
|
+
* @returns Array of UserGroup objects
|
|
10
|
+
*/
|
|
11
|
+
list(options) {
|
|
12
|
+
return this.get('/', { query: options });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Create a new group
|
|
16
|
+
* @param payload The group data to create
|
|
17
|
+
* @returns The created UserGroup object
|
|
18
|
+
*/
|
|
19
|
+
create(payload) {
|
|
20
|
+
return this.post('/', { payload });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Retrieve a specific group by ID
|
|
24
|
+
* @param groupId The ID of the group to retrieve
|
|
25
|
+
* @returns The UserGroup object
|
|
26
|
+
*/
|
|
27
|
+
retrieve(groupId) {
|
|
28
|
+
return this.get('/' + groupId);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Update a group
|
|
32
|
+
* @param groupId The ID of the group to update
|
|
33
|
+
* @param payload The group data to update
|
|
34
|
+
* @returns The updated UserGroup object
|
|
35
|
+
*/
|
|
36
|
+
update(groupId, payload) {
|
|
37
|
+
return this.put('/' + groupId, { payload });
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Delete a group
|
|
41
|
+
* @param groupId The ID of the group to delete
|
|
42
|
+
* @returns Object with the deleted group ID
|
|
43
|
+
*/
|
|
44
|
+
delete(groupId) {
|
|
45
|
+
return this.del('/' + groupId);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* List members of a group
|
|
49
|
+
* @param groupId The ID of the group
|
|
50
|
+
* @returns Array of UserRef objects representing group members
|
|
51
|
+
*/
|
|
52
|
+
listMembers(groupId) {
|
|
53
|
+
return this.get('/' + groupId + '/members');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Add a member to a group
|
|
57
|
+
* @param groupId The ID of the group
|
|
58
|
+
* @param userId The ID of the user to add
|
|
59
|
+
* @returns The updated UserGroup object
|
|
60
|
+
*/
|
|
61
|
+
addMember(groupId, userId) {
|
|
62
|
+
return this.post('/' + groupId + '/members/' + userId);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Remove a member from a group
|
|
66
|
+
* @param groupId The ID of the group
|
|
67
|
+
* @param userId The ID of the user to remove
|
|
68
|
+
* @returns The updated UserGroup object
|
|
69
|
+
*/
|
|
70
|
+
removeMember(groupId, userId) {
|
|
71
|
+
return this.del('/' + groupId + '/members/' + userId);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=GroupsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupsApi.js","sourceRoot":"","sources":["../../src/GroupsApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAUlE,MAAM,OAAO,SAAU,SAAQ,QAAQ;IAEnC,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,OAA4B;QAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAA2B;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,OAAe;QACpB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAe,EAAE,OAA2B;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAChD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,OAAe;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,OAAe;QACvB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,OAAO,GAAG,UAAU,CAAC,CAAC;IAChD,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAC,OAAe,EAAE,MAAc;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;OAKG;IACH,YAAY,CAAC,OAAe,EAAE,MAAc;QACxC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC,CAAC;IAC1D,CAAC;CACJ"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
import { GroupsApi } from "./GroupsApi.js";
|
|
3
|
+
export class IamApi extends ApiTopic {
|
|
4
|
+
constructor(parent) {
|
|
5
|
+
super(parent, "/api/v1/iam");
|
|
6
|
+
}
|
|
7
|
+
aces = new AcesApi(this);
|
|
8
|
+
roles = new RolesApi(this);
|
|
9
|
+
groups = new GroupsApi(this);
|
|
10
|
+
}
|
|
11
|
+
export class RolesApi extends ApiTopic {
|
|
12
|
+
constructor(parent) {
|
|
13
|
+
super(parent, "/roles");
|
|
14
|
+
}
|
|
15
|
+
list() {
|
|
16
|
+
return this.get('/');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export class AcesApi extends ApiTopic {
|
|
20
|
+
constructor(parent) {
|
|
21
|
+
super(parent, "/aces");
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the list of all runs
|
|
25
|
+
* @param project optional project id to filter by
|
|
26
|
+
* @param interaction optional interaction id to filter by
|
|
27
|
+
* @returns InteractionResult[]
|
|
28
|
+
**/
|
|
29
|
+
list(options) {
|
|
30
|
+
return this.get('/', { query: { ...options } });
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get an ACE by its Id
|
|
34
|
+
* @param id
|
|
35
|
+
* @returns InteractionResult
|
|
36
|
+
**/
|
|
37
|
+
retrieve(id) {
|
|
38
|
+
return this.get('/' + id);
|
|
39
|
+
}
|
|
40
|
+
create(payload) {
|
|
41
|
+
return this.post('/', { payload });
|
|
42
|
+
}
|
|
43
|
+
delete(id) {
|
|
44
|
+
return this.del('/' + id);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=IamApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IamApi.js","sourceRoot":"","sources":["../../src/IamApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAU3C,MAAM,OAAO,MAAO,SAAQ,QAAQ;IAEhC,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACxB,KAAK,GAAG,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC1B,MAAM,GAAG,IAAI,SAAS,CAAC,IAAI,CAAC,CAAA;CAC/B;AAED,MAAM,OAAO,QAAS,SAAQ,QAAQ;IAElC,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAED,IAAI;QACA,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CAEJ;AAGD,MAAM,OAAO,OAAQ,SAAQ,QAAQ;IAEjC,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC1B,CAAC;IAED;;;;;QAKI;IACJ,IAAI,CAAC,OAAyB;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;;;QAII;IACJ,QAAQ,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,OAAyB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;IACtC,CAAC;IAED,MAAM,CAAC,EAAU;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAA;IAC7B,CAAC;CAEJ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { VertesiaClient } from "./client.js";
|
|
2
|
+
import { executeInteraction } from "./execute.js";
|
|
3
|
+
export class InteractionBase {
|
|
4
|
+
id;
|
|
5
|
+
client;
|
|
6
|
+
constructor(id, clientOrOpts) {
|
|
7
|
+
this.id = id;
|
|
8
|
+
if (clientOrOpts instanceof VertesiaClient) {
|
|
9
|
+
this.client = clientOrOpts;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
this.client = new VertesiaClient(clientOrOpts);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
retrieve() {
|
|
16
|
+
return this.client.interactions.retrieve(this.id);
|
|
17
|
+
}
|
|
18
|
+
update(payload) {
|
|
19
|
+
return this.client.interactions.update(this.id, payload);
|
|
20
|
+
}
|
|
21
|
+
render(data) {
|
|
22
|
+
data;
|
|
23
|
+
//TODO
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Execute an interaction and return a promise which will be resolved with the executed run when
|
|
27
|
+
* the run completes or fails.
|
|
28
|
+
* If the onChunk callback is passed then the streaming of the result is enabled.
|
|
29
|
+
* The onChunk callback with be called with the next chunk of the result as soon as it is available.
|
|
30
|
+
* When all chunks are received the function will return the resolved promise
|
|
31
|
+
* @param id of the interaction to execute
|
|
32
|
+
* @param payload InteractionExecutionPayload
|
|
33
|
+
* @param onChunk callback to be called when the next chunk of the response is available
|
|
34
|
+
* @returns the resolved execution run as Promise<ExecutionRun>
|
|
35
|
+
*/
|
|
36
|
+
async execute(payload = {}, onChunk) {
|
|
37
|
+
return executeInteraction(this.client, this.id, payload, onChunk);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=InteractionBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InteractionBase.js","sourceRoot":"","sources":["../../src/InteractionBase.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAuB,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,OAAO,eAAe;IAGL;IAFnB,MAAM,CAAiB;IAEvB,YAAmB,EAAU,EAAE,YAAkD;QAA9D,OAAE,GAAF,EAAE,CAAQ;QACzB,IAAI,YAAY,YAAY,cAAc,EAAE,CAAC;YACzC,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC;QAC/B,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,GAAG,IAAI,cAAc,CAAC,YAAY,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,OAAiC;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,MAAM,CAAC,IAAO;QACV,IAAI,CAAC;QACL,MAAM;IACV,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,OAAO,CAAC,UAAuC,EAAE,EACnD,OAAiC;QACjC,OAAO,kBAAkB,CAAI,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;CACJ"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { ApiTopic, ServerError } from "@vertesia/api-fetch-client";
|
|
2
|
+
import { checkRateLimit, executeInteraction, executeInteractionAsync, executeInteractionByName } from "./execute.js";
|
|
3
|
+
export default class InteractionsApi extends ApiTopic {
|
|
4
|
+
constructor(parent) {
|
|
5
|
+
super(parent, "/api/v1/interactions");
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get the list of all interactions in the current project
|
|
9
|
+
* @returns InteractionRef[]
|
|
10
|
+
**/
|
|
11
|
+
list(payload = {}) {
|
|
12
|
+
const query = payload.query || {};
|
|
13
|
+
return this.get("/", {
|
|
14
|
+
query: {
|
|
15
|
+
...query
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Find interactions given a mongo match query.
|
|
21
|
+
* You can also specify if prompts schemas are included in the result
|
|
22
|
+
*/
|
|
23
|
+
listEndpoints(payload) {
|
|
24
|
+
return this.post("/endpoints", {
|
|
25
|
+
payload
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* List all interaction versions in the project having the given endpoint name.
|
|
30
|
+
* This is useful to list orphaned versions
|
|
31
|
+
* @param name
|
|
32
|
+
*/
|
|
33
|
+
listVersionsByName(name) {
|
|
34
|
+
return this.get(`/versions/${name}`);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the list of all interactions facets
|
|
38
|
+
* @param payload query payload to filter facet search
|
|
39
|
+
* @returns ComputeInteractionFacetsResponse[]
|
|
40
|
+
**/
|
|
41
|
+
computeFacets(query) {
|
|
42
|
+
return this.post("/facets", {
|
|
43
|
+
payload: query
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* List interaction names in the current project
|
|
48
|
+
* @returns
|
|
49
|
+
*/
|
|
50
|
+
listNames() {
|
|
51
|
+
return this.get('/names');
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get the list of all interactions in the current project. Schemas will be returned too.
|
|
55
|
+
* @returns InteractionRefWithSchema[]
|
|
56
|
+
**/
|
|
57
|
+
export(payload) {
|
|
58
|
+
return this.post('/export', { payload });
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create a new interaction
|
|
62
|
+
* @param payload InteractionCreatePayload
|
|
63
|
+
* @returns Interaction
|
|
64
|
+
* @throws ApiError
|
|
65
|
+
* @throws 400 if payload is invalid
|
|
66
|
+
* @throws 500 if interaction creation fails
|
|
67
|
+
**/
|
|
68
|
+
create(payload) {
|
|
69
|
+
return this.post('/', {
|
|
70
|
+
payload
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Retrieve an existing interaction definition
|
|
75
|
+
* @param id of the interaction to retrieve
|
|
76
|
+
* @returns Interaction
|
|
77
|
+
**/
|
|
78
|
+
retrieve(id) {
|
|
79
|
+
return this.get(`/${id}`);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Update an existing interaction definition
|
|
83
|
+
* @param id of the interaction to update
|
|
84
|
+
* @param payload InteractionUpdatePayload
|
|
85
|
+
* @returns Interaction
|
|
86
|
+
* @throws ApiError
|
|
87
|
+
* @throws 400 if payload is invalid
|
|
88
|
+
* @throws 500 if interaction update fails
|
|
89
|
+
* @throws 404 if interaction not found
|
|
90
|
+
**/
|
|
91
|
+
update(id, payload) {
|
|
92
|
+
return this.put(`/${id}`, {
|
|
93
|
+
payload
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Execute an interaction and return a promise which will be resolved with the executed run when
|
|
98
|
+
* the run completes or fails.
|
|
99
|
+
* If the onChunk callback is passed then the streaming of the result is enabled.
|
|
100
|
+
* The onChunk callback with be called with the next chunk of the result as soon as it is available.
|
|
101
|
+
* When all chunks are received the function will return the resolved promise
|
|
102
|
+
* @param id of the interaction to execute
|
|
103
|
+
* @param payload InteractionExecutionPayload
|
|
104
|
+
* @param onChunk callback to be called when the next chunk of the response is available
|
|
105
|
+
* @returns Promise<ExecutionRun>
|
|
106
|
+
* @throws ApiError
|
|
107
|
+
* @throws 404 if interaction not found
|
|
108
|
+
* @throws 400 if payload is invalid
|
|
109
|
+
* @throws 500 if interaction execution fails
|
|
110
|
+
* @throws 500 if interaction execution times out
|
|
111
|
+
**/
|
|
112
|
+
execute(id, payload = {}, onChunk) {
|
|
113
|
+
return executeInteraction(this.client, id, payload, onChunk).catch(err => {
|
|
114
|
+
if (err instanceof ServerError && err.payload?.id) {
|
|
115
|
+
throw err.updateDetails({ run_id: err.payload.id });
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
throw err;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Same as execute but uses the interaction name selector instead of the id.
|
|
124
|
+
*
|
|
125
|
+
* A name selector is the interaction endpoint name suffixed with an optional tag or version which is starting with a `@` character.
|
|
126
|
+
* The special `draft` tag is used to select the draft version of the interaction. If no tag or version is specified then the latest version is selected.
|
|
127
|
+
* Examples of selectors:
|
|
128
|
+
* - `ReviewContract` - select the latest version of the ReviewContract interaction
|
|
129
|
+
* - `ReviewContract@1` - select the version 1 of the ReviewContract interaction
|
|
130
|
+
* - `ReviewContract@draft` - select the draft version of the ReviewContract interaction
|
|
131
|
+
* - `ReviewContract@fixed` - select the ReviewContract interaction which is tagged with 'fixed' tag.
|
|
132
|
+
* @param nameWithTag
|
|
133
|
+
* @param payload
|
|
134
|
+
* @param onChunk
|
|
135
|
+
* @returns
|
|
136
|
+
*/
|
|
137
|
+
executeByName(nameWithTag, payload = {}, onChunk) {
|
|
138
|
+
return executeInteractionByName(this.client, nameWithTag, payload, onChunk).catch(err => {
|
|
139
|
+
if (err instanceof ServerError && err.payload?.id) {
|
|
140
|
+
throw err.updateDetails({ run_id: err.payload.id });
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
throw err;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Execute an interaction in an workflow
|
|
149
|
+
* @param payload
|
|
150
|
+
* @returns
|
|
151
|
+
*/
|
|
152
|
+
executeAsync(payload) {
|
|
153
|
+
return executeInteractionAsync(this.client, payload);
|
|
154
|
+
}
|
|
155
|
+
publish(id, payload) {
|
|
156
|
+
return this.post(`/${id}/publish`, {
|
|
157
|
+
payload
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
fork(id, payload) {
|
|
161
|
+
return this.post(`/${id}/fork`, {
|
|
162
|
+
payload
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Generate Composable definition of an interaction
|
|
167
|
+
**/
|
|
168
|
+
generateInteraction(id, payload) {
|
|
169
|
+
return this.post(`${id}/generate-interaction`, {
|
|
170
|
+
payload
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Generate Test Data for an interaction
|
|
175
|
+
**/
|
|
176
|
+
generateTestData(id, payload) {
|
|
177
|
+
return this.post(`${id}/generate-test-data`, {
|
|
178
|
+
payload
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Suggest Improvement for a prompt
|
|
183
|
+
*/
|
|
184
|
+
suggestImprovements(id, payload) {
|
|
185
|
+
return this.post(`${id}/suggest-prompt-improvements`, {
|
|
186
|
+
payload
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* List the versions of the interaction. Returns an empty array if no versions are found
|
|
191
|
+
* @param id
|
|
192
|
+
* @returns the versions list or an empty array if no versions are found
|
|
193
|
+
*/
|
|
194
|
+
listVersions(id) {
|
|
195
|
+
return this.get(`/${id}/versions`);
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* List the forks of the interaction. Returns an empty array if no forks are found
|
|
199
|
+
* @param id
|
|
200
|
+
* @returns the versions list or an empty array if no forks are found
|
|
201
|
+
*/
|
|
202
|
+
listForks(id) {
|
|
203
|
+
return this.get(`/${id}/forks`);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Request a time slot to execute an interaction with a given environment / model
|
|
207
|
+
* @param payload RateLimitRequestPayload
|
|
208
|
+
* @returns RateLimitRequestResponse with delay_ms
|
|
209
|
+
*/
|
|
210
|
+
requestSlot(payload) {
|
|
211
|
+
return checkRateLimit(this.client, payload);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=InteractionsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InteractionsApi.js","sourceRoot":"","sources":["../../src/InteractionsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAG/E,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAYrH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,QAAQ;IACjD,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IAC1C,CAAC;IAED;;;QAGI;IACJ,IAAI,CAAC,UAAoC,EAAE;QACvC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,EAA4B,CAAC;QAE5D,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;YACjB,KAAK,EAAE;gBAC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U,EAAE,OAAmC;QAE/D,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,uBAAuB,EAAE;YAC3C,OAAO;SACV,CAAC,CAAC;IAEP,CAAC;IAED;;QAEI;IACJ,gBAAgB,CAAC,EAAU,EAAE,OAAgC;QAEzD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAqB,EAAE;YACzC,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,EAAU,EAAE,OAA6B;QACzD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,8BAA8B,EAAE;YAClD,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACvC,CAAC;IAED;;;;OAIG;IACH,SAAS,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,OAAgC;QACxC,OAAO,cAAc,CAAC,IAAI,CAAC,MAAwB,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;CAEJ"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export default class ProjectsApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/projects");
|
|
5
|
+
}
|
|
6
|
+
list(account) {
|
|
7
|
+
return this.get('/', { query: { account } });
|
|
8
|
+
}
|
|
9
|
+
retrieve(projectId) {
|
|
10
|
+
return this.get(`/${projectId}`);
|
|
11
|
+
}
|
|
12
|
+
create(payload) {
|
|
13
|
+
return this.post('/', {
|
|
14
|
+
payload
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
update(projectId, payload) {
|
|
18
|
+
return this.put(`/${projectId}`, {
|
|
19
|
+
payload
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
integrations = new IntegrationsConfigurationApi(this);
|
|
23
|
+
}
|
|
24
|
+
class IntegrationsConfigurationApi extends ApiTopic {
|
|
25
|
+
constructor(parent) {
|
|
26
|
+
super(parent, "/");
|
|
27
|
+
}
|
|
28
|
+
list(projectId) {
|
|
29
|
+
return this.get(`/${projectId}/integrations`).then(res => res.integrations);
|
|
30
|
+
}
|
|
31
|
+
retrieve(projectId, integrationId) {
|
|
32
|
+
return this.get(`/${projectId}/integrations/${integrationId}`).catch(err => {
|
|
33
|
+
if (err.status === 404) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
throw err;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
update(projectId, integrationId, payload) {
|
|
40
|
+
return this.put(`/${projectId}/integrations/${integrationId}`, {
|
|
41
|
+
payload
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ProjectsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProjectsApi.js","sourceRoot":"","sources":["../../src/ProjectsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAGlE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,QAAQ;IAC7C,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,CAAC,OAAkB;QACnB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,QAAQ,CAAC,SAAiB;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,OAA8B;QACjC,OAAO,IAAI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