@vertesia/common 0.42.2
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/LICENSE +13 -0
- package/lib/cjs/access-control.js +39 -0
- package/lib/cjs/access-control.js.map +1 -0
- package/lib/cjs/analytics.js +3 -0
- package/lib/cjs/analytics.js.map +1 -0
- package/lib/cjs/apikey.js +15 -0
- package/lib/cjs/apikey.js.map +1 -0
- package/lib/cjs/common.js +3 -0
- package/lib/cjs/common.js.map +1 -0
- package/lib/cjs/environment.js +116 -0
- package/lib/cjs/environment.js.map +1 -0
- package/lib/cjs/facets.js +3 -0
- package/lib/cjs/facets.js.map +1 -0
- package/lib/cjs/index.js +37 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/integrations.js +10 -0
- package/lib/cjs/integrations.js.map +1 -0
- package/lib/cjs/interaction.js +63 -0
- package/lib/cjs/interaction.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/payload.js +3 -0
- package/lib/cjs/payload.js.map +1 -0
- package/lib/cjs/project.js +50 -0
- package/lib/cjs/project.js.map +1 -0
- package/lib/cjs/prompt.js +21 -0
- package/lib/cjs/prompt.js.map +1 -0
- package/lib/cjs/query.js +3 -0
- package/lib/cjs/query.js.map +1 -0
- package/lib/cjs/refs.js +12 -0
- package/lib/cjs/refs.js.map +1 -0
- package/lib/cjs/runs.js +3 -0
- package/lib/cjs/runs.js.map +1 -0
- package/lib/cjs/store/activity-catalog.js +3 -0
- package/lib/cjs/store/activity-catalog.js.map +1 -0
- package/lib/cjs/store/common.js +3 -0
- package/lib/cjs/store/common.js.map +1 -0
- package/lib/cjs/store/dsl-workflow.js +5 -0
- package/lib/cjs/store/dsl-workflow.js.map +1 -0
- package/lib/cjs/store/index.js +24 -0
- package/lib/cjs/store/index.js.map +1 -0
- package/lib/cjs/store/object-types.js +98 -0
- package/lib/cjs/store/object-types.js.map +1 -0
- package/lib/cjs/store/store.js +18 -0
- package/lib/cjs/store/store.js.map +1 -0
- package/lib/cjs/store/temporalio.js +44 -0
- package/lib/cjs/store/temporalio.js.map +1 -0
- package/lib/cjs/store/workflow.js +24 -0
- package/lib/cjs/store/workflow.js.map +1 -0
- package/lib/cjs/training.js +14 -0
- package/lib/cjs/training.js.map +1 -0
- package/lib/cjs/transient-tokens.js +9 -0
- package/lib/cjs/transient-tokens.js.map +1 -0
- package/lib/cjs/user.js +12 -0
- package/lib/cjs/user.js.map +1 -0
- package/lib/cjs/utils/auth.js +15 -0
- package/lib/cjs/utils/auth.js.map +1 -0
- package/lib/cjs/utils/schemas.js +48 -0
- package/lib/cjs/utils/schemas.js.map +1 -0
- package/lib/esm/access-control.js +36 -0
- package/lib/esm/access-control.js.map +1 -0
- package/lib/esm/analytics.js +2 -0
- package/lib/esm/analytics.js.map +1 -0
- package/lib/esm/apikey.js +12 -0
- package/lib/esm/apikey.js.map +1 -0
- package/lib/esm/common.js +2 -0
- package/lib/esm/common.js.map +1 -0
- package/lib/esm/environment.js +113 -0
- package/lib/esm/environment.js.map +1 -0
- package/lib/esm/facets.js +2 -0
- package/lib/esm/facets.js.map +1 -0
- package/lib/esm/index.js +21 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/integrations.js +7 -0
- package/lib/esm/integrations.js.map +1 -0
- package/lib/esm/interaction.js +60 -0
- package/lib/esm/interaction.js.map +1 -0
- package/lib/esm/payload.js +2 -0
- package/lib/esm/payload.js.map +1 -0
- package/lib/esm/project.js +46 -0
- package/lib/esm/project.js.map +1 -0
- package/lib/esm/prompt.js +18 -0
- package/lib/esm/prompt.js.map +1 -0
- package/lib/esm/query.js +2 -0
- package/lib/esm/query.js.map +1 -0
- package/lib/esm/refs.js +9 -0
- package/lib/esm/refs.js.map +1 -0
- package/lib/esm/runs.js +2 -0
- package/lib/esm/runs.js.map +1 -0
- package/lib/esm/store/activity-catalog.js +2 -0
- package/lib/esm/store/activity-catalog.js.map +1 -0
- package/lib/esm/store/common.js +2 -0
- package/lib/esm/store/common.js.map +1 -0
- package/lib/esm/store/dsl-workflow.js +2 -0
- package/lib/esm/store/dsl-workflow.js.map +1 -0
- package/lib/esm/store/index.js +8 -0
- package/lib/esm/store/index.js.map +1 -0
- package/lib/esm/store/object-types.js +95 -0
- package/lib/esm/store/object-types.js.map +1 -0
- package/lib/esm/store/store.js +15 -0
- package/lib/esm/store/store.js.map +1 -0
- package/lib/esm/store/temporalio.js +41 -0
- package/lib/esm/store/temporalio.js.map +1 -0
- package/lib/esm/store/workflow.js +21 -0
- package/lib/esm/store/workflow.js.map +1 -0
- package/lib/esm/training.js +11 -0
- package/lib/esm/training.js.map +1 -0
- package/lib/esm/transient-tokens.js +6 -0
- package/lib/esm/transient-tokens.js.map +1 -0
- package/lib/esm/user.js +9 -0
- package/lib/esm/user.js.map +1 -0
- package/lib/esm/utils/auth.js +11 -0
- package/lib/esm/utils/auth.js.map +1 -0
- package/lib/esm/utils/schemas.js +44 -0
- package/lib/esm/utils/schemas.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib/types/access-control.d.ts +56 -0
- package/lib/types/access-control.d.ts.map +1 -0
- package/lib/types/analytics.d.ts +36 -0
- package/lib/types/analytics.d.ts.map +1 -0
- package/lib/types/apikey.d.ts +54 -0
- package/lib/types/apikey.d.ts.map +1 -0
- package/lib/types/common.d.ts +28 -0
- package/lib/types/common.d.ts.map +1 -0
- package/lib/types/environment.d.ts +79 -0
- package/lib/types/environment.d.ts.map +1 -0
- package/lib/types/facets.d.ts +34 -0
- package/lib/types/facets.d.ts.map +1 -0
- package/lib/types/index.d.ts +20 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/integrations.d.ts +18 -0
- package/lib/types/integrations.d.ts.map +1 -0
- package/lib/types/interaction.d.ts +233 -0
- package/lib/types/interaction.d.ts.map +1 -0
- package/lib/types/payload.d.ts +49 -0
- package/lib/types/payload.d.ts.map +1 -0
- package/lib/types/project.d.ts +95 -0
- package/lib/types/project.d.ts.map +1 -0
- package/lib/types/prompt.d.ts +70 -0
- package/lib/types/prompt.d.ts.map +1 -0
- package/lib/types/query.d.ts +74 -0
- package/lib/types/query.d.ts.map +1 -0
- package/lib/types/refs.d.ts +19 -0
- package/lib/types/refs.d.ts.map +1 -0
- package/lib/types/runs.d.ts +24 -0
- package/lib/types/runs.d.ts.map +1 -0
- package/lib/types/store/activity-catalog.d.ts +24 -0
- package/lib/types/store/activity-catalog.d.ts.map +1 -0
- package/lib/types/store/common.d.ts +10 -0
- package/lib/types/store/common.d.ts.map +1 -0
- package/lib/types/store/dsl-workflow.d.ts +244 -0
- package/lib/types/store/dsl-workflow.d.ts.map +1 -0
- package/lib/types/store/index.d.ts +7 -0
- package/lib/types/store/index.d.ts.map +1 -0
- package/lib/types/store/object-types.d.ts +23 -0
- package/lib/types/store/object-types.d.ts.map +1 -0
- package/lib/types/store/store.d.ts +211 -0
- package/lib/types/store/store.d.ts.map +1 -0
- package/lib/types/store/temporalio.d.ts +16 -0
- package/lib/types/store/temporalio.d.ts.map +1 -0
- package/lib/types/store/workflow.d.ts +129 -0
- package/lib/types/store/workflow.d.ts.map +1 -0
- package/lib/types/training.d.ts +38 -0
- package/lib/types/training.d.ts.map +1 -0
- package/lib/types/transient-tokens.d.ts +27 -0
- package/lib/types/transient-tokens.d.ts.map +1 -0
- package/lib/types/user.d.ts +105 -0
- package/lib/types/user.d.ts.map +1 -0
- package/lib/types/utils/auth.d.ts +3 -0
- package/lib/types/utils/auth.d.ts.map +1 -0
- package/lib/types/utils/schemas.d.ts +5 -0
- package/lib/types/utils/schemas.d.ts.map +1 -0
- package/package.json +34 -0
- package/src/access-control.ts +77 -0
- package/src/analytics.ts +49 -0
- package/src/apikey.ts +68 -0
- package/src/common.ts +34 -0
- package/src/environment.ts +193 -0
- package/src/facets.ts +44 -0
- package/src/index.ts +20 -0
- package/src/integrations.ts +25 -0
- package/src/interaction.ts +300 -0
- package/src/payload.ts +62 -0
- package/src/project.ts +136 -0
- package/src/prompt.ts +95 -0
- package/src/query.ts +85 -0
- package/src/refs.ts +27 -0
- package/src/runs.ts +27 -0
- package/src/store/activity-catalog.ts +39 -0
- package/src/store/common.ts +10 -0
- package/src/store/dsl-workflow.ts +289 -0
- package/src/store/index.ts +7 -0
- package/src/store/ms.d.ts +11 -0
- package/src/store/object-types.ts +128 -0
- package/src/store/store.ts +262 -0
- package/src/store/temporalio.ts +54 -0
- package/src/store/workflow.ts +156 -0
- package/src/training.ts +44 -0
- package/src/transient-tokens.ts +30 -0
- package/src/user.ts +124 -0
- package/src/utils/auth.ts +12 -0
- package/src/utils/schemas.ts +44 -0
@@ -0,0 +1,77 @@
|
|
1
|
+
/**
|
2
|
+
* @module access-control
|
3
|
+
* @description
|
4
|
+
* Access control interfaces
|
5
|
+
*/
|
6
|
+
|
7
|
+
import { ProjectRoles } from "./project.js";
|
8
|
+
|
9
|
+
export enum Permission {
|
10
|
+
int_read = "interaction:read",
|
11
|
+
int_write = "interaction:write",
|
12
|
+
int_delete = "interaction:delete",
|
13
|
+
|
14
|
+
int_execute = "interaction:execute",
|
15
|
+
run_read = "run:read",
|
16
|
+
run_write = "run:write",
|
17
|
+
|
18
|
+
env_manage = "environment:manage",
|
19
|
+
|
20
|
+
project_manage = "project:manage",
|
21
|
+
|
22
|
+
api_key_create = "api_key:create",
|
23
|
+
api_key_read = "api_key:read",
|
24
|
+
|
25
|
+
account_read = "account:read",
|
26
|
+
account_manage = "account:manage",
|
27
|
+
manage_billing = "account:billing",
|
28
|
+
account_member = "account:member",
|
29
|
+
|
30
|
+
|
31
|
+
content_read = "content:read",
|
32
|
+
content_create = "content:create",
|
33
|
+
content_update = "content:update",
|
34
|
+
content_delete = "content:delete",
|
35
|
+
|
36
|
+
content_admin = "content:admin", //manage schemas, workflows, rules
|
37
|
+
|
38
|
+
workflow_run = "workflow:run",
|
39
|
+
}
|
40
|
+
|
41
|
+
export enum AccessControlledResource {
|
42
|
+
project = "project",
|
43
|
+
environment = "environment",
|
44
|
+
account = "account",
|
45
|
+
interaction = "interaction",
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
export interface AccessControlEntry {
|
50
|
+
role: ProjectRoles;
|
51
|
+
resource: string; //objectId
|
52
|
+
principal: string; //objectId
|
53
|
+
type: AccessControlledResource;
|
54
|
+
tags?: string[];
|
55
|
+
expires_at?: string;
|
56
|
+
created_at?: string;
|
57
|
+
updated_at?: string;
|
58
|
+
id: string;
|
59
|
+
}
|
60
|
+
|
61
|
+
export interface ACECreatePayload extends
|
62
|
+
Omit<AccessControlEntry, "created_at" | "updated_at" | "id"> {
|
63
|
+
}
|
64
|
+
|
65
|
+
export interface ACEUpdatePayload extends Partial<ACECreatePayload> {
|
66
|
+
}
|
67
|
+
|
68
|
+
|
69
|
+
export interface AcesQueryOptions {
|
70
|
+
|
71
|
+
level?: 'resource' | 'project' | 'account'
|
72
|
+
resource?: string
|
73
|
+
principal?: string
|
74
|
+
role?: string
|
75
|
+
type?: AccessControlledResource
|
76
|
+
|
77
|
+
}
|
package/src/analytics.ts
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
|
2
|
+
export interface AnalyticsAxis {
|
3
|
+
environment?: string;
|
4
|
+
project?: string;
|
5
|
+
interactions?: string[];
|
6
|
+
models?: string[];
|
7
|
+
status?: string[];
|
8
|
+
tags?: string[];
|
9
|
+
selectedOnly?: boolean;
|
10
|
+
}
|
11
|
+
|
12
|
+
export interface RunAnalyticsQuery {
|
13
|
+
|
14
|
+
/** filters to apply to the query */
|
15
|
+
filterBy: AnalyticsAxis;
|
16
|
+
|
17
|
+
/** The field to group by */
|
18
|
+
groupBy?: RunAnalyticsGroupBy
|
19
|
+
|
20
|
+
/** The start date of the query in EPOCH format */
|
21
|
+
from?: number;
|
22
|
+
/** The end date of the query in EPOCH format */
|
23
|
+
to?: number;
|
24
|
+
|
25
|
+
/** The time resolution of the analytics query */
|
26
|
+
resolution?: TimeResolution;
|
27
|
+
|
28
|
+
/** The field to sort by */
|
29
|
+
virtual?: boolean;
|
30
|
+
|
31
|
+
}
|
32
|
+
|
33
|
+
|
34
|
+
export type RunAnalyticsGroupBy = "interaction" | "modelId" | "project" | "status" | "tags" | "environment";
|
35
|
+
|
36
|
+
export type TimeResolution = "hour" | "day" | "week" | "month" | "year";
|
37
|
+
|
38
|
+
|
39
|
+
export interface RunAnalyticsResult {
|
40
|
+
date: string,
|
41
|
+
timestamp: string,
|
42
|
+
group: string
|
43
|
+
count: number,
|
44
|
+
execution_time: {
|
45
|
+
avg: number,
|
46
|
+
min: number,
|
47
|
+
max: number
|
48
|
+
},
|
49
|
+
}
|
package/src/apikey.ts
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
import { ProjectRef, ProjectRoles } from "./project.js";
|
2
|
+
import { AccountRef } from "./user.js";
|
3
|
+
|
4
|
+
|
5
|
+
export enum ApiKeyTypes {
|
6
|
+
public = 'pk',
|
7
|
+
secret = 'sk'
|
8
|
+
}
|
9
|
+
export interface ApiKey {
|
10
|
+
id: string;
|
11
|
+
name: string;
|
12
|
+
type: ApiKeyTypes;
|
13
|
+
role: ProjectRoles;
|
14
|
+
maskedValue?: string; //masked value
|
15
|
+
account: string; // the account id
|
16
|
+
project: string; // the project id if any
|
17
|
+
enabled: boolean;
|
18
|
+
created_by: string,
|
19
|
+
updated_by: string,
|
20
|
+
created_at: Date;
|
21
|
+
updated_at: Date;
|
22
|
+
expires_at?: Date; // in case of public key only
|
23
|
+
}
|
24
|
+
|
25
|
+
|
26
|
+
export interface CreateOrUpdateApiKeyPayload extends Partial<ApiKey> {
|
27
|
+
|
28
|
+
}
|
29
|
+
|
30
|
+
export interface ApiKeyWithValue extends Omit<ApiKey, 'maskedValue'> {
|
31
|
+
value: string;
|
32
|
+
}
|
33
|
+
|
34
|
+
|
35
|
+
export interface CreatePublicKeyPayload {
|
36
|
+
name?: string,
|
37
|
+
projectId?: string,
|
38
|
+
ttl?: number,
|
39
|
+
}
|
40
|
+
|
41
|
+
export interface AuthTokenResponse {
|
42
|
+
token: string;
|
43
|
+
}
|
44
|
+
|
45
|
+
export interface AuthTokenPayload {
|
46
|
+
sub: string
|
47
|
+
name: string;
|
48
|
+
email?: string;
|
49
|
+
picture?: string;
|
50
|
+
|
51
|
+
type: PrincipalType
|
52
|
+
account: AccountRef;
|
53
|
+
account_roles: ProjectRoles[];
|
54
|
+
accounts: AccountRef[];
|
55
|
+
project?: ProjectRef;
|
56
|
+
project_roles?: ProjectRoles[];
|
57
|
+
|
58
|
+
iss: string; //issuer
|
59
|
+
aud: string; //audience
|
60
|
+
exp: number; //expires in (EPOC seconds)
|
61
|
+
}
|
62
|
+
|
63
|
+
|
64
|
+
export enum PrincipalType {
|
65
|
+
User = "user",
|
66
|
+
ApiKey = "apikey",
|
67
|
+
ServiceAcount = "service_account",
|
68
|
+
}
|
package/src/common.ts
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
export interface FindPayload {
|
2
|
+
query: Record<string, any>;
|
3
|
+
limit?: number;
|
4
|
+
select?: string;
|
5
|
+
}
|
6
|
+
|
7
|
+
|
8
|
+
export interface GenericCommandResponse {
|
9
|
+
status: string;
|
10
|
+
message: string;
|
11
|
+
err?: any;
|
12
|
+
details?: any;
|
13
|
+
}
|
14
|
+
|
15
|
+
export interface BulkOperationPayload {
|
16
|
+
/**
|
17
|
+
* The operation name
|
18
|
+
*/
|
19
|
+
name: "change_type" | "delete" | "start_workflow" | "update";
|
20
|
+
|
21
|
+
/**
|
22
|
+
* The IDs of the objects to operate on
|
23
|
+
*/
|
24
|
+
ids: string[];
|
25
|
+
|
26
|
+
/**
|
27
|
+
* The operation parameters.
|
28
|
+
*/
|
29
|
+
params: Record<string, any>;
|
30
|
+
}
|
31
|
+
|
32
|
+
export interface BulkOperationResult {
|
33
|
+
status: "in_progress" | "completed" | "failed";
|
34
|
+
}
|
@@ -0,0 +1,193 @@
|
|
1
|
+
import { AIModel, ModelOptions } from "@llumiverse/core";
|
2
|
+
|
3
|
+
|
4
|
+
export enum SupportedProviders {
|
5
|
+
// from llumiverse
|
6
|
+
openai = 'openai',
|
7
|
+
azure_openai = 'azure_openai',
|
8
|
+
huggingface_ie = 'huggingface_ie',
|
9
|
+
replicate = 'replicate',
|
10
|
+
bedrock = 'bedrock',
|
11
|
+
vertexai = 'vertexai',
|
12
|
+
togetherai = 'togetherai',
|
13
|
+
mistralai = 'mistralai',
|
14
|
+
groq = 'groq',
|
15
|
+
watsonx = 'watsonx',
|
16
|
+
// from studio
|
17
|
+
virtual_lb = 'virtual_lb',
|
18
|
+
virtual_mediator = 'virtual_mediator',
|
19
|
+
test = 'test'
|
20
|
+
}
|
21
|
+
|
22
|
+
export interface SupportedProviderParams {
|
23
|
+
id: SupportedProviders;
|
24
|
+
name: string;
|
25
|
+
requiresApiKey: boolean;
|
26
|
+
requiresEndpointUrl: boolean;
|
27
|
+
endpointPlaceholder?: string;
|
28
|
+
supportSearch?: boolean;
|
29
|
+
}
|
30
|
+
|
31
|
+
export const SupportedProvidersList: Record<SupportedProviders, SupportedProviderParams> = {
|
32
|
+
'openai':
|
33
|
+
{
|
34
|
+
id: SupportedProviders.openai,
|
35
|
+
name: "OpenAI",
|
36
|
+
requiresApiKey: true,
|
37
|
+
requiresEndpointUrl: false,
|
38
|
+
supportSearch: false,
|
39
|
+
},
|
40
|
+
'azure_openai':
|
41
|
+
{
|
42
|
+
id: SupportedProviders.azure_openai,
|
43
|
+
name: "Azure OpenAI",
|
44
|
+
requiresApiKey: false,
|
45
|
+
requiresEndpointUrl: true,
|
46
|
+
supportSearch: false,
|
47
|
+
},
|
48
|
+
'huggingface_ie':
|
49
|
+
{
|
50
|
+
id: SupportedProviders.huggingface_ie,
|
51
|
+
name: "HuggingFace Inference Endpoint",
|
52
|
+
requiresApiKey: true,
|
53
|
+
requiresEndpointUrl: true,
|
54
|
+
},
|
55
|
+
'replicate':
|
56
|
+
{
|
57
|
+
id: SupportedProviders.replicate,
|
58
|
+
name: "Repicate",
|
59
|
+
requiresApiKey: true,
|
60
|
+
requiresEndpointUrl: false,
|
61
|
+
supportSearch: true,
|
62
|
+
},
|
63
|
+
'bedrock':
|
64
|
+
{
|
65
|
+
id: SupportedProviders.bedrock,
|
66
|
+
name: "AWS Bedrock",
|
67
|
+
requiresApiKey: false,
|
68
|
+
requiresEndpointUrl: false,
|
69
|
+
endpointPlaceholder: "region name (eg. us-east-1)",
|
70
|
+
supportSearch: false,
|
71
|
+
},
|
72
|
+
vertexai: {
|
73
|
+
id: SupportedProviders.vertexai,
|
74
|
+
name: "Google Vertex AI",
|
75
|
+
requiresApiKey: false,
|
76
|
+
requiresEndpointUrl: false,
|
77
|
+
supportSearch: false,
|
78
|
+
},
|
79
|
+
togetherai: {
|
80
|
+
id: SupportedProviders.togetherai,
|
81
|
+
name: "Together AI",
|
82
|
+
requiresApiKey: false,
|
83
|
+
requiresEndpointUrl: false,
|
84
|
+
supportSearch: false,
|
85
|
+
},
|
86
|
+
mistralai: {
|
87
|
+
id: SupportedProviders.mistralai,
|
88
|
+
name: "Mistral AI",
|
89
|
+
requiresApiKey: false,
|
90
|
+
requiresEndpointUrl: false,
|
91
|
+
supportSearch: false,
|
92
|
+
},
|
93
|
+
groq: {
|
94
|
+
id: SupportedProviders.groq,
|
95
|
+
name: "Groq Cloud",
|
96
|
+
requiresApiKey: false,
|
97
|
+
requiresEndpointUrl: false,
|
98
|
+
supportSearch: false,
|
99
|
+
},
|
100
|
+
watsonx: {
|
101
|
+
id: SupportedProviders.watsonx,
|
102
|
+
name: "IBM WatsonX",
|
103
|
+
requiresApiKey: true,
|
104
|
+
requiresEndpointUrl: true,
|
105
|
+
supportSearch: false
|
106
|
+
},
|
107
|
+
'virtual_lb':
|
108
|
+
{
|
109
|
+
id: SupportedProviders.virtual_lb,
|
110
|
+
name: "Virtual - Load Balancer",
|
111
|
+
requiresApiKey: false,
|
112
|
+
requiresEndpointUrl: false,
|
113
|
+
supportSearch: false,
|
114
|
+
},
|
115
|
+
'virtual_mediator':
|
116
|
+
{
|
117
|
+
id: SupportedProviders.virtual_mediator,
|
118
|
+
name: "Virtual - Mediator",
|
119
|
+
requiresApiKey: false,
|
120
|
+
requiresEndpointUrl: false,
|
121
|
+
supportSearch: false,
|
122
|
+
},
|
123
|
+
'test': {
|
124
|
+
id: SupportedProviders.test,
|
125
|
+
name: "Test LLM",
|
126
|
+
requiresApiKey: false,
|
127
|
+
requiresEndpointUrl: false,
|
128
|
+
supportSearch: false,
|
129
|
+
},
|
130
|
+
};
|
131
|
+
|
132
|
+
|
133
|
+
export interface VirtualEnvEntry {
|
134
|
+
model: string;
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Custom configuration for virtual environments
|
139
|
+
**/
|
140
|
+
export interface LoadBalancingEnvConfig {
|
141
|
+
entries?: LoadBalancingEnvEntryConfig[];
|
142
|
+
balance_if_failed?: boolean;
|
143
|
+
}
|
144
|
+
|
145
|
+
export interface LoadBalancingEnvEntryConfig extends VirtualEnvEntry {
|
146
|
+
weight: number;
|
147
|
+
}
|
148
|
+
|
149
|
+
export interface MediatorEnvConfig extends ModelOptions{
|
150
|
+
entries?: VirtualEnvEntry[];
|
151
|
+
max_concurrent_requests?: number;
|
152
|
+
// the model used to evaluate the responses. If not specified all entries will mediates the response
|
153
|
+
// and the best response will be picked
|
154
|
+
mediators?: VirtualEnvEntry[];
|
155
|
+
}
|
156
|
+
|
157
|
+
export interface ExecutionEnvironment {
|
158
|
+
id: string;
|
159
|
+
name: string;
|
160
|
+
provider: SupportedProviders;
|
161
|
+
description?: string;
|
162
|
+
endpoint_url?: string;
|
163
|
+
default_model?: string;
|
164
|
+
enabled_models?: AIModel[];
|
165
|
+
apiKey?: string;
|
166
|
+
config?: any;
|
167
|
+
account: string;
|
168
|
+
allowed_projects?: string[];
|
169
|
+
created_by: string,
|
170
|
+
updated_by: string,
|
171
|
+
created_at: string;
|
172
|
+
updated_at: string;
|
173
|
+
}
|
174
|
+
|
175
|
+
export interface ExecutionEnvironmentRef {
|
176
|
+
id: string;
|
177
|
+
name: string;
|
178
|
+
provider: SupportedProviders;
|
179
|
+
enabled_models?: AIModel[];
|
180
|
+
default_model?: string;
|
181
|
+
endpoint_url?: string;
|
182
|
+
allowed_projects?: string[];
|
183
|
+
account: string;
|
184
|
+
created_by: string;
|
185
|
+
updated_by: string;
|
186
|
+
created_at: string;
|
187
|
+
updated_at: string;
|
188
|
+
}
|
189
|
+
|
190
|
+
export const ExecutionEnvironmentRefPopulate = "id name provider enabled_models default_model endpoint_url allowed_projects account created_at updated_at";
|
191
|
+
|
192
|
+
export interface ExecutionEnvironmentCreatePayload extends Omit<ExecutionEnvironment, 'id' | 'account' | 'created_at' | 'updated_at' | 'created_by' | 'updated_by' | 'project'> { }
|
193
|
+
export interface ExecutionEnvironmentUpdatePayload extends Partial<Omit<ExecutionEnvironment, 'id' | 'account' | 'created_at' | 'updated_at' | 'created_by' | 'updated_by'>> { }
|
package/src/facets.ts
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
// this is the mongo definition of a facet. see https://www.mongodb.com/docs/atlas/atlas-search/facet/
|
3
|
+
export interface StringFacet {
|
4
|
+
type: "string",
|
5
|
+
path: string,
|
6
|
+
numBuckets?: number,
|
7
|
+
}
|
8
|
+
|
9
|
+
export interface NumericFacet {
|
10
|
+
type: "number",
|
11
|
+
path: string,
|
12
|
+
boundaries: number[],
|
13
|
+
default?: string
|
14
|
+
}
|
15
|
+
|
16
|
+
export interface DateFacet<T extends (Date | string) = string> {
|
17
|
+
type: "date",
|
18
|
+
path: string,
|
19
|
+
boundaries: T[], // array of dates
|
20
|
+
default?: string
|
21
|
+
}
|
22
|
+
|
23
|
+
export type Facet<DateT extends (Date | string) = string> = StringFacet | NumericFacet | DateFacet<DateT>;
|
24
|
+
|
25
|
+
|
26
|
+
export interface FacetSpec {
|
27
|
+
name: string;
|
28
|
+
field: string;
|
29
|
+
}
|
30
|
+
|
31
|
+
export interface FacetBucket {
|
32
|
+
_id: string,
|
33
|
+
count: number,
|
34
|
+
}
|
35
|
+
|
36
|
+
export interface FacetNameBucket {
|
37
|
+
name: string,
|
38
|
+
_id: string,
|
39
|
+
count: number,
|
40
|
+
}
|
41
|
+
|
42
|
+
export interface FacetResult {
|
43
|
+
buckets: FacetBucket[]
|
44
|
+
}
|
package/src/index.ts
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
export * from './access-control.js';
|
2
|
+
export * from './analytics.js';
|
3
|
+
export * from './apikey.js';
|
4
|
+
export * from './common.js';
|
5
|
+
export * from './environment.js';
|
6
|
+
export * from "./facets.js";
|
7
|
+
export * from './integrations.js';
|
8
|
+
export * from './interaction.js';
|
9
|
+
export * from './payload.js';
|
10
|
+
export * from './project.js';
|
11
|
+
export * from './prompt.js';
|
12
|
+
export * from './query.js';
|
13
|
+
export * from './refs.js';
|
14
|
+
export * from './runs.js';
|
15
|
+
export * from "./store/index.js";
|
16
|
+
export * from "./training.js";
|
17
|
+
export * from './transient-tokens.js';
|
18
|
+
export * from './user.js';
|
19
|
+
export * from './utils/auth.js';
|
20
|
+
export * from './utils/schemas.js';
|
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
export interface IntegrationConfigurationBase {
|
4
|
+
enabled: boolean;
|
5
|
+
}
|
6
|
+
|
7
|
+
export interface GladiaConfiguration extends IntegrationConfigurationBase {
|
8
|
+
api_key: string;
|
9
|
+
url?: string;
|
10
|
+
}
|
11
|
+
|
12
|
+
|
13
|
+
export interface GithubConfiguration extends IntegrationConfigurationBase {
|
14
|
+
allowed_repositories: string[];
|
15
|
+
}
|
16
|
+
|
17
|
+
export interface AwsConfiguration extends IntegrationConfigurationBase {
|
18
|
+
s3_role_arn: string;
|
19
|
+
}
|
20
|
+
|
21
|
+
export enum SupportedIntegrations {
|
22
|
+
gladia = "gladia",
|
23
|
+
github = "github",
|
24
|
+
aws = "aws"
|
25
|
+
}
|