@llumiverse/core 0.15.0 → 0.17.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/README.md +3 -3
- package/lib/cjs/CompletionStream.js +31 -10
- package/lib/cjs/CompletionStream.js.map +1 -1
- package/lib/cjs/Driver.js +20 -22
- package/lib/cjs/Driver.js.map +1 -1
- package/lib/cjs/async.js +3 -2
- package/lib/cjs/async.js.map +1 -1
- package/lib/cjs/formatters/commons.js.map +1 -1
- package/lib/cjs/formatters/generic.js.map +1 -1
- package/lib/cjs/formatters/index.js +1 -3
- package/lib/cjs/formatters/index.js.map +1 -1
- package/lib/cjs/formatters/{claude.js → nova.js} +33 -37
- package/lib/cjs/formatters/nova.js.map +1 -0
- package/lib/cjs/formatters/openai.js +36 -6
- package/lib/cjs/formatters/openai.js.map +1 -1
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/options/bedrock.js +343 -0
- package/lib/cjs/options/bedrock.js.map +1 -0
- package/lib/cjs/options/groq.js +37 -0
- package/lib/cjs/options/groq.js.map +1 -0
- package/lib/cjs/options/openai.js +123 -0
- package/lib/cjs/options/openai.js.map +1 -0
- package/lib/cjs/options/vertexai.js +257 -0
- package/lib/cjs/options/vertexai.js.map +1 -0
- package/lib/cjs/options.js +54 -0
- package/lib/cjs/options.js.map +1 -0
- package/lib/cjs/types.js +34 -1
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/CompletionStream.js +31 -10
- package/lib/esm/CompletionStream.js.map +1 -1
- package/lib/esm/Driver.js +21 -23
- package/lib/esm/Driver.js.map +1 -1
- package/lib/esm/async.js +3 -2
- package/lib/esm/async.js.map +1 -1
- package/lib/esm/formatters/commons.js.map +1 -1
- package/lib/esm/formatters/generic.js.map +1 -1
- package/lib/esm/formatters/index.js +1 -3
- package/lib/esm/formatters/index.js.map +1 -1
- package/lib/esm/formatters/{claude.js → nova.js} +32 -36
- package/lib/esm/formatters/nova.js.map +1 -0
- package/lib/esm/formatters/openai.js +36 -6
- package/lib/esm/formatters/openai.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/options/bedrock.js +340 -0
- package/lib/esm/options/bedrock.js.map +1 -0
- package/lib/esm/options/groq.js +34 -0
- package/lib/esm/options/groq.js.map +1 -0
- package/lib/esm/options/openai.js +120 -0
- package/lib/esm/options/openai.js.map +1 -0
- package/lib/esm/options/vertexai.js +253 -0
- package/lib/esm/options/vertexai.js.map +1 -0
- package/lib/esm/options.js +50 -0
- package/lib/esm/options.js.map +1 -0
- package/lib/esm/types.js +33 -0
- package/lib/esm/types.js.map +1 -1
- package/lib/types/CompletionStream.d.ts +1 -1
- package/lib/types/CompletionStream.d.ts.map +1 -1
- package/lib/types/Driver.d.ts +5 -4
- package/lib/types/Driver.d.ts.map +1 -1
- package/lib/types/async.d.ts +3 -2
- package/lib/types/async.d.ts.map +1 -1
- package/lib/types/formatters/commons.d.ts +2 -2
- package/lib/types/formatters/commons.d.ts.map +1 -1
- package/lib/types/formatters/generic.d.ts +3 -3
- package/lib/types/formatters/generic.d.ts.map +1 -1
- package/lib/types/formatters/index.d.ts +3 -5
- package/lib/types/formatters/index.d.ts.map +1 -1
- package/lib/types/formatters/nova.d.ts +40 -0
- package/lib/types/formatters/nova.d.ts.map +1 -0
- package/lib/types/formatters/openai.d.ts +13 -1
- package/lib/types/formatters/openai.d.ts.map +1 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/options/bedrock.d.ts +32 -0
- package/lib/types/options/bedrock.d.ts.map +1 -0
- package/lib/types/options/groq.d.ts +12 -0
- package/lib/types/options/groq.d.ts.map +1 -0
- package/lib/types/options/openai.d.ts +21 -0
- package/lib/types/options/openai.d.ts.map +1 -0
- package/lib/types/options/vertexai.d.ts +52 -0
- package/lib/types/options/vertexai.d.ts.map +1 -0
- package/lib/types/options.d.ts +14 -0
- package/lib/types/options.d.ts.map +1 -0
- package/lib/types/types.d.ts +151 -52
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +6 -8
- package/src/CompletionStream.ts +31 -11
- package/src/Driver.ts +30 -26
- package/src/async.ts +7 -5
- package/src/formatters/commons.ts +2 -2
- package/src/formatters/generic.ts +2 -2
- package/src/formatters/index.ts +3 -6
- package/src/formatters/nova.ts +141 -0
- package/src/formatters/openai.ts +52 -12
- package/src/index.ts +2 -1
- package/src/options/bedrock.ts +388 -0
- package/src/options/groq.ts +47 -0
- package/src/options/openai.ts +148 -0
- package/src/options/vertexai.ts +312 -0
- package/src/options.ts +62 -0
- package/src/types.ts +192 -53
- package/lib/cjs/formatters/claude.js.map +0 -1
- package/lib/cjs/formatters/llama2.js +0 -48
- package/lib/cjs/formatters/llama2.js.map +0 -1
- package/lib/cjs/formatters/llama3.js +0 -42
- package/lib/cjs/formatters/llama3.js.map +0 -1
- package/lib/esm/formatters/claude.js.map +0 -1
- package/lib/esm/formatters/llama2.js +0 -45
- package/lib/esm/formatters/llama2.js.map +0 -1
- package/lib/esm/formatters/llama3.js +0 -39
- package/lib/esm/formatters/llama3.js.map +0 -1
- package/lib/types/formatters/claude.d.ts +0 -25
- package/lib/types/formatters/claude.d.ts.map +0 -1
- package/lib/types/formatters/llama2.d.ts +0 -4
- package/lib/types/formatters/llama2.d.ts.map +0 -1
- package/lib/types/formatters/llama3.d.ts +0 -7
- package/lib/types/formatters/llama3.d.ts.map +0 -1
- package/src/formatters/claude.ts +0 -131
- package/src/formatters/llama2.ts +0 -58
- package/src/formatters/llama3.ts +0 -55
package/lib/types/async.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../../src/async.ts"],"names":[],"mapp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AC,CAAC,CAOlB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function getJSONSafetyNotice(schema:
|
|
1
|
+
import { JSONSchema } from "../types.js";
|
|
2
|
+
export declare function getJSONSafetyNotice(schema: JSONSchema): string;
|
|
3
3
|
//# sourceMappingURL=commons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commons.d.ts","sourceRoot":"","sources":["../../../src/formatters/commons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"commons.d.ts","sourceRoot":"","sources":["../../../src/formatters/commons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,UAErD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSONSchema } from "../types.js";
|
|
2
2
|
import { PromptSegment } from "../types.js";
|
|
3
3
|
interface Labels {
|
|
4
4
|
user: string;
|
|
@@ -7,7 +7,7 @@ interface Labels {
|
|
|
7
7
|
safety: string;
|
|
8
8
|
instruction: string;
|
|
9
9
|
}
|
|
10
|
-
export declare function createTextPromptFormatter(labels?: Labels): (segments: PromptSegment[], schema?:
|
|
11
|
-
declare const formatTextPrompt: (segments: PromptSegment[], schema?:
|
|
10
|
+
export declare function createTextPromptFormatter(labels?: Labels): (segments: PromptSegment[], schema?: JSONSchema) => string;
|
|
11
|
+
declare const formatTextPrompt: (segments: PromptSegment[], schema?: JSONSchema) => string;
|
|
12
12
|
export { formatTextPrompt };
|
|
13
13
|
//# sourceMappingURL=generic.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../../src/formatters/generic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../../src/formatters/generic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAc,aAAa,EAAE,MAAM,aAAa,CAAC;AAGxD,UAAU,MAAM;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAA;CACtB;AAED,wBAAgB,yBAAyB,CAAC,MAAM,GAAE,MAMjD,IACqC,UAAU,aAAa,EAAE,EAAE,SAAS,UAAU,KAAG,MAAM,CA2C5F;AAED,QAAA,MAAM,gBAAgB,aA7C0B,aAAa,EAAE,WAAW,UAAU,KAAG,MA6CnC,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSONSchema } from "../types.js";
|
|
2
2
|
import { PromptSegment } from "../types.js";
|
|
3
|
-
export type PromptFormatter<T = any> = (messages: PromptSegment[], schema?:
|
|
4
|
-
export * from "./claude.js";
|
|
3
|
+
export type PromptFormatter<T = any> = (messages: PromptSegment[], schema?: JSONSchema) => T;
|
|
5
4
|
export * from "./commons.js";
|
|
6
5
|
export * from "./generic.js";
|
|
7
|
-
export * from "./llama2.js";
|
|
8
|
-
export * from "./llama3.js";
|
|
9
6
|
export * from "./openai.js";
|
|
7
|
+
export * from "./nova.js";
|
|
10
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/formatters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/formatters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE,MAAM,CAAC,EAAE,UAAU,KAAK,CAAC,CAAC;AAE7F,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { JSONSchema } from "../types.js";
|
|
2
|
+
import { PromptSegment } from "../index.js";
|
|
3
|
+
export interface NovaMessage {
|
|
4
|
+
role: 'user' | 'assistant';
|
|
5
|
+
content: NovaMessagePart[];
|
|
6
|
+
}
|
|
7
|
+
export interface NovaSystemMessage {
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
interface NovaMessagePart {
|
|
11
|
+
text?: string;
|
|
12
|
+
image?: {
|
|
13
|
+
format: "jpeg" | "png" | "gif" | "webp";
|
|
14
|
+
source: {
|
|
15
|
+
bytes: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
video?: {
|
|
19
|
+
format: "mkv" | "mov" | "mp4" | "webm" | "three_gp" | "flv" | "mpeg" | "mpg" | "wmv";
|
|
20
|
+
source: {
|
|
21
|
+
s3Location?: {
|
|
22
|
+
uri: string;
|
|
23
|
+
bucketOwner: string;
|
|
24
|
+
};
|
|
25
|
+
bytes?: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface NovaMessagesPrompt {
|
|
30
|
+
system?: NovaSystemMessage[];
|
|
31
|
+
messages: NovaMessage[];
|
|
32
|
+
negative?: string;
|
|
33
|
+
mask?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A formatter used by Bedrock to format prompts for nova related models
|
|
37
|
+
*/
|
|
38
|
+
export declare function formatNovaPrompt(segments: PromptSegment[], schema?: JSONSchema): Promise<NovaMessagesPrompt>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,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA6FlH"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PromptOptions } from "../index.js";
|
|
1
2
|
import { PromptSegment } from "../types.js";
|
|
2
3
|
export interface OpenAITextMessage {
|
|
3
4
|
content: string;
|
|
@@ -8,6 +9,12 @@ export interface OpenAIMessage {
|
|
|
8
9
|
role: "system" | "user" | "assistant";
|
|
9
10
|
name?: string;
|
|
10
11
|
}
|
|
12
|
+
export interface OpenAIToolMessage {
|
|
13
|
+
role: "tool";
|
|
14
|
+
tool_call_id: string;
|
|
15
|
+
content: string;
|
|
16
|
+
}
|
|
17
|
+
export type OpenAIInputMessage = OpenAIMessage | OpenAIToolMessage;
|
|
11
18
|
export interface OpenAIContentPartText {
|
|
12
19
|
type: "text";
|
|
13
20
|
text: string;
|
|
@@ -25,5 +32,10 @@ export interface OpenAIContentPartImage {
|
|
|
25
32
|
* @returns
|
|
26
33
|
*/
|
|
27
34
|
export declare function formatOpenAILikeTextPrompt(segments: PromptSegment[]): OpenAITextMessage[];
|
|
28
|
-
export declare function formatOpenAILikeMultimodalPrompt(segments: PromptSegment[]): Promise<
|
|
35
|
+
export declare function formatOpenAILikeMultimodalPrompt(segments: PromptSegment[], opts: PromptOptions & OpenAIPromptFormatterOptions): Promise<OpenAIInputMessage[]>;
|
|
36
|
+
export interface OpenAIPromptFormatterOptions {
|
|
37
|
+
multimodal?: boolean;
|
|
38
|
+
useToolForFormatting?: boolean;
|
|
39
|
+
schema?: Object;
|
|
40
|
+
}
|
|
29
41
|
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/formatters/openai.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/formatters/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,aAA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
CHANGED
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ModelOptionsInfo, ModelOptions } from "../types.js";
|
|
2
|
+
export type BedrockOptions = NovaCanvasOptions | BaseConverseOptions | BedrockClaudeOptions;
|
|
3
|
+
export interface NovaCanvasOptions {
|
|
4
|
+
_option_id: "bedrock-nova-canvas";
|
|
5
|
+
taskType: "TEXT_IMAGE" | "TEXT_IMAGE_WITH_IMAGE_CONDITIONING" | "COLOR_GUIDED_GENERATION" | "IMAGE_VARIATION" | "INPAINTING" | "OUTPAINTING" | "BACKGROUND_REMOVAL";
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
quality?: "standard" | "premium";
|
|
9
|
+
cfgScale?: number;
|
|
10
|
+
seed?: number;
|
|
11
|
+
numberOfImages?: number;
|
|
12
|
+
controlMode?: "CANNY_EDGE" | "SEGMENTATION";
|
|
13
|
+
controlStrength?: number;
|
|
14
|
+
colors?: string[];
|
|
15
|
+
similarityStrength?: number;
|
|
16
|
+
outPaintingMode?: "DEFAULT" | "PRECISE";
|
|
17
|
+
}
|
|
18
|
+
export interface BaseConverseOptions {
|
|
19
|
+
_option_id: "bedrock-converse" | "bedrock-claude" | "bedrock-nova" | "bedrock-mistral" | "bedrock-ai21" | "bedrock-cohere-command";
|
|
20
|
+
max_tokens?: number;
|
|
21
|
+
temperature?: number;
|
|
22
|
+
top_p?: number;
|
|
23
|
+
stop_sequence?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface BedrockClaudeOptions extends BaseConverseOptions {
|
|
26
|
+
_option_id: "bedrock-claude";
|
|
27
|
+
top_k?: number;
|
|
28
|
+
thinking_mode?: boolean;
|
|
29
|
+
thinking_budget_tokens?: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function getBedrockOptions(model: string, option?: ModelOptions): ModelOptionsInfo;
|
|
32
|
+
//# sourceMappingURL=bedrock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.d.ts","sourceRoot":"","sources":["../../../src/options/bedrock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAmC,MAAM,aAAa,CAAC;AAI9F,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AAE5F,MAAM,WAAW,iBAAiB;IAC9B,UAAU,EAAE,qBAAqB,CAAA;IACjC,QAAQ,EAAE,YAAY,GAAG,oCAAoC,GAAG,yBAAyB,GAAG,iBAAiB,GAAG,YAAY,GAAG,aAAa,GAAG,oBAAoB,CAAC;IACpK,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,YAAY,GAAG,cAAc,CAAC;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC3C;AAED,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,kBAAkB,GAAG,gBAAgB,GAAG,cAAc,GAAG,iBAAiB,GAAG,cAAc,GAAG,wBAAwB,CAAC;IACnI,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC7D,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACnC;AA4ED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAoRxF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ModelOptionsInfo, ModelOptions } from "../types.js";
|
|
2
|
+
export type GroqOptions = GroqDeepseekThinkingOptions;
|
|
3
|
+
export interface GroqDeepseekThinkingOptions {
|
|
4
|
+
_option_id: "groq-deepseek-thinking";
|
|
5
|
+
max_tokens?: number;
|
|
6
|
+
temperature?: number;
|
|
7
|
+
top_p?: number;
|
|
8
|
+
stop_sequence?: string[];
|
|
9
|
+
reasonsing_format: 'parsed' | 'raw' | 'hidden';
|
|
10
|
+
}
|
|
11
|
+
export declare function getGroqOptions(model: string, _option?: ModelOptions): ModelOptionsInfo;
|
|
12
|
+
//# sourceMappingURL=groq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"groq.d.ts","sourceRoot":"","sources":["../../../src/options/groq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAuB,YAAY,EAA6B,MAAM,aAAa,CAAC;AAI7G,MAAM,MAAM,WAAW,GAAG,2BAA2B,CAAC;AAEtD,MAAM,WAAW,2BAA2B;IACxC,UAAU,EAAE,wBAAwB,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,iBAAiB,EAAE,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;CAClD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,gBAAgB,CA+BtF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ModelOptionsInfo, ModelOptions } from "../types.js";
|
|
2
|
+
export type OpenAiOptions = OpenAiThinkingOptions | OpenAiTextOptions;
|
|
3
|
+
export interface OpenAiThinkingOptions {
|
|
4
|
+
_option_id: "openai-thinking";
|
|
5
|
+
max_tokens?: number;
|
|
6
|
+
stop_sequence?: string[];
|
|
7
|
+
reasoning_effort?: "low" | "medium" | "high";
|
|
8
|
+
image_detail?: "low" | "high" | "auto";
|
|
9
|
+
}
|
|
10
|
+
export interface OpenAiTextOptions {
|
|
11
|
+
_option_id: "openai-text";
|
|
12
|
+
max_tokens?: number;
|
|
13
|
+
temperature?: number;
|
|
14
|
+
top_p?: number;
|
|
15
|
+
presence_penalty?: number;
|
|
16
|
+
frequency_penalty?: number;
|
|
17
|
+
stop_sequence?: string[];
|
|
18
|
+
image_detail?: "low" | "high" | "auto";
|
|
19
|
+
}
|
|
20
|
+
export declare function getOpenAiOptions(model: string, _option?: ModelOptions): ModelOptionsInfo;
|
|
21
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/options/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAuB,YAAY,EAA6B,MAAM,aAAa,CAAC;AAI7G,MAAM,MAAM,aAAa,GAAG,qBAAqB,GAAG,iBAAiB,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IAClC,UAAU,EAAE,iBAAiB,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,gBAAgB,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC7C,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;CAC1C;AAED,MAAM,WAAW,iBAAiB;IAC9B,UAAU,EAAE,aAAa,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;CAC1C;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,gBAAgB,CA4GxF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ModelOptionsInfo, ModelOptions } from "../types.js";
|
|
2
|
+
export type VertexAIOptions = ImagenOptions | VertexAIClaudeOptions;
|
|
3
|
+
export declare enum ImagenTaskType {
|
|
4
|
+
TEXT_IMAGE = "TEXT_IMAGE",
|
|
5
|
+
EDIT_MODE_INPAINT_REMOVAL = "EDIT_MODE_INPAINT_REMOVAL",
|
|
6
|
+
EDIT_MODE_INPAINT_INSERTION = "EDIT_MODE_INPAINT_INSERTION",
|
|
7
|
+
EDIT_MODE_BGSWAP = "EDIT_MODE_BGSWAP",
|
|
8
|
+
EDIT_MODE_OUTPAINT = "EDIT_MODE_OUTPAINT",
|
|
9
|
+
CUSTOMIZATION_SUBJECT = "CUSTOMIZATION_SUBJECT",
|
|
10
|
+
CUSTOMIZATION_STYLE = "CUSTOMIZATION_STYLE",
|
|
11
|
+
CUSTOMIZATION_CONTROLLED = "CUSTOMIZATION_CONTROLLED",
|
|
12
|
+
CUSTOMIZATION_INSTRUCT = "CUSTOMIZATION_INSTRUCT"
|
|
13
|
+
}
|
|
14
|
+
export declare enum ImagenMaskMode {
|
|
15
|
+
MASK_MODE_USER_PROVIDED = "MASK_MODE_USER_PROVIDED",
|
|
16
|
+
MASK_MODE_BACKGROUND = "MASK_MODE_BACKGROUND",
|
|
17
|
+
MASK_MODE_FOREGROUND = "MASK_MODE_FOREGROUND",
|
|
18
|
+
MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
|
|
19
|
+
}
|
|
20
|
+
export interface ImagenOptions {
|
|
21
|
+
_option_id: "vertexai-imagen";
|
|
22
|
+
number_of_images?: number;
|
|
23
|
+
seed?: number;
|
|
24
|
+
person_generation?: "dont_allow" | "allow_adults" | "allow_all";
|
|
25
|
+
safety_setting?: "block_none" | "block_only_high" | "block_medium_and_above" | "block_low_and_above";
|
|
26
|
+
image_file_type?: "image/jpeg" | "image/png";
|
|
27
|
+
jpeg_compression_quality?: number;
|
|
28
|
+
aspect_ratio?: "1:1" | "4:3" | "3:4" | "16:9" | "9:16";
|
|
29
|
+
add_watermark?: boolean;
|
|
30
|
+
enhance_prompt?: boolean;
|
|
31
|
+
edit_mode?: ImagenTaskType;
|
|
32
|
+
guidance_scale?: number;
|
|
33
|
+
edit_steps?: number;
|
|
34
|
+
mask_mode?: ImagenMaskMode;
|
|
35
|
+
mask_dilation?: number;
|
|
36
|
+
mask_class?: number[];
|
|
37
|
+
controlType: "CONTROL_TYPE_FACE_MESH" | "CONTROL_TYPE_CANNY" | "CONTROL_TYPE_SCRIBBLE";
|
|
38
|
+
controlImageComputation?: boolean;
|
|
39
|
+
subjectType: "SUBJECT_TYPE_PERSON" | "SUBJECT_TYPE_ANIMAL" | "SUBJECT_TYPE_PRODUCT" | "SUBJECT_TYPE_DEFAULT";
|
|
40
|
+
}
|
|
41
|
+
export interface VertexAIClaudeOptions {
|
|
42
|
+
_option_id: "vertexai-claude";
|
|
43
|
+
max_tokens?: number;
|
|
44
|
+
temperature?: number;
|
|
45
|
+
top_p?: number;
|
|
46
|
+
top_k?: number;
|
|
47
|
+
stop_sequence?: string[];
|
|
48
|
+
thinking_mode?: boolean;
|
|
49
|
+
thinking_budget_tokens?: number;
|
|
50
|
+
}
|
|
51
|
+
export declare function getVertexAiOptions(model: string, option?: ModelOptions): ModelOptionsInfo;
|
|
52
|
+
//# sourceMappingURL=vertexai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertexai.d.ts","sourceRoot":"","sources":["../../../src/options/vertexai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAkD,YAAY,EAAE,MAAM,aAAa,CAAC;AAI7G,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,qBAAqB,CAAC;AAEpE,oBAAY,cAAc;IACtB,UAAU,eAAe;IACzB,yBAAyB,8BAA8B;IACvD,2BAA2B,gCAAgC;IAC3D,gBAAgB,qBAAqB;IACrC,kBAAkB,uBAAuB;IACzC,qBAAqB,0BAA0B;IAC/C,mBAAmB,wBAAwB;IAC3C,wBAAwB,6BAA6B;IACrD,sBAAsB,2BAA2B;CACpD;AAED,oBAAY,cAAc;IACtB,uBAAuB,4BAA4B;IACnD,oBAAoB,yBAAyB;IAC7C,oBAAoB,yBAAyB;IAC7C,kBAAkB,uBAAuB;CAC5C;AAED,MAAM,WAAW,aAAa;IAC1B,UAAU,EAAE,iBAAiB,CAAA;IAG7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iBAAiB,CAAC,EAAE,YAAY,GAAG,cAAc,GAAG,WAAW,CAAC;IAChE,cAAc,CAAC,EAAE,YAAY,GAAG,iBAAi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id: "text-fallback";
|
|
4
|
+
max_tokens?: number;
|
|
5
|
+
temperature?: number;
|
|
6
|
+
top_p?: number;
|
|
7
|
+
top_k?: number;
|
|
8
|
+
presence_penalty?: number;
|
|
9
|
+
frequency_penalty?: number;
|
|
10
|
+
stop_sequence?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const textOptionsFallback: ModelOptionsInfo;
|
|
13
|
+
export declare function getOptions(provider?: string, model?: string, options?: ModelOptions): ModelOptionsInfo;
|
|
14
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAA6B,MAAM,YAAY,CAAC;AAMvF,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,eAAO,MAAM,mBAAmB,EAAE,gBA6BjC,CAAC;AAEF,wBAAgB,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAatG"}
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { PromptFormatter } from './formatters/index.js';
|
|
2
|
+
import { JSONObject } from './json.js';
|
|
3
|
+
import { TextFallbackOptions } from './options.js';
|
|
4
|
+
import { BedrockOptions } from './options/bedrock.js';
|
|
5
|
+
import { OpenAiOptions } from './options/openai.js';
|
|
6
|
+
import { VertexAIOptions } from './options/vertexai.js';
|
|
4
7
|
export interface EmbeddingsOptions {
|
|
5
8
|
/**
|
|
6
|
-
* The
|
|
9
|
+
* The text to generate the embeddings for. One of text or image is required.
|
|
7
10
|
*/
|
|
8
|
-
|
|
11
|
+
text?: string;
|
|
9
12
|
/**
|
|
10
|
-
* The
|
|
13
|
+
* The image to generate embeddings for
|
|
11
14
|
*/
|
|
12
|
-
|
|
15
|
+
image?: string;
|
|
13
16
|
/**
|
|
14
|
-
*
|
|
15
|
-
* The supported properties depends on the target implementation.
|
|
17
|
+
* The model to use to generate the embeddings. Optional.
|
|
16
18
|
*/
|
|
17
|
-
|
|
19
|
+
model?: string;
|
|
18
20
|
}
|
|
19
21
|
export interface EmbeddingsResult {
|
|
20
22
|
/**
|
|
@@ -24,28 +26,52 @@ export interface EmbeddingsResult {
|
|
|
24
26
|
/**
|
|
25
27
|
* The model used to hgenerate the embeddings.
|
|
26
28
|
*/
|
|
27
|
-
model
|
|
29
|
+
model: string;
|
|
28
30
|
/**
|
|
29
31
|
* Number of tokens of the input text.
|
|
30
32
|
*/
|
|
31
33
|
token_count?: number;
|
|
32
|
-
/**
|
|
33
|
-
* Additional properties. Depends on the target implementation.
|
|
34
|
-
*/
|
|
35
|
-
[key: string]: any;
|
|
36
34
|
}
|
|
37
35
|
export interface ResultValidationError {
|
|
38
|
-
code: 'validation_error' | 'json_error';
|
|
36
|
+
code: 'validation_error' | 'json_error' | 'content_policy_violation';
|
|
39
37
|
message: string;
|
|
40
38
|
data?: string;
|
|
41
39
|
}
|
|
40
|
+
export interface CompletionChunkObject<ResultT = any> {
|
|
41
|
+
result: ResultT;
|
|
42
|
+
token_usage?: ExecutionTokenUsage;
|
|
43
|
+
finish_reason?: "stop" | "length" | string;
|
|
44
|
+
}
|
|
45
|
+
export type CompletionChunk = CompletionChunkObject | string;
|
|
46
|
+
export interface ToolDefinition {
|
|
47
|
+
name: string;
|
|
48
|
+
description?: string;
|
|
49
|
+
input_schema: {
|
|
50
|
+
type: 'object';
|
|
51
|
+
properties?: unknown | null | undefined;
|
|
52
|
+
[k: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A tool use instance represents a call to a tool.
|
|
57
|
+
* The id property is used to identify the tool call.
|
|
58
|
+
*/
|
|
59
|
+
export interface ToolUse<ParamsT = JSONObject> {
|
|
60
|
+
id: string;
|
|
61
|
+
tool_name: string;
|
|
62
|
+
tool_input: ParamsT | null;
|
|
63
|
+
}
|
|
42
64
|
export interface Completion<ResultT = any> {
|
|
43
65
|
result: ResultT;
|
|
44
66
|
token_usage?: ExecutionTokenUsage;
|
|
67
|
+
/**
|
|
68
|
+
* Contains the tools from which the model awaits information.
|
|
69
|
+
*/
|
|
70
|
+
tool_use?: ToolUse[];
|
|
45
71
|
/**
|
|
46
72
|
* The finish reason as reported by the model: stop | length or other model specific values
|
|
47
73
|
*/
|
|
48
|
-
finish_reason?: "stop" | "length" | string;
|
|
74
|
+
finish_reason?: "stop" | "length" | "tool_use" | string;
|
|
49
75
|
/**
|
|
50
76
|
* Set only if a result validation error occured, otherwise if the result is valid the error field is undefined
|
|
51
77
|
* This can only be set if the result_schema is set and the reuslt could not be parsed as a json or if the result does not match the schema
|
|
@@ -55,6 +81,13 @@ export interface Completion<ResultT = any> {
|
|
|
55
81
|
* The original response. Only included if the option include_original_response is set to true and the request is made using execute. Not supported when streaming.
|
|
56
82
|
*/
|
|
57
83
|
original_response?: Record<string, any>;
|
|
84
|
+
/**
|
|
85
|
+
* The conversation context. This is an opaque structure that can be passed to the next request to restore the context.
|
|
86
|
+
*/
|
|
87
|
+
conversation?: unknown;
|
|
88
|
+
}
|
|
89
|
+
export interface ImageGeneration {
|
|
90
|
+
images?: string[];
|
|
58
91
|
}
|
|
59
92
|
export interface ExecutionResponse<PromptT = any> extends Completion {
|
|
60
93
|
prompt: PromptT;
|
|
@@ -62,6 +95,10 @@ export interface ExecutionResponse<PromptT = any> extends Completion {
|
|
|
62
95
|
* The time it took to execute the request in seconds
|
|
63
96
|
*/
|
|
64
97
|
execution_time?: number;
|
|
98
|
+
/**
|
|
99
|
+
* The number of chunks for streamed executions
|
|
100
|
+
*/
|
|
101
|
+
chunks?: number;
|
|
65
102
|
}
|
|
66
103
|
export interface CompletionStream<PromptT = any> extends AsyncIterable<string> {
|
|
67
104
|
completion: ExecutionResponse<PromptT> | undefined;
|
|
@@ -75,6 +112,14 @@ export interface Logger {
|
|
|
75
112
|
export interface DriverOptions {
|
|
76
113
|
logger?: Logger | "console";
|
|
77
114
|
}
|
|
115
|
+
export type JSONSchema4TypeName = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
116
|
+
export interface JSONSchema {
|
|
117
|
+
type?: JSONSchema4TypeName | JSONSchema4TypeName[];
|
|
118
|
+
description?: string;
|
|
119
|
+
properties?: Record<string, JSONSchema>;
|
|
120
|
+
required?: string[];
|
|
121
|
+
[k: string]: any;
|
|
122
|
+
}
|
|
78
123
|
export interface PromptOptions {
|
|
79
124
|
model: string;
|
|
80
125
|
/**
|
|
@@ -82,56 +127,103 @@ export interface PromptOptions {
|
|
|
82
127
|
* If no one is specified the driver will choose a formatter compatible with the target model
|
|
83
128
|
*/
|
|
84
129
|
format?: PromptFormatter;
|
|
85
|
-
result_schema?:
|
|
130
|
+
result_schema?: JSONSchema;
|
|
86
131
|
}
|
|
87
|
-
export interface
|
|
88
|
-
temperature?: number;
|
|
89
|
-
max_tokens?: number;
|
|
90
|
-
stop_sequence?: string | string[];
|
|
91
|
-
/**
|
|
92
|
-
* restricts the selection of tokens to the “k” most likely options, based on their probabilities
|
|
93
|
-
* Lower values make the model more deterministic, more focused. Examples:
|
|
94
|
-
* - 10 - result will be highly controlled anc contextually relevant
|
|
95
|
-
* - 50 - result will be more creative but maintaining a balance between control and creativity
|
|
96
|
-
* - 100 - will lead to more creative and less predictable outputs
|
|
97
|
-
* It will be ignored on OpenAI since it does not support it
|
|
98
|
-
*/
|
|
99
|
-
top_k?: number;
|
|
100
|
-
/**
|
|
101
|
-
* An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.
|
|
102
|
-
* Either use temperature or top_p, not both
|
|
103
|
-
*/
|
|
104
|
-
top_p?: number;
|
|
105
|
-
/**
|
|
106
|
-
* Only supported for OpenAI. Look at OpenAI documentation for more detailsx
|
|
107
|
-
*/
|
|
108
|
-
top_logprobs?: number;
|
|
109
|
-
/**
|
|
110
|
-
* Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
|
|
111
|
-
* Ignored for models which doesn;t support it
|
|
112
|
-
*/
|
|
113
|
-
presence_penalty?: number;
|
|
114
|
-
/**
|
|
115
|
-
* Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
|
|
116
|
-
* Ignored for models which doesn;t support it
|
|
117
|
-
*/
|
|
118
|
-
frequency_penalty?: number;
|
|
132
|
+
export interface StatelessExecutionOptions extends PromptOptions {
|
|
119
133
|
/**
|
|
120
134
|
* If set to true the original response from the target LLM will be included in the response under the original_response field.
|
|
121
135
|
* This is useful for debugging and for some advanced use cases.
|
|
122
136
|
* It is ignored on streaming requests
|
|
123
137
|
*/
|
|
124
138
|
include_original_response?: boolean;
|
|
139
|
+
model_options?: ModelOptions;
|
|
140
|
+
output_modality: Modalities;
|
|
141
|
+
}
|
|
142
|
+
export interface ExecutionOptions extends StatelessExecutionOptions {
|
|
143
|
+
/**
|
|
144
|
+
* Available tools for the request
|
|
145
|
+
*/
|
|
146
|
+
tools?: ToolDefinition[];
|
|
147
|
+
/**
|
|
148
|
+
* This is an opaque structure that provides a conversation context
|
|
149
|
+
* Each driver implementation will return a conversation property in the execution response
|
|
150
|
+
* that can be passed here to restore the context when a new prompt is sent to the model.
|
|
151
|
+
*/
|
|
152
|
+
conversation?: unknown | null;
|
|
153
|
+
}
|
|
154
|
+
export declare enum SharedOptions {
|
|
155
|
+
max_tokens = "max_tokens",
|
|
156
|
+
temperature = "temperature",
|
|
157
|
+
top_p = "top_p",
|
|
158
|
+
top_k = "top_k",
|
|
159
|
+
presence_penalty = "presence_penalty",
|
|
160
|
+
frequency_penalty = "frequency_penalty",
|
|
161
|
+
stop_sequence = "stop_sequence",
|
|
162
|
+
seed = "seed",
|
|
163
|
+
number_of_images = "number_of_images"
|
|
164
|
+
}
|
|
165
|
+
export declare enum OptionType {
|
|
166
|
+
numeric = "numeric",
|
|
167
|
+
enum = "enum",
|
|
168
|
+
boolean = "boolean",
|
|
169
|
+
string_list = "string_list"
|
|
170
|
+
}
|
|
171
|
+
export type ModelOptions = TextFallbackOptions | VertexAIOptions | BedrockOptions | OpenAiOptions;
|
|
172
|
+
export interface ModelOptionsInfo {
|
|
173
|
+
options: ModelOptionInfoItem[];
|
|
174
|
+
_option_id: string;
|
|
175
|
+
}
|
|
176
|
+
export type ModelOptionInfoItem = NumericOptionInfo | EnumOptionInfo | BooleanOptionInfo | StringListOptionInfo;
|
|
177
|
+
interface OptionInfoPrototype {
|
|
178
|
+
type: OptionType;
|
|
179
|
+
name: string;
|
|
180
|
+
description?: string;
|
|
181
|
+
refresh?: boolean;
|
|
182
|
+
}
|
|
183
|
+
export interface NumericOptionInfo extends OptionInfoPrototype {
|
|
184
|
+
type: OptionType.numeric;
|
|
185
|
+
value?: number;
|
|
186
|
+
min?: number;
|
|
187
|
+
max?: number;
|
|
188
|
+
step?: number;
|
|
189
|
+
integer?: boolean;
|
|
190
|
+
default?: number;
|
|
191
|
+
}
|
|
192
|
+
export interface EnumOptionInfo extends OptionInfoPrototype {
|
|
193
|
+
type: OptionType.enum;
|
|
194
|
+
value?: string;
|
|
195
|
+
enum: Record<string, string>;
|
|
196
|
+
default?: string;
|
|
197
|
+
}
|
|
198
|
+
export interface BooleanOptionInfo extends OptionInfoPrototype {
|
|
199
|
+
type: OptionType.boolean;
|
|
200
|
+
value?: boolean;
|
|
201
|
+
default?: boolean;
|
|
202
|
+
}
|
|
203
|
+
export interface StringListOptionInfo extends OptionInfoPrototype {
|
|
204
|
+
type: OptionType.string_list;
|
|
205
|
+
value?: string[];
|
|
206
|
+
default?: string[];
|
|
125
207
|
}
|
|
126
208
|
export declare enum PromptRole {
|
|
127
209
|
safety = "safety",
|
|
128
210
|
system = "system",
|
|
129
211
|
user = "user",
|
|
130
|
-
assistant = "assistant"
|
|
212
|
+
assistant = "assistant",
|
|
213
|
+
negative = "negative",
|
|
214
|
+
mask = "mask",
|
|
215
|
+
/**
|
|
216
|
+
* Used to send the response of a tool
|
|
217
|
+
*/
|
|
218
|
+
tool = "tool"
|
|
131
219
|
}
|
|
132
220
|
export interface PromptSegment {
|
|
133
221
|
role: PromptRole;
|
|
134
222
|
content: string;
|
|
223
|
+
/**
|
|
224
|
+
* The tool use id if the segment is a tool response
|
|
225
|
+
*/
|
|
226
|
+
tool_use_id?: string;
|
|
135
227
|
files?: DataSource[];
|
|
136
228
|
}
|
|
137
229
|
export interface ExecutionTokenUsage {
|
|
@@ -139,6 +231,10 @@ export interface ExecutionTokenUsage {
|
|
|
139
231
|
result?: number;
|
|
140
232
|
total?: number;
|
|
141
233
|
}
|
|
234
|
+
export declare enum Modalities {
|
|
235
|
+
text = "text",
|
|
236
|
+
image = "image"
|
|
237
|
+
}
|
|
142
238
|
export interface AIModel<ProviderKeys = string> {
|
|
143
239
|
id: string;
|
|
144
240
|
name: string;
|
|
@@ -152,6 +248,8 @@ export interface AIModel<ProviderKeys = string> {
|
|
|
152
248
|
can_stream?: boolean;
|
|
153
249
|
is_custom?: boolean;
|
|
154
250
|
is_multimodal?: boolean;
|
|
251
|
+
input_modalities?: string[];
|
|
252
|
+
environment?: string;
|
|
155
253
|
}
|
|
156
254
|
export declare enum AIModelStatus {
|
|
157
255
|
Available = "available",
|
|
@@ -207,7 +305,7 @@ export interface TrainingPromptOptions {
|
|
|
207
305
|
segments: PromptSegment[];
|
|
208
306
|
completion: string | JSONObject;
|
|
209
307
|
model: string;
|
|
210
|
-
schema?:
|
|
308
|
+
schema?: JSONSchema;
|
|
211
309
|
}
|
|
212
310
|
export declare enum TrainingJobStatus {
|
|
213
311
|
running = "running",
|
|
@@ -221,4 +319,5 @@ export interface TrainingJob {
|
|
|
221
319
|
details?: string;
|
|
222
320
|
model?: string;
|
|
223
321
|
}
|
|
322
|
+
export {};
|
|
224
323
|
//# sourceMappingURL=types.d.ts.map
|