@vertesia/common 0.51.0 → 0.54.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/package.json +3 -3
- package/src/apikey.ts +1 -1
- package/src/common.ts +3 -0
- package/src/index.ts +1 -1
- package/src/integrations.ts +1 -1
- package/src/interaction.ts +263 -40
- package/src/meters.ts +9 -3
- package/src/payload.ts +15 -3
- package/src/plugin.ts +12 -0
- package/src/project.ts +8 -0
- package/src/prompt.ts +1 -1
- package/src/query.ts +5 -3
- package/src/runs.ts +11 -2
- package/src/store/activity-catalog.ts +2 -2
- package/src/store/agent.ts +1 -1
- package/src/store/collections.ts +9 -3
- package/src/store/common.ts +21 -1
- package/src/store/doc-analyzer.ts +80 -20
- package/src/store/dsl-workflow.ts +9 -9
- package/src/store/index.ts +1 -0
- package/src/store/signals.ts +5 -0
- package/src/store/store.ts +118 -52
- package/src/store/workflow.ts +173 -67
- package/src/user.ts +0 -2
- package/src/utils/schemas.ts +18 -1
- package/lib/cjs/Progress.js +0 -61
- package/lib/cjs/Progress.js.map +0 -1
- package/lib/cjs/access-control.js +0 -39
- package/lib/cjs/access-control.js.map +0 -1
- package/lib/cjs/analytics.js +0 -3
- package/lib/cjs/analytics.js.map +0 -1
- package/lib/cjs/apikey.js +0 -15
- package/lib/cjs/apikey.js.map +0 -1
- package/lib/cjs/common.js +0 -3
- package/lib/cjs/common.js.map +0 -1
- package/lib/cjs/environment.js +0 -116
- package/lib/cjs/environment.js.map +0 -1
- package/lib/cjs/facets.js +0 -3
- package/lib/cjs/facets.js.map +0 -1
- package/lib/cjs/index.js +0 -40
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/integrations.js +0 -11
- package/lib/cjs/integrations.js.map +0 -1
- package/lib/cjs/interaction.js +0 -63
- package/lib/cjs/interaction.js.map +0 -1
- package/lib/cjs/meters.js +0 -13
- package/lib/cjs/meters.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/payload.js +0 -3
- package/lib/cjs/payload.js.map +0 -1
- package/lib/cjs/project.js +0 -50
- package/lib/cjs/project.js.map +0 -1
- package/lib/cjs/prompt.js +0 -21
- package/lib/cjs/prompt.js.map +0 -1
- package/lib/cjs/query.js +0 -3
- package/lib/cjs/query.js.map +0 -1
- package/lib/cjs/refs.js +0 -12
- package/lib/cjs/refs.js.map +0 -1
- package/lib/cjs/runs.js +0 -3
- package/lib/cjs/runs.js.map +0 -1
- package/lib/cjs/store/activity-catalog.js +0 -3
- package/lib/cjs/store/activity-catalog.js.map +0 -1
- package/lib/cjs/store/agent.js +0 -3
- package/lib/cjs/store/agent.js.map +0 -1
- package/lib/cjs/store/collections.js +0 -9
- package/lib/cjs/store/collections.js.map +0 -1
- package/lib/cjs/store/common.js +0 -3
- package/lib/cjs/store/common.js.map +0 -1
- package/lib/cjs/store/doc-analyzer.js +0 -3
- package/lib/cjs/store/doc-analyzer.js.map +0 -1
- package/lib/cjs/store/dsl-workflow.js +0 -5
- package/lib/cjs/store/dsl-workflow.js.map +0 -1
- package/lib/cjs/store/index.js +0 -27
- package/lib/cjs/store/index.js.map +0 -1
- package/lib/cjs/store/object-types.js +0 -98
- package/lib/cjs/store/object-types.js.map +0 -1
- package/lib/cjs/store/store.js +0 -18
- package/lib/cjs/store/store.js.map +0 -1
- package/lib/cjs/store/temporalio.js +0 -44
- package/lib/cjs/store/temporalio.js.map +0 -1
- package/lib/cjs/store/workflow.js +0 -24
- package/lib/cjs/store/workflow.js.map +0 -1
- package/lib/cjs/training.js +0 -14
- package/lib/cjs/training.js.map +0 -1
- package/lib/cjs/transient-tokens.js +0 -9
- package/lib/cjs/transient-tokens.js.map +0 -1
- package/lib/cjs/user.js +0 -17
- package/lib/cjs/user.js.map +0 -1
- package/lib/cjs/utils/advanced-content-processing.js +0 -25
- package/lib/cjs/utils/advanced-content-processing.js.map +0 -1
- package/lib/cjs/utils/auth.js +0 -15
- package/lib/cjs/utils/auth.js.map +0 -1
- package/lib/cjs/utils/schemas.js +0 -48
- package/lib/cjs/utils/schemas.js.map +0 -1
- package/lib/esm/Progress.js +0 -57
- package/lib/esm/Progress.js.map +0 -1
- package/lib/esm/access-control.js +0 -36
- package/lib/esm/access-control.js.map +0 -1
- package/lib/esm/analytics.js +0 -2
- package/lib/esm/analytics.js.map +0 -1
- package/lib/esm/apikey.js +0 -12
- package/lib/esm/apikey.js.map +0 -1
- package/lib/esm/common.js +0 -2
- package/lib/esm/common.js.map +0 -1
- package/lib/esm/environment.js +0 -113
- package/lib/esm/environment.js.map +0 -1
- package/lib/esm/facets.js +0 -2
- package/lib/esm/facets.js.map +0 -1
- package/lib/esm/index.js +0 -24
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/integrations.js +0 -8
- package/lib/esm/integrations.js.map +0 -1
- package/lib/esm/interaction.js +0 -60
- package/lib/esm/interaction.js.map +0 -1
- package/lib/esm/meters.js +0 -10
- package/lib/esm/meters.js.map +0 -1
- package/lib/esm/payload.js +0 -2
- package/lib/esm/payload.js.map +0 -1
- package/lib/esm/project.js +0 -46
- package/lib/esm/project.js.map +0 -1
- package/lib/esm/prompt.js +0 -18
- package/lib/esm/prompt.js.map +0 -1
- package/lib/esm/query.js +0 -2
- package/lib/esm/query.js.map +0 -1
- package/lib/esm/refs.js +0 -9
- package/lib/esm/refs.js.map +0 -1
- package/lib/esm/runs.js +0 -2
- package/lib/esm/runs.js.map +0 -1
- package/lib/esm/store/activity-catalog.js +0 -2
- package/lib/esm/store/activity-catalog.js.map +0 -1
- package/lib/esm/store/agent.js +0 -2
- package/lib/esm/store/agent.js.map +0 -1
- package/lib/esm/store/collections.js +0 -6
- package/lib/esm/store/collections.js.map +0 -1
- package/lib/esm/store/common.js +0 -2
- package/lib/esm/store/common.js.map +0 -1
- package/lib/esm/store/doc-analyzer.js +0 -2
- package/lib/esm/store/doc-analyzer.js.map +0 -1
- package/lib/esm/store/dsl-workflow.js +0 -2
- package/lib/esm/store/dsl-workflow.js.map +0 -1
- package/lib/esm/store/index.js +0 -11
- package/lib/esm/store/index.js.map +0 -1
- package/lib/esm/store/object-types.js +0 -95
- package/lib/esm/store/object-types.js.map +0 -1
- package/lib/esm/store/store.js +0 -15
- package/lib/esm/store/store.js.map +0 -1
- package/lib/esm/store/temporalio.js +0 -41
- package/lib/esm/store/temporalio.js.map +0 -1
- package/lib/esm/store/workflow.js +0 -21
- package/lib/esm/store/workflow.js.map +0 -1
- package/lib/esm/training.js +0 -11
- package/lib/esm/training.js.map +0 -1
- package/lib/esm/transient-tokens.js +0 -6
- package/lib/esm/transient-tokens.js.map +0 -1
- package/lib/esm/user.js +0 -14
- package/lib/esm/user.js.map +0 -1
- package/lib/esm/utils/advanced-content-processing.js +0 -19
- package/lib/esm/utils/advanced-content-processing.js.map +0 -1
- package/lib/esm/utils/auth.js +0 -11
- package/lib/esm/utils/auth.js.map +0 -1
- package/lib/esm/utils/schemas.js +0 -44
- package/lib/esm/utils/schemas.js.map +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/lib/types/Progress.d.ts +0 -22
- package/lib/types/Progress.d.ts.map +0 -1
- package/lib/types/access-control.d.ts +0 -57
- package/lib/types/access-control.d.ts.map +0 -1
- package/lib/types/analytics.d.ts +0 -37
- package/lib/types/analytics.d.ts.map +0 -1
- package/lib/types/apikey.d.ts +0 -55
- package/lib/types/apikey.d.ts.map +0 -1
- package/lib/types/common.d.ts +0 -29
- package/lib/types/common.d.ts.map +0 -1
- package/lib/types/environment.d.ts +0 -81
- package/lib/types/environment.d.ts.map +0 -1
- package/lib/types/facets.d.ts +0 -35
- package/lib/types/facets.d.ts.map +0 -1
- package/lib/types/index.d.ts +0 -24
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/integrations.d.ts +0 -24
- package/lib/types/integrations.d.ts.map +0 -1
- package/lib/types/interaction.d.ts +0 -230
- package/lib/types/interaction.d.ts.map +0 -1
- package/lib/types/meters.d.ts +0 -17
- package/lib/types/meters.d.ts.map +0 -1
- package/lib/types/payload.d.ts +0 -50
- package/lib/types/payload.d.ts.map +0 -1
- package/lib/types/project.d.ts +0 -96
- package/lib/types/project.d.ts.map +0 -1
- package/lib/types/prompt.d.ts +0 -71
- package/lib/types/prompt.d.ts.map +0 -1
- package/lib/types/query.d.ts +0 -77
- package/lib/types/query.d.ts.map +0 -1
- package/lib/types/refs.d.ts +0 -20
- package/lib/types/refs.d.ts.map +0 -1
- package/lib/types/runs.d.ts +0 -25
- package/lib/types/runs.d.ts.map +0 -1
- package/lib/types/store/activity-catalog.d.ts +0 -27
- package/lib/types/store/activity-catalog.d.ts.map +0 -1
- package/lib/types/store/agent.d.ts +0 -19
- package/lib/types/store/agent.d.ts.map +0 -1
- package/lib/types/store/collections.d.ts +0 -55
- package/lib/types/store/collections.d.ts.map +0 -1
- package/lib/types/store/common.d.ts +0 -11
- package/lib/types/store/common.d.ts.map +0 -1
- package/lib/types/store/doc-analyzer.d.ts +0 -84
- package/lib/types/store/doc-analyzer.d.ts.map +0 -1
- package/lib/types/store/dsl-workflow.d.ts +0 -239
- package/lib/types/store/dsl-workflow.d.ts.map +0 -1
- package/lib/types/store/index.d.ts +0 -11
- package/lib/types/store/index.d.ts.map +0 -1
- package/lib/types/store/object-types.d.ts +0 -24
- package/lib/types/store/object-types.d.ts.map +0 -1
- package/lib/types/store/store.d.ts +0 -211
- package/lib/types/store/store.d.ts.map +0 -1
- package/lib/types/store/temporalio.d.ts +0 -17
- package/lib/types/store/temporalio.d.ts.map +0 -1
- package/lib/types/store/workflow.d.ts +0 -147
- package/lib/types/store/workflow.d.ts.map +0 -1
- package/lib/types/training.d.ts +0 -39
- package/lib/types/training.d.ts.map +0 -1
- package/lib/types/transient-tokens.d.ts +0 -28
- package/lib/types/transient-tokens.d.ts.map +0 -1
- package/lib/types/user.d.ts +0 -116
- package/lib/types/user.d.ts.map +0 -1
- package/lib/types/utils/advanced-content-processing.d.ts +0 -16
- package/lib/types/utils/advanced-content-processing.d.ts.map +0 -1
- package/lib/types/utils/auth.d.ts +0 -4
- package/lib/types/utils/auth.d.ts.map +0 -1
- package/lib/types/utils/schemas.d.ts +0 -6
- package/lib/types/utils/schemas.d.ts.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vertesia/common",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.54.0",
|
4
4
|
"type": "module",
|
5
5
|
"types": "./lib/types/index.d.ts",
|
6
6
|
"files": [
|
@@ -16,13 +16,13 @@
|
|
16
16
|
"@types/json-schema": "^7.0.15",
|
17
17
|
"ts-dual-module": "^0.6.3",
|
18
18
|
"typescript": "^5.0.2",
|
19
|
-
"vitest": "^
|
19
|
+
"vitest": "^3.0.9"
|
20
20
|
},
|
21
21
|
"dependencies": {
|
22
22
|
"ajv": "^8.16.0",
|
23
23
|
"json-schema": "^0.4.0",
|
24
24
|
"mime": "^4.0.4",
|
25
|
-
"@llumiverse/core": "0.
|
25
|
+
"@llumiverse/core": "0.17.0"
|
26
26
|
},
|
27
27
|
"ts_dual_module": {
|
28
28
|
"outDir": "lib"
|
package/src/apikey.ts
CHANGED
package/src/common.ts
CHANGED
package/src/index.ts
CHANGED
@@ -8,6 +8,7 @@ export * from './integrations.js';
|
|
8
8
|
export * from './interaction.js';
|
9
9
|
export * from './meters.js';
|
10
10
|
export * from './payload.js';
|
11
|
+
export * from "./plugin.js";
|
11
12
|
export * from "./Progress.js";
|
12
13
|
export * from './project.js';
|
13
14
|
export * from './prompt.js';
|
@@ -21,4 +22,3 @@ export * from './user.js';
|
|
21
22
|
export * from './utils/advanced-content-processing.js';
|
22
23
|
export * from './utils/auth.js';
|
23
24
|
export * from './utils/schemas.js';
|
24
|
-
|
package/src/integrations.ts
CHANGED
@@ -18,7 +18,7 @@ export interface AwsConfiguration extends IntegrationConfigurationBase {
|
|
18
18
|
s3_role_arn: string;
|
19
19
|
}
|
20
20
|
|
21
|
-
export interface
|
21
|
+
export interface MagicPdfConfiguration extends IntegrationConfigurationBase {
|
22
22
|
// No additional configuration
|
23
23
|
default_features?: string[];
|
24
24
|
default_zones?: string[];
|
package/src/interaction.ts
CHANGED
@@ -1,12 +1,26 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
import type {
|
2
|
+
JSONObject,
|
3
|
+
JSONSchema,
|
4
|
+
Modalities,
|
5
|
+
ModelOptions,
|
6
|
+
StatelessExecutionOptions,
|
7
|
+
ToolDefinition,
|
8
|
+
ToolUse,
|
9
|
+
} from "@llumiverse/core";
|
10
|
+
import { JSONSchema4 } from "json-schema";
|
11
|
+
|
12
|
+
import { ExecutionTokenUsage } from "@llumiverse/core";
|
13
|
+
|
14
|
+
import { ExecutionEnvironmentRef } from "./environment.js";
|
15
|
+
import { ProjectRef } from "./project.js";
|
16
|
+
import {
|
17
|
+
PopulatedPromptSegmentDef,
|
18
|
+
PromptSegmentDef,
|
19
|
+
PromptTemplateRef,
|
20
|
+
PromptTemplateRefWithSchema,
|
21
|
+
} from "./prompt.js";
|
22
|
+
import { ExecutionRunDocRef } from "./runs.js";
|
23
|
+
import { AccountRef } from "./user.js";
|
10
24
|
|
11
25
|
export interface InteractionExecutionError {
|
12
26
|
code: string;
|
@@ -14,9 +28,63 @@ export interface InteractionExecutionError {
|
|
14
28
|
data?: any;
|
15
29
|
}
|
16
30
|
|
31
|
+
/**
|
32
|
+
* The payload to query the interaction endpoints
|
33
|
+
*/
|
34
|
+
export interface InteractionEndpointQuery {
|
35
|
+
limit?: number;
|
36
|
+
offset?: number;
|
37
|
+
|
38
|
+
status?: InteractionStatus;
|
39
|
+
visibility?: InteractionVisibility;
|
40
|
+
version?: number;
|
41
|
+
tags?: string[];
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Filter by interaction endpoint name to include only the specified endpoints
|
45
|
+
* * If both includes and excludes are specified then only the includes filter will be used.
|
46
|
+
*/
|
47
|
+
includes?: string[];
|
48
|
+
|
49
|
+
/**
|
50
|
+
* Filter by interaction endpoint name to excludes the specified endpoints.
|
51
|
+
* If both includes and excludes are specified then only the includes filter will be used.
|
52
|
+
*/
|
53
|
+
excludes?: string[];
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Whether or not to return the parameters schema.
|
57
|
+
* The parameters schema is an array of JSON schemas.
|
58
|
+
* Each schema is a JSON schema that describes the parameters of an interaction prompt.
|
59
|
+
*/
|
60
|
+
include_params_schema?: boolean;
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Whether or not to return the result schema
|
64
|
+
*/
|
65
|
+
include_result_schema?: boolean;
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* A description of an interaction endpoint.
|
70
|
+
*/
|
71
|
+
export interface InteractionEndpoint {
|
72
|
+
id: string;
|
73
|
+
name: string;
|
74
|
+
endpoint: string;
|
75
|
+
description?: string;
|
76
|
+
status: InteractionStatus;
|
77
|
+
visibility?: InteractionVisibility;
|
78
|
+
version: number;
|
79
|
+
tags: string[];
|
80
|
+
result_schema?: JSONSchema;
|
81
|
+
params_schema?: JSONSchema;
|
82
|
+
}
|
83
|
+
|
17
84
|
export interface InteractionRef {
|
18
85
|
id: string;
|
19
86
|
name: string;
|
87
|
+
endpoint: string;
|
20
88
|
parent?: string;
|
21
89
|
description?: string;
|
22
90
|
status: InteractionStatus;
|
@@ -26,17 +94,17 @@ export interface InteractionRef {
|
|
26
94
|
prompts?: PromptSegmentDef<PromptTemplateRef>[];
|
27
95
|
updated_at: Date;
|
28
96
|
}
|
29
|
-
export const InteractionRefPopulate =
|
97
|
+
export const InteractionRefPopulate =
|
98
|
+
"id name endpoint parent description status version visibility tags updated_at prompts";
|
30
99
|
|
31
|
-
export interface InteractionRefWithSchema
|
32
|
-
extends Omit<InteractionRef, "prompts"> {
|
100
|
+
export interface InteractionRefWithSchema extends Omit<InteractionRef, "prompts"> {
|
33
101
|
result_schema?: JSONSchema4;
|
34
102
|
prompts?: PromptSegmentDef<PromptTemplateRefWithSchema>[];
|
35
103
|
}
|
36
104
|
|
37
105
|
export interface InteractionsExportPayload {
|
38
106
|
/**
|
39
|
-
* The name of the interaction. If not
|
107
|
+
* The name of the interaction. If not specified all the interactions in the current project will be exported
|
40
108
|
*/
|
41
109
|
name?: string;
|
42
110
|
/*
|
@@ -46,7 +114,7 @@ export interface InteractionsExportPayload {
|
|
46
114
|
/*
|
47
115
|
* if not specified, all versions will be exported
|
48
116
|
*/
|
49
|
-
versions?: (number |
|
117
|
+
versions?: (number | "draft" | "latest")[];
|
50
118
|
}
|
51
119
|
|
52
120
|
export enum InteractionStatus {
|
@@ -65,20 +133,20 @@ export enum ExecutionRunStatus {
|
|
65
133
|
export enum RunDataStorageLevel {
|
66
134
|
STANDARD = "STANDARD",
|
67
135
|
RESTRICTED = "RESTRICTED",
|
68
|
-
DEBUG = "DEBUG"
|
136
|
+
DEBUG = "DEBUG",
|
69
137
|
}
|
70
138
|
|
71
139
|
export enum RunDataStorageDescription {
|
72
140
|
STANDARD = "Run data is stored for both the model inputs and output.",
|
73
141
|
RESTRICTED = "No run data is stored for the model inputs — only the model output.",
|
74
|
-
DEBUG = "Run data is stored for the model inputs and output, schema, and final prompt."
|
142
|
+
DEBUG = "Run data is stored for the model inputs and output, schema, and final prompt.",
|
75
143
|
}
|
76
144
|
|
77
145
|
export const RunDataStorageOptions: Record<RunDataStorageLevel, RunDataStorageDescription> = {
|
78
146
|
[RunDataStorageLevel.STANDARD]: RunDataStorageDescription.STANDARD,
|
79
147
|
[RunDataStorageLevel.RESTRICTED]: RunDataStorageDescription.RESTRICTED,
|
80
148
|
[RunDataStorageLevel.DEBUG]: RunDataStorageDescription.DEBUG,
|
81
|
-
}
|
149
|
+
};
|
82
150
|
|
83
151
|
/**
|
84
152
|
* Schema can be stored or specified as a reference to an external schema.
|
@@ -93,7 +161,7 @@ export interface CachePolicy {
|
|
93
161
|
varies_on: string[];
|
94
162
|
ttl: number;
|
95
163
|
}
|
96
|
-
export type InteractionVisibility =
|
164
|
+
export type InteractionVisibility = "public" | "private";
|
97
165
|
export interface Interaction {
|
98
166
|
readonly id: string;
|
99
167
|
name: string;
|
@@ -118,21 +186,31 @@ export interface Interaction {
|
|
118
186
|
project: string | ProjectRef;
|
119
187
|
// only for drafts - when it was last published
|
120
188
|
last_published_at?: Date;
|
121
|
-
created_by: string
|
122
|
-
updated_by: string
|
189
|
+
created_by: string;
|
190
|
+
updated_by: string;
|
123
191
|
created_at: Date;
|
124
192
|
updated_at: Date;
|
125
193
|
}
|
126
194
|
|
127
|
-
export interface PopulatedInteraction
|
128
|
-
extends Omit<Interaction, "prompts"> {
|
195
|
+
export interface PopulatedInteraction extends Omit<Interaction, "prompts"> {
|
129
196
|
prompts: PopulatedPromptSegmentDef[];
|
130
197
|
}
|
131
198
|
|
132
199
|
export interface InteractionCreatePayload
|
133
200
|
extends Omit<
|
134
201
|
Interaction,
|
135
|
-
|
202
|
+
| "id"
|
203
|
+
| "created_at"
|
204
|
+
| "updated_at"
|
205
|
+
| "created_by"
|
206
|
+
| "updated_by"
|
207
|
+
| "project"
|
208
|
+
| "formatter"
|
209
|
+
| "tags"
|
210
|
+
| "parent"
|
211
|
+
| "version"
|
212
|
+
| "visibility"
|
213
|
+
| "endpoint"
|
136
214
|
> {
|
137
215
|
visibility?: InteractionVisibility;
|
138
216
|
}
|
@@ -158,11 +236,10 @@ export interface InteractionForkPayload {
|
|
158
236
|
targetProject?: string;
|
159
237
|
}
|
160
238
|
|
161
|
-
|
162
239
|
export interface InteractionExecutionPayload {
|
163
240
|
/**
|
164
241
|
* If a `@memory` property exists on the input data then the value will be used as the value of a memory pack location.
|
165
|
-
* and the other
|
242
|
+
* and the other properties of the data will contain the memory pack mapping.
|
166
243
|
*/
|
167
244
|
data?: Record<string, any> | `memory:${string}`;
|
168
245
|
config?: InteractionExecutionConfiguration;
|
@@ -170,6 +247,20 @@ export interface InteractionExecutionPayload {
|
|
170
247
|
stream?: boolean;
|
171
248
|
do_validate?: boolean;
|
172
249
|
tags?: string | string[]; // tags to be added to the execution run
|
250
|
+
|
251
|
+
/**
|
252
|
+
* The conversation state to be used in the execution if any.
|
253
|
+
* If the `true` is passed then the conversation will be returned in the result.
|
254
|
+
* The true value must be used for the first execution that starts the conversation.
|
255
|
+
* If conversation is falsy then no conversation is returned back.
|
256
|
+
* For regular executions the conversation is not returned back to save memory.
|
257
|
+
*/
|
258
|
+
conversation?: true | unknown;
|
259
|
+
|
260
|
+
/**
|
261
|
+
* The tools to be used in the execution
|
262
|
+
*/
|
263
|
+
tools?: ToolDefinition[];
|
173
264
|
}
|
174
265
|
|
175
266
|
export interface NamedInteractionExecutionPayload extends InteractionExecutionPayload {
|
@@ -181,6 +272,133 @@ export interface NamedInteractionExecutionPayload extends InteractionExecutionPa
|
|
181
272
|
interaction: string;
|
182
273
|
}
|
183
274
|
|
275
|
+
// ================= async execution payloads ====================
|
276
|
+
export type ToolRef = string | { name: string; description: string };
|
277
|
+
|
278
|
+
interface AsyncExecutionPayloadBase {
|
279
|
+
type: "conversation" | "interaction";
|
280
|
+
|
281
|
+
/**
|
282
|
+
* The interaction endpoint to execute to start the conversation.
|
283
|
+
*/
|
284
|
+
interaction: string;
|
285
|
+
|
286
|
+
/**
|
287
|
+
* The environment ID to use.
|
288
|
+
*/
|
289
|
+
environment?: string;
|
290
|
+
|
291
|
+
/**
|
292
|
+
* The model to use
|
293
|
+
*/
|
294
|
+
model?: string;
|
295
|
+
|
296
|
+
/**
|
297
|
+
* The options to use on the first execution
|
298
|
+
*/
|
299
|
+
model_options?: ModelOptions;
|
300
|
+
|
301
|
+
/**
|
302
|
+
* The initial prompt input data
|
303
|
+
*/
|
304
|
+
prompt_data?: Record<string, any>;
|
305
|
+
|
306
|
+
/**
|
307
|
+
* Optional result schema
|
308
|
+
*/
|
309
|
+
result_schema?: JSONSchema;
|
310
|
+
|
311
|
+
/**
|
312
|
+
* Optional tags to add to the execution run
|
313
|
+
*/
|
314
|
+
tags?: string[];
|
315
|
+
}
|
316
|
+
|
317
|
+
export interface AsyncConversationExecutionPayload extends AsyncExecutionPayloadBase {
|
318
|
+
type: "conversation";
|
319
|
+
|
320
|
+
/**
|
321
|
+
* The tools to use
|
322
|
+
*/
|
323
|
+
tools?: ToolRef[];
|
324
|
+
|
325
|
+
/**
|
326
|
+
* The maximum number of iterations in case of a conversation. If <=0 the default of 20 will be used.
|
327
|
+
*/
|
328
|
+
max_iterations?: number;
|
329
|
+
|
330
|
+
/**
|
331
|
+
* Whether the conversation should be interactive or not
|
332
|
+
*/
|
333
|
+
interactive?: boolean;
|
334
|
+
|
335
|
+
/**
|
336
|
+
* Whether to disable the generation of interaction tools or not.
|
337
|
+
*/
|
338
|
+
disable_interaction_tools?: boolean;
|
339
|
+
|
340
|
+
/**
|
341
|
+
* On which scope should the searched by applied, by the search_tool.
|
342
|
+
* Only supports collection scope or null for now.
|
343
|
+
*/
|
344
|
+
search_scope?: string;
|
345
|
+
|
346
|
+
/**
|
347
|
+
* The collection in which this workflow is executing
|
348
|
+
*/
|
349
|
+
collection_id?: string;
|
350
|
+
|
351
|
+
/**
|
352
|
+
* The token threshold in thousands (K) for creating checkpoints.
|
353
|
+
* If total tokens exceed this value, a checkpoint will be created.
|
354
|
+
* If not specified, default value of 150K tokens will be used.
|
355
|
+
*/
|
356
|
+
checkpoint_tokens?: number;
|
357
|
+
}
|
358
|
+
|
359
|
+
export interface AsyncInteractionExecutionPayload extends AsyncExecutionPayloadBase {
|
360
|
+
type: "interaction";
|
361
|
+
|
362
|
+
/**
|
363
|
+
* The tools to use
|
364
|
+
*/
|
365
|
+
tools?: ToolDefinition[];
|
366
|
+
|
367
|
+
/**
|
368
|
+
* Only used for non conversation workflows to include the error on next retry.
|
369
|
+
* If tools is defined this is not used
|
370
|
+
*/
|
371
|
+
include_previous_error?: boolean;
|
372
|
+
}
|
373
|
+
|
374
|
+
export type AsyncExecutionPayload = AsyncConversationExecutionPayload | AsyncInteractionExecutionPayload;
|
375
|
+
|
376
|
+
interface ResumeConversationPayload {
|
377
|
+
run: ExecutionRunDocRef; // the run created by the first execution.
|
378
|
+
environment: string; // the environment ID
|
379
|
+
options: StatelessExecutionOptions; // the options used on the first execution
|
380
|
+
conversation: unknown; // the conversation state
|
381
|
+
tools: ToolDefinition[]; // the tools to be used
|
382
|
+
}
|
383
|
+
|
384
|
+
/**
|
385
|
+
* The payload to sent the tool responses back to the target LLM
|
386
|
+
*/
|
387
|
+
export interface ToolResultsPayload extends ResumeConversationPayload {
|
388
|
+
results: {
|
389
|
+
tool_use_id: string;
|
390
|
+
content: string;
|
391
|
+
}[];
|
392
|
+
}
|
393
|
+
|
394
|
+
export interface UserMessagePayload extends ResumeConversationPayload {
|
395
|
+
message: string;
|
396
|
+
}
|
397
|
+
|
398
|
+
export type CheckpointConversationPayload = Omit<ToolResultsPayload, "results">;
|
399
|
+
|
400
|
+
// ================= end async execution payloads ====================
|
401
|
+
|
184
402
|
export enum RunSourceTypes {
|
185
403
|
api = "api",
|
186
404
|
cli = "cli",
|
@@ -193,7 +411,7 @@ export enum RunSourceTypes {
|
|
193
411
|
export interface RunSource {
|
194
412
|
type: RunSourceTypes;
|
195
413
|
label: string;
|
196
|
-
principal_type:
|
414
|
+
principal_type: "user" | "apikey";
|
197
415
|
principal_id: string;
|
198
416
|
client_ip: string;
|
199
417
|
}
|
@@ -205,15 +423,15 @@ export interface ExecutionRun<P = any, R = any> {
|
|
205
423
|
*/
|
206
424
|
parent?: string | ExecutionRun;
|
207
425
|
evaluation?: {
|
208
|
-
score?: number
|
209
|
-
selected?: boolean
|
210
|
-
scores?: Record<string, number
|
211
|
-
}
|
426
|
+
score?: number;
|
427
|
+
selected?: boolean;
|
428
|
+
scores?: Record<string, number>;
|
429
|
+
};
|
212
430
|
result: R;
|
213
431
|
/**
|
214
432
|
* The parameters used to create the interaction.
|
215
433
|
* If the parameters contains the special property "@memory" it will be used
|
216
|
-
* to locate a
|
434
|
+
* to locate a memory pack and the other properties will be used as the memory pack mapping.
|
217
435
|
*/
|
218
436
|
parameters: P; //params used to create the interaction, only in varies on?
|
219
437
|
tags?: string[];
|
@@ -238,12 +456,17 @@ export interface ExecutionRun<P = any, R = any> {
|
|
238
456
|
error?: InteractionExecutionError;
|
239
457
|
source: RunSource;
|
240
458
|
output_modality: Modalities;
|
241
|
-
created_by: string
|
242
|
-
updated_by: string
|
459
|
+
created_by: string;
|
460
|
+
updated_by: string;
|
243
461
|
}
|
244
462
|
|
245
|
-
export interface
|
246
|
-
|
463
|
+
export interface InteractionExecutionResult<P = any, R = any> extends ExecutionRun<P, R> {
|
464
|
+
tool_use?: ToolUse[];
|
465
|
+
conversation?: unknown;
|
466
|
+
options?: StatelessExecutionOptions;
|
467
|
+
}
|
468
|
+
|
469
|
+
export interface ExecutionRunRef extends Omit<ExecutionRun, "result" | "parameters" | "interaction"> {
|
247
470
|
interaction: InteractionRef;
|
248
471
|
}
|
249
472
|
|
@@ -252,20 +475,20 @@ export const ExecutionRunRefSelect = "-result -parameters -result_schema -prompt
|
|
252
475
|
export enum ConfigModes {
|
253
476
|
RUN_AND_INTERACTION_CONFIG = "RUN_AND_INTERACTION_CONFIG",
|
254
477
|
RUN_CONFIG_ONLY = "RUN_CONFIG_ONLY",
|
255
|
-
INTERACTION_CONFIG_ONLY = "INTERACTION_CONFIG_ONLY"
|
256
|
-
}
|
478
|
+
INTERACTION_CONFIG_ONLY = "INTERACTION_CONFIG_ONLY",
|
479
|
+
}
|
257
480
|
|
258
481
|
export enum ConfigModesDescription {
|
259
482
|
RUN_AND_INTERACTION_CONFIG = "This run configuration is used. Undefined options are filled with interaction configuration.",
|
260
483
|
RUN_CONFIG_ONLY = "Only this run configuration is used. Undefined options remain undefined.",
|
261
|
-
INTERACTION_CONFIG_ONLY = "Only interaction configuration is used."
|
484
|
+
INTERACTION_CONFIG_ONLY = "Only interaction configuration is used.",
|
262
485
|
}
|
263
486
|
|
264
487
|
export const ConfigModesOptions: Record<ConfigModes, ConfigModesDescription> = {
|
265
488
|
[ConfigModes.RUN_AND_INTERACTION_CONFIG]: ConfigModesDescription.RUN_AND_INTERACTION_CONFIG,
|
266
489
|
[ConfigModes.RUN_CONFIG_ONLY]: ConfigModesDescription.RUN_CONFIG_ONLY,
|
267
490
|
[ConfigModes.INTERACTION_CONFIG_ONLY]: ConfigModesDescription.INTERACTION_CONFIG_ONLY,
|
268
|
-
}
|
491
|
+
};
|
269
492
|
|
270
493
|
export interface InteractionExecutionConfiguration {
|
271
494
|
environment?: string;
|
@@ -289,4 +512,4 @@ export interface GenerateTestDataPayload {
|
|
289
512
|
|
290
513
|
export interface ImprovePromptPayload {
|
291
514
|
config: InteractionExecutionConfiguration;
|
292
|
-
}
|
515
|
+
}
|
package/src/meters.ts
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
import { BillingMethod } from "./user.js";
|
4
2
|
|
5
3
|
|
6
4
|
export interface MeterAdjustment {
|
@@ -21,4 +19,12 @@ export enum MeterNames {
|
|
21
19
|
input_token_used = 'input_token_used',
|
22
20
|
output_token_used = 'output_token_used',
|
23
21
|
task_run = 'task_run',
|
22
|
+
}
|
23
|
+
|
24
|
+
|
25
|
+
export interface StripeBillingStatusResponse {
|
26
|
+
status: 'enabled' | 'disabled',
|
27
|
+
billing_method: BillingMethod | null,
|
28
|
+
portal_url?: string,
|
29
|
+
reason?: string
|
24
30
|
}
|
package/src/payload.ts
CHANGED
@@ -1,10 +1,22 @@
|
|
1
|
-
import { FacetSpec } from
|
2
|
-
import {
|
1
|
+
import { FacetSpec } from "./facets.js";
|
2
|
+
import {
|
3
|
+
ComplexSearchQuery,
|
4
|
+
InteractionSearchQuery,
|
5
|
+
ObjectSearchQuery,
|
6
|
+
ObjectTypeSearchQuery,
|
7
|
+
PromptSearchQuery,
|
8
|
+
RunSearchQuery,
|
9
|
+
SimpleSearchQuery,
|
10
|
+
VectorSearchQuery,
|
11
|
+
} from "./query.js";
|
3
12
|
|
4
13
|
export interface SearchPayload {
|
5
14
|
query?: SimpleSearchQuery;
|
6
15
|
limit?: number;
|
7
16
|
offset?: number;
|
17
|
+
select?: string;
|
18
|
+
show_all_revisions?: boolean;
|
19
|
+
from_root?: string;
|
8
20
|
}
|
9
21
|
|
10
22
|
export interface ComputeFacetPayload {
|
@@ -59,4 +71,4 @@ export interface ExportPropertiesResponse {
|
|
59
71
|
type: string;
|
60
72
|
name: string;
|
61
73
|
data: Blob;
|
62
|
-
}
|
74
|
+
}
|
package/src/plugin.ts
ADDED
package/src/project.ts
CHANGED
@@ -5,6 +5,7 @@ export interface ICreateProjectPayload {
|
|
5
5
|
name: string;
|
6
6
|
namespace: string;
|
7
7
|
description?: string;
|
8
|
+
auto_config?: boolean;
|
8
9
|
}
|
9
10
|
export enum ProjectRoles {
|
10
11
|
owner = "owner", // all permissions
|
@@ -43,6 +44,12 @@ export interface ProjectRef {
|
|
43
44
|
id: string;
|
44
45
|
name: string;
|
45
46
|
account: string;
|
47
|
+
/**
|
48
|
+
* Only set when fetching the list of projects visible to an user which is an org admin or owner.
|
49
|
+
* If present and true, it means that the project is not accessible to the user.(even if it visible in listing)
|
50
|
+
* If not present or false then the project is accessible to the user.
|
51
|
+
*/
|
52
|
+
restricted?: boolean;
|
46
53
|
}
|
47
54
|
|
48
55
|
export enum ResourceVisibility {
|
@@ -99,6 +106,7 @@ export interface Project {
|
|
99
106
|
account: string;
|
100
107
|
configuration: ProjectConfiguration;
|
101
108
|
integrations: Map<string, any>;
|
109
|
+
plugins: string[];
|
102
110
|
created_by: string,
|
103
111
|
updated_by: string,
|
104
112
|
created_at: Date;
|
package/src/prompt.ts
CHANGED
@@ -68,7 +68,7 @@ export interface PromptTemplate {
|
|
68
68
|
inputSchema?: JSONSchema4;
|
69
69
|
project: string | ProjectRef; // or projectRef? ObjectIdType;
|
70
70
|
// The name of a field in the input data that is of the specified schema and on each the template will iterate.
|
71
|
-
// If not specified then the
|
71
|
+
// If not specified then the schema will define the whole input data
|
72
72
|
tags?: string[];
|
73
73
|
// only for drafts - when it was last published
|
74
74
|
last_published_at?: Date;
|
package/src/query.ts
CHANGED
@@ -3,14 +3,14 @@ import { SupportedEmbeddingTypes } from './project.js';
|
|
3
3
|
|
4
4
|
export interface RunListingQueryOptions {
|
5
5
|
project?: string;
|
6
|
-
interaction?: string;
|
6
|
+
interaction?: string | string[];
|
7
7
|
limit?: number;
|
8
8
|
offset?: number;
|
9
9
|
filters?: RunListingFilters;
|
10
10
|
}
|
11
11
|
|
12
12
|
export interface RunListingFilters {
|
13
|
-
interaction?: string,
|
13
|
+
interaction?: string | string[],
|
14
14
|
status?: ExecutionRunStatus,
|
15
15
|
model?: string,
|
16
16
|
environment?: string,
|
@@ -43,11 +43,12 @@ export interface ObjectSearchQuery extends SimpleSearchQuery {
|
|
43
43
|
}
|
44
44
|
|
45
45
|
export interface ObjectTypeSearchQuery extends SimpleSearchQuery {
|
46
|
-
|
46
|
+
chunkable?: boolean;
|
47
47
|
}
|
48
48
|
|
49
49
|
export interface PromptSearchQuery extends SimpleSearchQuery {
|
50
50
|
role?: string;
|
51
|
+
matchInteractions?: boolean;
|
51
52
|
}
|
52
53
|
|
53
54
|
export interface InteractionSearchQuery extends SimpleSearchQuery {
|
@@ -84,4 +85,5 @@ export interface WorkflowExecutionSearchQuery extends SimpleSearchQuery {
|
|
84
85
|
|
85
86
|
export interface ComplexSearchQuery extends ObjectSearchQuery {
|
86
87
|
vector?: VectorSearchQuery;
|
88
|
+
match?: Record<string, any>;
|
87
89
|
}
|
package/src/runs.ts
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
import { FacetResult } from './facets.js';
|
2
2
|
import { NamedInteractionExecutionPayload } from './interaction.js';
|
3
3
|
|
4
|
+
/**
|
5
|
+
* The run ref is used to identify a run document in the storage
|
6
|
+
*/
|
7
|
+
export interface ExecutionRunDocRef {
|
8
|
+
id: string,
|
9
|
+
account: string,
|
10
|
+
project: string,
|
11
|
+
}
|
12
|
+
|
4
13
|
/**
|
5
14
|
* Interaction execution payload for creating a new run
|
6
|
-
* It uses interaction field (from NamedInteractionExecutionPayload) to pass the
|
15
|
+
* It uses interaction field (from NamedInteractionExecutionPayload) to pass the interaction ID to run
|
7
16
|
*/
|
8
17
|
export interface RunCreatePayload extends NamedInteractionExecutionPayload {
|
9
18
|
}
|
@@ -18,7 +27,7 @@ export interface RangeValue {
|
|
18
27
|
lte?: number | string,
|
19
28
|
}
|
20
29
|
|
21
|
-
export interface
|
30
|
+
export interface RunSearchMetaResponse {
|
22
31
|
count: {
|
23
32
|
lower_bound?: number,
|
24
33
|
total?: number,
|