@vertesia/common 0.50.1 → 0.52.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/Progress.js +61 -0
- package/lib/cjs/Progress.js.map +1 -0
- package/lib/cjs/environment.js.map +1 -1
- package/lib/cjs/index.js +3 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/integrations.js +1 -0
- package/lib/cjs/integrations.js.map +1 -1
- package/lib/cjs/interaction.js +2 -2
- package/lib/cjs/interaction.js.map +1 -1
- package/lib/cjs/meters.js +13 -0
- package/lib/cjs/meters.js.map +1 -0
- package/lib/cjs/project.js.map +1 -1
- package/lib/cjs/store/collections.js +9 -0
- package/lib/cjs/store/collections.js.map +1 -0
- package/lib/cjs/store/doc-analyzer.js +3 -0
- package/lib/cjs/store/doc-analyzer.js.map +1 -0
- package/lib/cjs/store/index.js +3 -0
- package/lib/cjs/store/index.js.map +1 -1
- package/lib/cjs/store/signals.js +3 -0
- package/lib/cjs/store/signals.js.map +1 -0
- package/lib/cjs/store/store.js.map +1 -1
- package/lib/cjs/store/workflow.js +16 -1
- package/lib/cjs/store/workflow.js.map +1 -1
- package/lib/cjs/user.js +6 -1
- package/lib/cjs/user.js.map +1 -1
- package/lib/cjs/utils/advanced-content-processing.js +25 -0
- package/lib/cjs/utils/advanced-content-processing.js.map +1 -0
- package/lib/cjs/utils/schemas.js +17 -0
- package/lib/cjs/utils/schemas.js.map +1 -1
- package/lib/esm/Progress.js +57 -0
- package/lib/esm/Progress.js.map +1 -0
- package/lib/esm/environment.js.map +1 -1
- package/lib/esm/index.js +3 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/integrations.js +1 -0
- package/lib/esm/integrations.js.map +1 -1
- package/lib/esm/interaction.js +2 -2
- package/lib/esm/interaction.js.map +1 -1
- package/lib/esm/meters.js +10 -0
- package/lib/esm/meters.js.map +1 -0
- package/lib/esm/project.js.map +1 -1
- package/lib/esm/store/collections.js +6 -0
- package/lib/esm/store/collections.js.map +1 -0
- package/lib/esm/store/doc-analyzer.js +2 -0
- package/lib/esm/store/doc-analyzer.js.map +1 -0
- package/lib/esm/store/index.js +3 -0
- package/lib/esm/store/index.js.map +1 -1
- package/lib/esm/store/signals.js +2 -0
- package/lib/esm/store/signals.js.map +1 -0
- package/lib/esm/store/store.js.map +1 -1
- package/lib/esm/store/workflow.js +15 -0
- package/lib/esm/store/workflow.js.map +1 -1
- package/lib/esm/user.js +5 -0
- package/lib/esm/user.js.map +1 -1
- package/lib/esm/utils/advanced-content-processing.js +19 -0
- package/lib/esm/utils/advanced-content-processing.js.map +1 -0
- package/lib/esm/utils/schemas.js +16 -0
- package/lib/esm/utils/schemas.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/Progress.d.ts +21 -0
- package/lib/types/Progress.d.ts.map +1 -0
- package/lib/types/common.d.ts +1 -0
- package/lib/types/common.d.ts.map +1 -1
- package/lib/types/environment.d.ts +3 -2
- package/lib/types/environment.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/integrations.d.ts +6 -1
- package/lib/types/integrations.d.ts.map +1 -1
- package/lib/types/interaction.d.ts +171 -22
- package/lib/types/interaction.d.ts.map +1 -1
- package/lib/types/meters.d.ts +23 -0
- package/lib/types/meters.d.ts.map +1 -0
- package/lib/types/project.d.ts +7 -0
- package/lib/types/project.d.ts.map +1 -1
- package/lib/types/query.d.ts +2 -0
- package/lib/types/query.d.ts.map +1 -1
- package/lib/types/runs.d.ts +8 -0
- package/lib/types/runs.d.ts.map +1 -1
- package/lib/types/store/activity-catalog.d.ts +2 -2
- package/lib/types/store/activity-catalog.d.ts.map +1 -1
- package/lib/types/store/collections.d.ts +54 -0
- package/lib/types/store/collections.d.ts.map +1 -0
- package/lib/types/store/doc-analyzer.d.ts +132 -0
- package/lib/types/store/doc-analyzer.d.ts.map +1 -0
- package/lib/types/store/index.d.ts +3 -0
- package/lib/types/store/index.d.ts.map +1 -1
- package/lib/types/store/signals.d.ts +4 -0
- package/lib/types/store/signals.d.ts.map +1 -0
- package/lib/types/store/store.d.ts +20 -13
- package/lib/types/store/store.d.ts.map +1 -1
- package/lib/types/store/workflow.d.ts +64 -19
- package/lib/types/store/workflow.d.ts.map +1 -1
- package/lib/types/user.d.ts +10 -2
- package/lib/types/user.d.ts.map +1 -1
- package/lib/types/utils/advanced-content-processing.d.ts +15 -0
- package/lib/types/utils/advanced-content-processing.d.ts.map +1 -0
- package/lib/types/utils/schemas.d.ts +2 -0
- package/lib/types/utils/schemas.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/Progress.ts +57 -0
- package/src/common.ts +1 -0
- package/src/environment.ts +3 -2
- package/src/index.ts +4 -0
- package/src/integrations.ts +8 -1
- package/src/interaction.ts +248 -51
- package/src/meters.ts +30 -0
- package/src/project.ts +7 -0
- package/src/query.ts +2 -0
- package/src/runs.ts +9 -0
- package/src/store/activity-catalog.ts +2 -2
- package/src/store/collections.ts +62 -0
- package/src/store/doc-analyzer.ts +152 -0
- package/src/store/index.ts +3 -0
- package/src/store/signals.ts +4 -0
- package/src/store/store.ts +22 -13
- package/src/store/workflow.ts +87 -42
- package/src/user.ts +13 -2
- package/src/utils/advanced-content-processing.ts +32 -0
- package/src/utils/schemas.ts +18 -1
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,64 @@ 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 omly 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 omly 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;
|
88
|
+
parent?: string;
|
20
89
|
description?: string;
|
21
90
|
status: InteractionStatus;
|
22
91
|
visibility?: InteractionVisibility;
|
@@ -25,10 +94,10 @@ export interface InteractionRef {
|
|
25
94
|
prompts?: PromptSegmentDef<PromptTemplateRef>[];
|
26
95
|
updated_at: Date;
|
27
96
|
}
|
28
|
-
export const InteractionRefPopulate =
|
97
|
+
export const InteractionRefPopulate =
|
98
|
+
"id name endpoint parent description status version visibility tags updated_at prompts";
|
29
99
|
|
30
|
-
export interface InteractionRefWithSchema
|
31
|
-
extends Omit<InteractionRef, "prompts"> {
|
100
|
+
export interface InteractionRefWithSchema extends Omit<InteractionRef, "prompts"> {
|
32
101
|
result_schema?: JSONSchema4;
|
33
102
|
prompts?: PromptSegmentDef<PromptTemplateRefWithSchema>[];
|
34
103
|
}
|
@@ -45,7 +114,7 @@ export interface InteractionsExportPayload {
|
|
45
114
|
/*
|
46
115
|
* if not specified, all versions will be exported
|
47
116
|
*/
|
48
|
-
versions?: (number |
|
117
|
+
versions?: (number | "draft" | "latest")[];
|
49
118
|
}
|
50
119
|
|
51
120
|
export enum InteractionStatus {
|
@@ -64,20 +133,20 @@ export enum ExecutionRunStatus {
|
|
64
133
|
export enum RunDataStorageLevel {
|
65
134
|
STANDARD = "STANDARD",
|
66
135
|
RESTRICTED = "RESTRICTED",
|
67
|
-
DEBUG = "DEBUG"
|
136
|
+
DEBUG = "DEBUG",
|
68
137
|
}
|
69
138
|
|
70
139
|
export enum RunDataStorageDescription {
|
71
140
|
STANDARD = "Run data is stored for both the model inputs and output.",
|
72
141
|
RESTRICTED = "No run data is stored for the model inputs — only the model output.",
|
73
|
-
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.",
|
74
143
|
}
|
75
144
|
|
76
145
|
export const RunDataStorageOptions: Record<RunDataStorageLevel, RunDataStorageDescription> = {
|
77
146
|
[RunDataStorageLevel.STANDARD]: RunDataStorageDescription.STANDARD,
|
78
147
|
[RunDataStorageLevel.RESTRICTED]: RunDataStorageDescription.RESTRICTED,
|
79
148
|
[RunDataStorageLevel.DEBUG]: RunDataStorageDescription.DEBUG,
|
80
|
-
}
|
149
|
+
};
|
81
150
|
|
82
151
|
/**
|
83
152
|
* Schema can be stored or specified as a reference to an external schema.
|
@@ -92,8 +161,8 @@ export interface CachePolicy {
|
|
92
161
|
varies_on: string[];
|
93
162
|
ttl: number;
|
94
163
|
}
|
95
|
-
export type InteractionVisibility =
|
96
|
-
export interface Interaction
|
164
|
+
export type InteractionVisibility = "public" | "private";
|
165
|
+
export interface Interaction {
|
97
166
|
readonly id: string;
|
98
167
|
name: string;
|
99
168
|
endpoint: string;
|
@@ -105,9 +174,11 @@ export interface Interaction extends ModelOptions {
|
|
105
174
|
version: number;
|
106
175
|
tags: string[];
|
107
176
|
test_data?: JSONObject;
|
177
|
+
interaction_schema?: JSONSchema4 | SchemaRef;
|
108
178
|
result_schema?: JSONSchema4 | SchemaRef;
|
109
179
|
cache_policy?: CachePolicy;
|
110
180
|
model: string;
|
181
|
+
model_options?: ModelOptions;
|
111
182
|
prompts: PromptSegmentDef[];
|
112
183
|
output_modality?: Modalities;
|
113
184
|
environment: string | ExecutionEnvironmentRef;
|
@@ -115,21 +186,31 @@ export interface Interaction extends ModelOptions {
|
|
115
186
|
project: string | ProjectRef;
|
116
187
|
// only for drafts - when it was last published
|
117
188
|
last_published_at?: Date;
|
118
|
-
created_by: string
|
119
|
-
updated_by: string
|
189
|
+
created_by: string;
|
190
|
+
updated_by: string;
|
120
191
|
created_at: Date;
|
121
192
|
updated_at: Date;
|
122
193
|
}
|
123
194
|
|
124
|
-
export interface PopulatedInteraction
|
125
|
-
extends Omit<Interaction, "prompts"> {
|
195
|
+
export interface PopulatedInteraction extends Omit<Interaction, "prompts"> {
|
126
196
|
prompts: PopulatedPromptSegmentDef[];
|
127
197
|
}
|
128
198
|
|
129
199
|
export interface InteractionCreatePayload
|
130
200
|
extends Omit<
|
131
201
|
Interaction,
|
132
|
-
|
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"
|
133
214
|
> {
|
134
215
|
visibility?: InteractionVisibility;
|
135
216
|
}
|
@@ -139,21 +220,9 @@ export interface InteractionUpdatePayload
|
|
139
220
|
Omit<
|
140
221
|
Interaction,
|
141
222
|
"result_schema" | "id" | "created_at" | "updated_at" | "created_by" | "updated_by" | "project"
|
142
|
-
| "temperature" | "max_tokens" | "stop_sequence" | "top_k" | "top_p" | "presence_penalty" | "frequency_penalty" | "top_logprobs"
|
143
223
|
>
|
144
224
|
> {
|
145
225
|
result_schema?: JSONSchema4 | null;
|
146
|
-
|
147
|
-
// Change ModelOptions properties to include null as a possible type
|
148
|
-
// Null values indicate that the property should be cleared.
|
149
|
-
temperature?: number | null;
|
150
|
-
max_tokens?: number | null;
|
151
|
-
stop_sequence?: string[] | null;
|
152
|
-
top_k?: number | null;
|
153
|
-
top_p?: number | null;
|
154
|
-
top_logprobs?: number | null;
|
155
|
-
presence_penalty?: number | null;
|
156
|
-
frequency_penalty?: number | null;
|
157
226
|
}
|
158
227
|
|
159
228
|
export interface InteractionPublishPayload {
|
@@ -167,7 +236,6 @@ export interface InteractionForkPayload {
|
|
167
236
|
targetProject?: string;
|
168
237
|
}
|
169
238
|
|
170
|
-
|
171
239
|
export interface InteractionExecutionPayload {
|
172
240
|
/**
|
173
241
|
* If a `@memory` property exists on the input data then the value will be used as the value of a memory pack location.
|
@@ -179,6 +247,20 @@ export interface InteractionExecutionPayload {
|
|
179
247
|
stream?: boolean;
|
180
248
|
do_validate?: boolean;
|
181
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[];
|
182
264
|
}
|
183
265
|
|
184
266
|
export interface NamedInteractionExecutionPayload extends InteractionExecutionPayload {
|
@@ -190,6 +272,115 @@ export interface NamedInteractionExecutionPayload extends InteractionExecutionPa
|
|
190
272
|
interaction: string;
|
191
273
|
}
|
192
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
|
+
export interface AsyncInteractionExecutionPayload extends AsyncExecutionPayloadBase {
|
342
|
+
type: "interaction";
|
343
|
+
|
344
|
+
/**
|
345
|
+
* The tools to use
|
346
|
+
*/
|
347
|
+
tools?: ToolDefinition[];
|
348
|
+
|
349
|
+
/**
|
350
|
+
* Only used for non conversation workflows to include the error on next retry.
|
351
|
+
* If tools is defined this is not used
|
352
|
+
*/
|
353
|
+
include_previous_error?: boolean;
|
354
|
+
}
|
355
|
+
|
356
|
+
export type AsyncExecutionPayload = AsyncConversationExecutionPayload | AsyncInteractionExecutionPayload;
|
357
|
+
|
358
|
+
interface ResumeConversationPayload {
|
359
|
+
run: ExecutionRunDocRef; // the run created by the first execution.
|
360
|
+
environment: string; // the environment ID
|
361
|
+
options: StatelessExecutionOptions; // the options used on the first execution
|
362
|
+
conversation: unknown; // the conversation state
|
363
|
+
tools: ToolDefinition[]; // the tools to be used
|
364
|
+
}
|
365
|
+
|
366
|
+
/**
|
367
|
+
* The payload to sent the tool responses back to the target LLM
|
368
|
+
*/
|
369
|
+
export interface ToolResultsPayload extends ResumeConversationPayload {
|
370
|
+
results: {
|
371
|
+
tool_use_id: string;
|
372
|
+
content: string;
|
373
|
+
}[];
|
374
|
+
}
|
375
|
+
|
376
|
+
export interface UserMessagePayload extends ResumeConversationPayload {
|
377
|
+
message: string;
|
378
|
+
}
|
379
|
+
|
380
|
+
export type CheckpointConversationPayload = Omit<ToolResultsPayload, "results">;
|
381
|
+
|
382
|
+
// ================= end async execution payloads ====================
|
383
|
+
|
193
384
|
export enum RunSourceTypes {
|
194
385
|
api = "api",
|
195
386
|
cli = "cli",
|
@@ -202,7 +393,7 @@ export enum RunSourceTypes {
|
|
202
393
|
export interface RunSource {
|
203
394
|
type: RunSourceTypes;
|
204
395
|
label: string;
|
205
|
-
principal_type:
|
396
|
+
principal_type: "user" | "apikey";
|
206
397
|
principal_id: string;
|
207
398
|
client_ip: string;
|
208
399
|
}
|
@@ -214,10 +405,10 @@ export interface ExecutionRun<P = any, R = any> {
|
|
214
405
|
*/
|
215
406
|
parent?: string | ExecutionRun;
|
216
407
|
evaluation?: {
|
217
|
-
score?: number
|
218
|
-
selected?: boolean
|
219
|
-
scores?: Record<string, number
|
220
|
-
}
|
408
|
+
score?: number;
|
409
|
+
selected?: boolean;
|
410
|
+
scores?: Record<string, number>;
|
411
|
+
};
|
221
412
|
result: R;
|
222
413
|
/**
|
223
414
|
* The parameters used to create the interaction.
|
@@ -247,12 +438,17 @@ export interface ExecutionRun<P = any, R = any> {
|
|
247
438
|
error?: InteractionExecutionError;
|
248
439
|
source: RunSource;
|
249
440
|
output_modality: Modalities;
|
250
|
-
created_by: string
|
251
|
-
updated_by: string
|
441
|
+
created_by: string;
|
442
|
+
updated_by: string;
|
252
443
|
}
|
253
444
|
|
254
|
-
export interface
|
255
|
-
|
445
|
+
export interface InteractionExecutionResult<P = any, R = any> extends ExecutionRun<P, R> {
|
446
|
+
tool_use?: ToolUse[];
|
447
|
+
conversation?: unknown;
|
448
|
+
options?: StatelessExecutionOptions;
|
449
|
+
}
|
450
|
+
|
451
|
+
export interface ExecutionRunRef extends Omit<ExecutionRun, "result" | "parameters" | "interaction"> {
|
256
452
|
interaction: InteractionRef;
|
257
453
|
}
|
258
454
|
|
@@ -261,27 +457,28 @@ export const ExecutionRunRefSelect = "-result -parameters -result_schema -prompt
|
|
261
457
|
export enum ConfigModes {
|
262
458
|
RUN_AND_INTERACTION_CONFIG = "RUN_AND_INTERACTION_CONFIG",
|
263
459
|
RUN_CONFIG_ONLY = "RUN_CONFIG_ONLY",
|
264
|
-
INTERACTION_CONFIG_ONLY = "INTERACTION_CONFIG_ONLY"
|
265
|
-
}
|
460
|
+
INTERACTION_CONFIG_ONLY = "INTERACTION_CONFIG_ONLY",
|
461
|
+
}
|
266
462
|
|
267
463
|
export enum ConfigModesDescription {
|
268
464
|
RUN_AND_INTERACTION_CONFIG = "This run configuration is used. Undefined options are filled with interaction configuration.",
|
269
465
|
RUN_CONFIG_ONLY = "Only this run configuration is used. Undefined options remain undefined.",
|
270
|
-
INTERACTION_CONFIG_ONLY = "Only interaction configuration is used."
|
466
|
+
INTERACTION_CONFIG_ONLY = "Only interaction configuration is used.",
|
271
467
|
}
|
272
468
|
|
273
469
|
export const ConfigModesOptions: Record<ConfigModes, ConfigModesDescription> = {
|
274
470
|
[ConfigModes.RUN_AND_INTERACTION_CONFIG]: ConfigModesDescription.RUN_AND_INTERACTION_CONFIG,
|
275
471
|
[ConfigModes.RUN_CONFIG_ONLY]: ConfigModesDescription.RUN_CONFIG_ONLY,
|
276
472
|
[ConfigModes.INTERACTION_CONFIG_ONLY]: ConfigModesDescription.INTERACTION_CONFIG_ONLY,
|
277
|
-
}
|
473
|
+
};
|
278
474
|
|
279
|
-
export interface InteractionExecutionConfiguration
|
475
|
+
export interface InteractionExecutionConfiguration {
|
280
476
|
environment?: string;
|
281
477
|
model?: string;
|
282
478
|
do_validate?: boolean;
|
283
479
|
run_data?: RunDataStorageLevel;
|
284
480
|
configMode?: ConfigModes;
|
481
|
+
model_options?: ModelOptions;
|
285
482
|
}
|
286
483
|
|
287
484
|
export interface GenerateInteractionPayload {
|
@@ -297,4 +494,4 @@ export interface GenerateTestDataPayload {
|
|
297
494
|
|
298
495
|
export interface ImprovePromptPayload {
|
299
496
|
config: InteractionExecutionConfiguration;
|
300
|
-
}
|
497
|
+
}
|
package/src/meters.ts
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
import { BillingMethod } from "./user.js";
|
2
|
+
|
3
|
+
|
4
|
+
export interface MeterAdjustment {
|
5
|
+
meter: string;
|
6
|
+
value: string;
|
7
|
+
identifier?: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
|
11
|
+
export interface AdjustMetersMeterWorkflowParams {
|
12
|
+
adjustments: MeterAdjustment[];
|
13
|
+
}
|
14
|
+
|
15
|
+
export enum MeterNames {
|
16
|
+
analyzed_pages = 'analyzed_pages',
|
17
|
+
extracted_tables = 'extracted_tables',
|
18
|
+
analyzed_images = 'analyzed_images',
|
19
|
+
input_token_used = 'input_token_used',
|
20
|
+
output_token_used = 'output_token_used',
|
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
|
30
|
+
}
|
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 {
|
package/src/query.ts
CHANGED
package/src/runs.ts
CHANGED
@@ -1,6 +1,15 @@
|
|
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
15
|
* It uses interaction field (from NamedInteractionExecutionPayload) to pass the intercation ID to run
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export type TsPropType = "string" | "number" | "boolean" | "record" | "object" | "array" | "enum" | "literal" | "union" | "promise" | "any";
|
1
|
+
export type TsPropType = "string" | "number" | "boolean" | "record" | "object" | "array" | "enum" | "literal" | "union" | "promise" | "any" | "void";
|
2
2
|
|
3
3
|
// generic types are replaced by "any"
|
4
4
|
export interface ActivityTypeDefinition {
|
@@ -9,7 +9,7 @@ export interface ActivityTypeDefinition {
|
|
9
9
|
// in case of primitive literals will be the value
|
10
10
|
// or nested objects / arrays will be "object" or "array"
|
11
11
|
// for record this is Record<type,type>
|
12
|
-
value: string | boolean | number;
|
12
|
+
value: string | boolean | number | null;
|
13
13
|
// in case of objects
|
14
14
|
members?: ActivityPropertyDefinition[];
|
15
15
|
// in case of arrays or promises will be innertype (i.e. the element type for arrays)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { BaseObject } from "./common.js";
|
2
|
+
import { ColumnLayout, ContentObjectTypeRef } from "./store.js";
|
3
|
+
|
4
|
+
export enum CollectionStatus {
|
5
|
+
active = 'active',
|
6
|
+
archived = 'archived'
|
7
|
+
}
|
8
|
+
|
9
|
+
export interface CreateCollectionPayload {
|
10
|
+
name: string;
|
11
|
+
dynamic: boolean;
|
12
|
+
description?: string;
|
13
|
+
tags?: string[];
|
14
|
+
type?: string;
|
15
|
+
query?: Record<string, any>;
|
16
|
+
properties?: Record<string, any>;
|
17
|
+
parent?: string | null;
|
18
|
+
table_layout?: ColumnLayout[] | null;
|
19
|
+
}
|
20
|
+
|
21
|
+
export interface CollectionItem extends BaseObject {
|
22
|
+
/**
|
23
|
+
* A flag to indicate if the collection is dynamic or static.
|
24
|
+
* If the collection is dynamic, the members are determined by a query using the query field.
|
25
|
+
* Id the collection is static, the members are explicitly defined jusing the members array.
|
26
|
+
*/
|
27
|
+
dynamic: boolean;
|
28
|
+
status: CollectionStatus;
|
29
|
+
// A ref to the object type
|
30
|
+
type?: ContentObjectTypeRef;
|
31
|
+
/**
|
32
|
+
* The parent collection if any
|
33
|
+
*/
|
34
|
+
parent?: string | null;
|
35
|
+
/**
|
36
|
+
* The table layout to use for the collection.
|
37
|
+
* The layout defined in the type could serve as a fallback if not defined here.
|
38
|
+
*/
|
39
|
+
table_layout?: ColumnLayout[];
|
40
|
+
}
|
41
|
+
|
42
|
+
export interface Collection extends CollectionItem {
|
43
|
+
properties: Record<string, any>;
|
44
|
+
query?: Record<string, any>;
|
45
|
+
}
|
46
|
+
|
47
|
+
export interface StaticCollection extends Collection {
|
48
|
+
dynamic: false;
|
49
|
+
members: string[];
|
50
|
+
query: never;
|
51
|
+
}
|
52
|
+
|
53
|
+
export interface DynamicCollection extends Collection {
|
54
|
+
dynamic: true;
|
55
|
+
}
|
56
|
+
|
57
|
+
export interface CollectionSearchPayload {
|
58
|
+
dynamic?: boolean;
|
59
|
+
status?: CollectionStatus;
|
60
|
+
limit?: number;
|
61
|
+
offset?: number;
|
62
|
+
}
|