@vertesia/client 0.54.0 → 0.56.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 +84 -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/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/IamApi.js +51 -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 +209 -0
- package/lib/cjs/InteractionsApi.js.map +1 -0
- package/lib/cjs/PluginsApi.js +27 -0
- package/lib/cjs/PluginsApi.js.map +1 -0
- package/lib/cjs/ProjectsApi.js +54 -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 +218 -0
- package/lib/cjs/client.js.map +1 -0
- package/lib/cjs/execute.js +152 -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 +77 -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 +128 -0
- package/lib/cjs/store/FilesApi.js.map +1 -0
- package/lib/cjs/store/ObjectsApi.js +254 -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 +179 -0
- package/lib/cjs/store/WorkflowsApi.js.map +1 -0
- package/lib/cjs/store/client.js +55 -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/esm/AccountApi.js +81 -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/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/IamApi.js +45 -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 +206 -0
- package/lib/esm/InteractionsApi.js.map +1 -0
- package/lib/esm/PluginsApi.js +24 -0
- package/lib/esm/PluginsApi.js.map +1 -0
- package/lib/esm/ProjectsApi.js +51 -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 +211 -0
- package/lib/esm/client.js.map +1 -0
- package/lib/esm/execute.js +113 -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 +73 -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 +123 -0
- package/lib/esm/store/FilesApi.js.map +1 -0
- package/lib/esm/store/ObjectsApi.js +250 -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 +173 -0
- package/lib/esm/store/WorkflowsApi.js.map +1 -0
- package/lib/esm/store/client.js +51 -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/tsconfig.tsbuildinfo +1 -0
- package/lib/types/AccountApi.d.ts +58 -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/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/IamApi.d.ts +39 -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 +150 -0
- package/lib/types/InteractionsApi.d.ts.map +1 -0
- package/lib/types/PluginsApi.d.ts +12 -0
- package/lib/types/PluginsApi.d.ts.map +1 -0
- package/lib/types/ProjectsApi.d.ts +21 -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 +103 -0
- package/lib/types/client.d.ts.map +1 -0
- package/lib/types/execute.d.ts +36 -0
- package/lib/types/execute.d.ts.map +1 -0
- package/lib/types/index.d.ts +7 -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 +37 -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 +41 -0
- package/lib/types/store/FilesApi.d.ts.map +1 -0
- package/lib/types/store/ObjectsApi.d.ts +113 -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 +47 -0
- package/lib/types/store/WorkflowsApi.d.ts.map +1 -0
- package/lib/types/store/client.d.ts +29 -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/vertesia-client.js +2 -0
- package/lib/vertesia-client.js.map +1 -0
- package/package.json +10 -5
- package/src/EnvironmentsApi.ts +1 -1
- package/src/PluginsApi.ts +7 -5
- package/src/ProjectsApi.ts +2 -2
- package/src/RunsApi.ts +1 -1
- package/src/TrainingApi.ts +1 -1
- package/src/store/ObjectsApi.ts +7 -1
- package/src/store/WorkflowsApi.ts +73 -68
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export default class AccountApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/account");
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Retrieve all account information for current account
|
|
8
|
+
* @returns Account[]
|
|
9
|
+
*/
|
|
10
|
+
info() {
|
|
11
|
+
return this.get('/');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Update account information
|
|
15
|
+
* @returns Account
|
|
16
|
+
*/
|
|
17
|
+
update(payload) {
|
|
18
|
+
return this.put('/', { payload });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get all projects for account
|
|
22
|
+
*/
|
|
23
|
+
projects() {
|
|
24
|
+
return this.get('/projects').then(res => res.data);
|
|
25
|
+
}
|
|
26
|
+
members() {
|
|
27
|
+
return this.get('/members');
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Invite User to account
|
|
31
|
+
*/
|
|
32
|
+
inviteUser(payload) {
|
|
33
|
+
return this.post('/invites', { payload });
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Fetch Invites for Principal
|
|
37
|
+
* @returns UserInviteTokenData[]
|
|
38
|
+
* */
|
|
39
|
+
listInvites() {
|
|
40
|
+
return this.get('/invites');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Fetch Invites for Account
|
|
44
|
+
* @returns UserInviteTokenData[]
|
|
45
|
+
* */
|
|
46
|
+
listAccountInvitation(id) {
|
|
47
|
+
return this.get(`/invites/${id}`);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Accept Invite for account
|
|
51
|
+
* @returns UserInviteTokenData
|
|
52
|
+
* */
|
|
53
|
+
acceptInvite(id) {
|
|
54
|
+
return this.put(`/invites/${id}`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Delete Invite for account
|
|
58
|
+
* @returns UserInviteTokenData
|
|
59
|
+
* */
|
|
60
|
+
rejectInvite(id) {
|
|
61
|
+
return this.delete(`/invites/${id}`);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get Onboarding Progress for account
|
|
65
|
+
*/
|
|
66
|
+
onboardingProgress() {
|
|
67
|
+
return this.get('/onboarding');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get a google auth token for the current project.
|
|
71
|
+
* This token can be used to access exposed google cloud services
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
getGoogleToken() {
|
|
75
|
+
return this.get('/google-token');
|
|
76
|
+
}
|
|
77
|
+
getStripeBillingStatus() {
|
|
78
|
+
return this.get('/stripe-billing-status');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=AccountApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountApi.js","sourceRoot":"","sources":["../../src/AccountApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAGlE,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ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IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IACrC,CAAC;IAED,sBAAsB;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;IAC7C,CAAC;CAEJ"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export default class AccountsApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/accounts");
|
|
5
|
+
}
|
|
6
|
+
create(name) {
|
|
7
|
+
return this.post('/', { payload: { name } });
|
|
8
|
+
}
|
|
9
|
+
list() {
|
|
10
|
+
return this.get('/');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=AccountsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountsApi.js","sourceRoot":"","sources":["../../src/AccountsApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,QAAQ;IAE7C,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IACrC,CAAC;IAED,MAAM,CAAC,IAAY;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,IAAI;QACA,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CAMJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export default class AnalyticsApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/analytics");
|
|
5
|
+
}
|
|
6
|
+
runs(params) {
|
|
7
|
+
return this.post('/runs', { payload: params });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=AnalyticsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalyticsApi.js","sourceRoot":"","sources":["../../src/AnalyticsApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAKlE,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,QAAQ;IAE9C,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;IACtC,CAAC;IAED,IAAI,CAAC,MAAyB;QAE1B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAEnD,CAAC;CAGJ"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export class ApiKeysApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/apikeys");
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* List all keys for account without values
|
|
8
|
+
* @returns ApiKey[]
|
|
9
|
+
*/
|
|
10
|
+
list() {
|
|
11
|
+
return this.get('/');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create an new ApiKey for account
|
|
15
|
+
* BE VERY CAREFUL USING THIS API
|
|
16
|
+
* ALL REQUESTS ARE LOGGED IN SECURITY AUDIT LOG
|
|
17
|
+
* @returns ApiKeyWithValue
|
|
18
|
+
*/
|
|
19
|
+
create(payload) {
|
|
20
|
+
return this.post('/', { payload });
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Update an existing ApiKey for account
|
|
24
|
+
* @returns ApiKey
|
|
25
|
+
*/
|
|
26
|
+
update(id, payload) {
|
|
27
|
+
return this.put(`/${id}`, { payload });
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Retrieve an ApiKey and its value
|
|
31
|
+
* BE VERY CAREFUL USING THIS API AS IT EXPOSE THE API KEY VALUE
|
|
32
|
+
* ALL REQUESTS ARE LOGGED IN SECURITY AUDIT LOG
|
|
33
|
+
* @returns ApiKeyWithValue
|
|
34
|
+
* */
|
|
35
|
+
retrieve(id, withValue = false) {
|
|
36
|
+
if (withValue) {
|
|
37
|
+
return this.get(`/${id}`, { query: { withValue: true } });
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return this.get(`/${id}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* get or create a temporary public key which can be used from browser to browse and execute interactions.
|
|
45
|
+
* If a public key already exists for the given project (or for the current organization) then it is returned, otherwise a new one is created.
|
|
46
|
+
* The payload object can contain the following properties:
|
|
47
|
+
* - name: the name of the public key. If not specified a random name is generated.
|
|
48
|
+
* - projectId: the id of the project to which the public key will be associated.
|
|
49
|
+
* If not specified the key is associated with the current organization. (i.e. account).
|
|
50
|
+
* - ttl: the time to live of the public key in seconds.
|
|
51
|
+
* The ttl defaults to 1h.
|
|
52
|
+
* @param opts
|
|
53
|
+
* @returns
|
|
54
|
+
*/
|
|
55
|
+
requestPublicKey(payload = {}) {
|
|
56
|
+
return this.get('/pk', { query: payload });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=ApiKeysApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApiKeysApi.js","sourceRoot":"","sources":["../../src/ApiKeysApi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAElE,MAAM,OAAO,UAAW,SAAQ,QAAQ;IAGpC,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IACpC,CAAC;IAGD;;;OAGG;IACH,IAAI;QACA,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,OAAoC;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,EAAU,EAAE,OAAoC;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;SAKK;IACL,QAAQ,CAAC,EAAU,EAAE,YAAqB,KAAK;QAC3C,IAAI,SAAS,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC9B,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,UAAkC,EAAE;QACjD,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,KAAK,EAAE,OAA0C,EAAE,CAAC,CAAC;IAClF,CAAC;CACJ"}
|
|
@@ -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;QACrB,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAE9C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,OAA0C;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YAClB,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED,QAAQ,CAAC,EAAU;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,EAAU,EAAE,OAA0C;QACzD,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,EAAE;YACtB,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAU,EAAE,OAGxB;QACG,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,SAAS,EAAE;YAClC,OAAO;SACV,CAAC,CAAC;IACP,CAAC;IAED,UAAU,CAAC,EAAU,EAAE,OAA4B;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,SAAS,EAAE;YAClC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC,CAAC;IACP,CAAC;IAED,mBAAmB,CAAC,EAAU;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAC/C,CAAC;IAED,UAAU,CAAC,EAAU,EAAE,OAA2B;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,EAAE,GAAG,aAAa,EAAE;YACvC,OAAO;SACV,CAAC,CAAC;IACP,CAAC;CAEJ"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export class IamApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/iam");
|
|
5
|
+
}
|
|
6
|
+
aces = new AcesApi(this);
|
|
7
|
+
roles = new RolesApi(this);
|
|
8
|
+
}
|
|
9
|
+
export class RolesApi extends ApiTopic {
|
|
10
|
+
constructor(parent) {
|
|
11
|
+
super(parent, "/roles");
|
|
12
|
+
}
|
|
13
|
+
list() {
|
|
14
|
+
return this.get('/');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export class AcesApi extends ApiTopic {
|
|
18
|
+
constructor(parent) {
|
|
19
|
+
super(parent, "/aces");
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get the list of all runs
|
|
23
|
+
* @param project optional project id to filter by
|
|
24
|
+
* @param interaction optional interaction id to filter by
|
|
25
|
+
* @returns InteractionResult[]
|
|
26
|
+
**/
|
|
27
|
+
list(options) {
|
|
28
|
+
return this.get('/', { query: { ...options } });
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get an ACE by its Id
|
|
32
|
+
* @param id
|
|
33
|
+
* @returns InteractionResult
|
|
34
|
+
**/
|
|
35
|
+
retrieve(id) {
|
|
36
|
+
return this.get('/' + id);
|
|
37
|
+
}
|
|
38
|
+
create(payload) {
|
|
39
|
+
return this.post('/', { payload });
|
|
40
|
+
}
|
|
41
|
+
delete(id) {
|
|
42
|
+
return this.del('/' + id);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# 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;AAUlE,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;CAC7B;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,CAAO,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;CACJ"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { ApiTopic, ServerError } from "@vertesia/api-fetch-client";
|
|
2
|
+
import { 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
|
+
//# 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,kBAAkB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAYrG,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;gBACH,GAAG,KAAK;aACX;SACJ,CAAC,CAAC;IACP,CAAC;IACD;;;OAGG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G,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;CAEJ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ApiTopic } from "@vertesia/api-fetch-client";
|
|
2
|
+
export default class PluginsApi extends ApiTopic {
|
|
3
|
+
constructor(parent) {
|
|
4
|
+
super(parent, "/api/v1/plugins");
|
|
5
|
+
}
|
|
6
|
+
create(manifest) {
|
|
7
|
+
return this.post('/', { payload: manifest });
|
|
8
|
+
}
|
|
9
|
+
update(manifest) {
|
|
10
|
+
return this.put(`/${manifest.id}`, { payload: manifest });
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @param ids - ids to filter by
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
list(ids) {
|
|
17
|
+
return this.get('/', {
|
|
18
|
+
query: {
|
|
19
|
+
ids: ids ? ids.join(',') : undefined,
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=PluginsApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginsApi.js","sourceRoot":"","sources":["../../src/PluginsApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAGlE,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,QAAQ;IAE5C,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;IACpC,CAAC;IAED,MAAM,CAAC,QAAoC;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,QAAwB;QAC3B,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,GAAc;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;YACjB,KAAK,EAAE;gBACH,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;aACvC;SACJ,CAAC,CAAC;IACP,CAAC;CAEJ"}
|
|
@@ -0,0 +1,51 @@
|
|
|
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
|
+
listPlugins(projectId) {
|
|
23
|
+
return this.get(`/${projectId}/plugins`);
|
|
24
|
+
}
|
|
25
|
+
setPlugins(projectId, pluginIds) {
|
|
26
|
+
return this.post(`/${projectId}/plugins`, { payload: { plugins: pluginIds } });
|
|
27
|
+
}
|
|
28
|
+
integrations = new IntegrationsConfigurationApi(this);
|
|
29
|
+
}
|
|
30
|
+
class IntegrationsConfigurationApi extends ApiTopic {
|
|
31
|
+
constructor(parent) {
|
|
32
|
+
super(parent, "/");
|
|
33
|
+
}
|
|
34
|
+
list(projectId) {
|
|
35
|
+
return this.get(`/${projectId}/integrations`).then(res => res.integrations);
|
|
36
|
+
}
|
|
37
|
+
retrieve(projectId, integrationId) {
|
|
38
|
+
return this.get(`/${projectId}/integrations/${integrationId}`).catch(err => {
|
|
39
|
+
if (err.status === 404) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
throw err;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
update(projectId, integrationId, payload) {
|
|
46
|
+
return this.put(`/${projectId}/integrations/${integrationId}`, {
|
|
47
|
+
payload
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# 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,O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