llm-exe 2.2.1 → 2.3.1
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/dist/index.d.mts +120 -22
- package/dist/index.d.ts +120 -22
- package/dist/index.js +475 -174
- package/dist/index.mjs +474 -174
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -31,21 +31,23 @@ interface IChatUserMessage extends IChatMessageBase {
|
|
|
31
31
|
name?: string;
|
|
32
32
|
}
|
|
33
33
|
interface IChatFunctionMessage extends IChatMessageBase {
|
|
34
|
+
id?: string;
|
|
34
35
|
role: Extract<IChatMessageRole, "function">;
|
|
35
36
|
content: string;
|
|
36
37
|
name: string;
|
|
37
38
|
}
|
|
38
39
|
interface IChatAssistantMessage extends IChatMessageBase {
|
|
39
|
-
role: Extract<IChatMessageRole, "assistant">;
|
|
40
|
+
role: Extract<IChatMessageRole, "assistant" | "model">;
|
|
40
41
|
content: string;
|
|
41
42
|
function_call?: undefined;
|
|
42
43
|
}
|
|
43
|
-
interface
|
|
44
|
-
role: Extract<IChatMessageRole, "
|
|
44
|
+
interface IChatFunctionCallMessage extends IChatMessageBase {
|
|
45
|
+
role: Extract<IChatMessageRole, "function_call">;
|
|
45
46
|
content: null;
|
|
46
|
-
function_call
|
|
47
|
+
function_call: {
|
|
47
48
|
name: string;
|
|
48
49
|
arguments: string;
|
|
50
|
+
id?: string;
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
interface IChatSystemMessage extends IChatMessageBase {
|
|
@@ -57,8 +59,8 @@ interface IChatMessagesPlaceholder {
|
|
|
57
59
|
content: string;
|
|
58
60
|
}
|
|
59
61
|
type IPromptMessages = (IChatSystemMessage | IChatMessagesPlaceholder)[];
|
|
60
|
-
type IPromptChatMessages = (IChatUserMessage | IChatAssistantMessage |
|
|
61
|
-
type IChatMessage = IChatUserMessage | IChatAssistantMessage |
|
|
62
|
+
type IPromptChatMessages = (IChatUserMessage | IChatAssistantMessage | IChatFunctionCallMessage | IChatSystemMessage | IChatMessagesPlaceholder | IChatFunctionMessage)[];
|
|
63
|
+
type IChatMessage = IChatUserMessage | IChatAssistantMessage | IChatFunctionCallMessage | IChatSystemMessage | IChatFunctionMessage;
|
|
62
64
|
type IChatMessages = IChatMessage[];
|
|
63
65
|
|
|
64
66
|
type OpenAIChatModelName = "gpt-3.5-turbo" | "gpt-3.5-turbo-0613" | "gpt-3.5-turbo-16k" | "gpt-4-0613" | "gpt-4" | "gpt-4o" | "gpt-4o-mini" | "gpt-4-0613" | "gpt-4-32k-0613" | `gpt-4${string}` | `gpt-3.5-turbo-${string}`;
|
|
@@ -66,6 +68,7 @@ type OpenAIConversationModelName = "davinci" | "text-curie-001" | "text-babbage-
|
|
|
66
68
|
type OpenAIEmbeddingModelName = "text-embedding-ada-002";
|
|
67
69
|
type OpenAIModelName = OpenAIChatModelName | OpenAIConversationModelName | OpenAIEmbeddingModelName;
|
|
68
70
|
|
|
71
|
+
type ParserInput = string | OutputResult;
|
|
69
72
|
/**
|
|
70
73
|
* BaseParser is an abstract class for parsing text and enforcing JSON schema on the parsed data.
|
|
71
74
|
*/
|
|
@@ -86,7 +89,7 @@ declare abstract class BaseParser<T = any> {
|
|
|
86
89
|
* @param [attributes] - Optional attributes to use during parsing.
|
|
87
90
|
* @returns The parsed data.
|
|
88
91
|
*/
|
|
89
|
-
abstract parse(text:
|
|
92
|
+
abstract parse(text: ParserInput, attributes?: Record<string, any>): T;
|
|
90
93
|
}
|
|
91
94
|
declare abstract class BaseParserWithJson<S extends JSONSchema | undefined = undefined, T = S extends JSONSchema ? FromSchema<S> : Record<string, any>> extends BaseParser<T> {
|
|
92
95
|
schema: S;
|
|
@@ -103,7 +106,7 @@ interface StringParserOptions extends BaseParserOptions {
|
|
|
103
106
|
}
|
|
104
107
|
declare class StringParser extends BaseParser<string> {
|
|
105
108
|
constructor(options?: StringParserOptions);
|
|
106
|
-
parse(text: string |
|
|
109
|
+
parse(text: string | OutputResult, _options?: Record<string, any>): string;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
interface BooleanParserOptions extends BaseParserOptions {
|
|
@@ -301,16 +304,27 @@ declare function createParser<T extends Extract<CreateParserType, "json">, S ext
|
|
|
301
304
|
declare function createParser<T extends CreateParserType, S extends JSONSchema | undefined = undefined>(type: T, options?: BaseParserOptionsWithSchema<S> | BaseParserOptions): JsonParser<S> | ListToJsonParser<S> | StringParser | NumberParser | BooleanParser | ListToArrayParser | ListToKeyValueParser | ReplaceStringTemplateParser | MarkdownCodeBlockParser | MarkdownCodeBlocksParser | StringExtractParser;
|
|
302
305
|
declare function createCustomParser<O>(name: string, parserFn: (text: string, inputValues: ExecutorContext<any, any>) => O): CustomParser<ReturnType<typeof parserFn>>;
|
|
303
306
|
|
|
307
|
+
declare class LlmFunctionParser<T extends BaseParser<any>> extends BaseParser<ParserOutput<T> | OutputResultContent[]> {
|
|
308
|
+
parser: T;
|
|
309
|
+
constructor(options: LlmNativeFunctionParserOptions<T>);
|
|
310
|
+
parse(text: OutputResult, _options?: Record<string, any>): OutputResultContent[] | ParserOutput<T>;
|
|
311
|
+
}
|
|
312
|
+
interface LlmNativeFunctionParserOptions<T extends BaseParser<any>> extends BaseParserOptions {
|
|
313
|
+
parser: T;
|
|
314
|
+
}
|
|
304
315
|
interface LlmNativeFunctionParserOptions<T extends BaseParser<any>> extends BaseParserOptions {
|
|
305
316
|
parser: T;
|
|
306
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* @deprecated Use `LlmFunctionParser` instead.
|
|
320
|
+
*/
|
|
307
321
|
declare class LlmNativeFunctionParser<T extends BaseParser<any>> extends BaseParser<ParserOutput<T> | {
|
|
308
322
|
name: any;
|
|
309
323
|
arguments: any;
|
|
310
324
|
}> {
|
|
311
325
|
parser: T;
|
|
312
326
|
constructor(options: LlmNativeFunctionParserOptions<T>);
|
|
313
|
-
parse(text:
|
|
327
|
+
parse(text: OutputResult, _options?: Record<string, any>): ParserOutput<T> | {
|
|
314
328
|
name: string;
|
|
315
329
|
arguments: any;
|
|
316
330
|
};
|
|
@@ -435,7 +449,7 @@ declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
|
|
|
435
449
|
* @param name (optional) The name of the user. Only accepted if role is `user`.
|
|
436
450
|
* @return instance of ChatPrompt.
|
|
437
451
|
*/
|
|
438
|
-
addToPrompt(content: string, role: Extract<IChatMessageRole, "assistant">, name?: undefined): ChatPrompt<I>;
|
|
452
|
+
addToPrompt(content: string, role: Extract<IChatMessageRole, "assistant" | "model">, name?: undefined): ChatPrompt<I>;
|
|
439
453
|
addToPrompt(content: string, role: Extract<IChatMessageRole, "system">, name?: undefined): ChatPrompt<I>;
|
|
440
454
|
addToPrompt(content: string, role: Extract<IChatMessageRole, "user">, name?: string): ChatPrompt<I>;
|
|
441
455
|
addToPrompt(content: string, role: Extract<IChatMessageRole, "function">, name: string): ChatPrompt<I>;
|
|
@@ -458,7 +472,7 @@ declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
|
|
|
458
472
|
* @param content The message content.
|
|
459
473
|
* @return ChatPrompt so it can be chained.
|
|
460
474
|
*/
|
|
461
|
-
addFunctionMessage(content: string, name: string): ChatPrompt<I>;
|
|
475
|
+
addFunctionMessage(content: string, name: string, id?: string): ChatPrompt<I>;
|
|
462
476
|
/**
|
|
463
477
|
* addFunctionCallMessage Helper to add an assistant message to the prompt.
|
|
464
478
|
* @param content The message content.
|
|
@@ -467,6 +481,7 @@ declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
|
|
|
467
481
|
addFunctionCallMessage(function_call?: {
|
|
468
482
|
name: string;
|
|
469
483
|
arguments: string;
|
|
484
|
+
id?: string;
|
|
470
485
|
}): this;
|
|
471
486
|
/**
|
|
472
487
|
* addFromHistory Adds multiple messages at one time.
|
|
@@ -657,13 +672,27 @@ declare class Dialogue extends BaseStateItem<IChatMessages> {
|
|
|
657
672
|
name: string;
|
|
658
673
|
constructor(name: string);
|
|
659
674
|
setUserMessage(content: string | IChatMessageContentDetailed[], name?: string): this;
|
|
660
|
-
setAssistantMessage(content: string): this;
|
|
675
|
+
setAssistantMessage(content: string | OutputResultsText): this;
|
|
661
676
|
setSystemMessage(content: string): this;
|
|
662
|
-
|
|
677
|
+
setToolMessage(content: string, name: string, id?: string): void;
|
|
678
|
+
setFunctionMessage(content: string, name: string, id?: string): this;
|
|
679
|
+
/**
|
|
680
|
+
* Set
|
|
681
|
+
*/
|
|
682
|
+
setToolCallMessage(input: {
|
|
683
|
+
name: string;
|
|
684
|
+
arguments: string;
|
|
685
|
+
id?: string;
|
|
686
|
+
}): void;
|
|
663
687
|
setFunctionCallMessage(input: {
|
|
688
|
+
name: string;
|
|
689
|
+
arguments: string;
|
|
690
|
+
id?: string;
|
|
691
|
+
} | {
|
|
664
692
|
function_call: {
|
|
665
693
|
name: string;
|
|
666
694
|
arguments: string;
|
|
695
|
+
id?: string;
|
|
667
696
|
};
|
|
668
697
|
}): this;
|
|
669
698
|
setMessageTurn(userMessage: string, assistantMessage: string, systemMessage?: string): this;
|
|
@@ -674,6 +703,13 @@ declare class Dialogue extends BaseStateItem<IChatMessages> {
|
|
|
674
703
|
name: string;
|
|
675
704
|
value: IChatMessage[];
|
|
676
705
|
};
|
|
706
|
+
/**
|
|
707
|
+
* Add LLM output to dialogue history in the order it was returned
|
|
708
|
+
*
|
|
709
|
+
* @param output - The LLM output result from llm.call()
|
|
710
|
+
* @returns this for chaining
|
|
711
|
+
*/
|
|
712
|
+
addFromOutput(output: OutputResult | BaseLlCall): this;
|
|
677
713
|
}
|
|
678
714
|
|
|
679
715
|
declare abstract class BaseState {
|
|
@@ -730,14 +766,19 @@ declare class LlmExecutor<Llm extends BaseLlm<any>, Prompt extends BasePrompt<Re
|
|
|
730
766
|
/**
|
|
731
767
|
* Core Executor With LLM
|
|
732
768
|
*/
|
|
733
|
-
declare class LlmExecutorWithFunctions<Llm extends BaseLlm, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState> extends LlmExecutor<Llm, Prompt, Parser
|
|
769
|
+
declare class LlmExecutorWithFunctions<Llm extends BaseLlm, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState = BaseState> extends LlmExecutor<Llm, Prompt, LlmFunctionParser<Parser>, State> {
|
|
734
770
|
constructor(llmConfiguration: ExecutorWithLlmOptions<Llm, Prompt, Parser, State>, options?: CoreExecutorExecuteOptions<LlmExecutorHooks>);
|
|
735
|
-
execute<T extends GenericFunctionCall>(_input: PromptInput<Prompt>, _options: LlmExecutorWithFunctionsOptions<T>): Promise<ParserOutput<Parser>>;
|
|
771
|
+
execute<T extends GenericFunctionCall>(_input: PromptInput<Prompt>, _options: LlmExecutorWithFunctionsOptions<T>): Promise<OutputResultContent[] | ParserOutput<Parser>>;
|
|
736
772
|
}
|
|
737
773
|
/**
|
|
738
774
|
* @deprecated Use `LlmExecutorWithFunctions` instead.
|
|
739
775
|
*/
|
|
740
|
-
declare class LlmExecutorOpenAiFunctions<Llm extends BaseLlm, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState> extends
|
|
776
|
+
declare class LlmExecutorOpenAiFunctions<Llm extends BaseLlm, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState = BaseState> extends LlmExecutor<Llm, Prompt, LlmNativeFunctionParser<Parser>, State> {
|
|
777
|
+
constructor(llmConfiguration: ExecutorWithLlmOptions<Llm, Prompt, Parser, State>, options?: CoreExecutorExecuteOptions<LlmExecutorHooks>);
|
|
778
|
+
execute<T extends GenericFunctionCall>(_input: PromptInput<Prompt>, _options: LlmExecutorWithFunctionsOptions<T>): Promise<ParserOutput<Parser> | {
|
|
779
|
+
name: string;
|
|
780
|
+
arguments: any;
|
|
781
|
+
}>;
|
|
741
782
|
}
|
|
742
783
|
|
|
743
784
|
/**
|
|
@@ -848,6 +889,9 @@ interface BaseParserOptionsWithSchema<S extends JSONSchema | undefined = undefin
|
|
|
848
889
|
validateSchema?: boolean;
|
|
849
890
|
}
|
|
850
891
|
|
|
892
|
+
/**
|
|
893
|
+
* Internal Formats
|
|
894
|
+
*/
|
|
851
895
|
interface OutputResultsBase {
|
|
852
896
|
type: "text" | "function_use";
|
|
853
897
|
text?: string;
|
|
@@ -860,6 +904,7 @@ interface OutputResultsFunction extends OutputResultsBase {
|
|
|
860
904
|
type: "function_use";
|
|
861
905
|
name: string;
|
|
862
906
|
input: Record<string, any>;
|
|
907
|
+
functionId: string;
|
|
863
908
|
}
|
|
864
909
|
type OutputResultContent = OutputResultsText | OutputResultsFunction;
|
|
865
910
|
interface OutputResult {
|
|
@@ -997,6 +1042,12 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
997
1042
|
"openai.gpt-4o-mini": {
|
|
998
1043
|
input: Omit<OpenAiRequest, "model">;
|
|
999
1044
|
};
|
|
1045
|
+
"anthropic.claude-sonnet-4-0": {
|
|
1046
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1047
|
+
};
|
|
1048
|
+
"anthropic.claude-opus-4-0": {
|
|
1049
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1050
|
+
};
|
|
1000
1051
|
"anthropic.claude-3-7-sonnet": {
|
|
1001
1052
|
input: Omit<AnthropicRequest, "model">;
|
|
1002
1053
|
};
|
|
@@ -1021,12 +1072,27 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1021
1072
|
"google.gemini-2.0-flash-lite": {
|
|
1022
1073
|
input: Omit<GeminiRequest, "model">;
|
|
1023
1074
|
};
|
|
1075
|
+
"google.gemini-2.5-flash": {
|
|
1076
|
+
input: Omit<GeminiRequest, "model">;
|
|
1077
|
+
};
|
|
1078
|
+
"google.gemini-2.5-flash-lite": {
|
|
1079
|
+
input: Omit<GeminiRequest, "model">;
|
|
1080
|
+
};
|
|
1024
1081
|
"google.gemini-1.5-pro": {
|
|
1025
1082
|
input: Omit<GeminiRequest, "model">;
|
|
1026
1083
|
};
|
|
1084
|
+
"google.gemini-2.5-pro": {
|
|
1085
|
+
input: Omit<GeminiRequest, "model">;
|
|
1086
|
+
};
|
|
1027
1087
|
"xai.grok-2": {
|
|
1028
1088
|
input: OpenAiRequest;
|
|
1029
1089
|
};
|
|
1090
|
+
"xai.grok-3": {
|
|
1091
|
+
input: OpenAiRequest;
|
|
1092
|
+
};
|
|
1093
|
+
"xai.grok-4": {
|
|
1094
|
+
input: OpenAiRequest;
|
|
1095
|
+
};
|
|
1030
1096
|
"ollama.deepseek-r1": {
|
|
1031
1097
|
input: GenericLLm;
|
|
1032
1098
|
};
|
|
@@ -1241,13 +1307,45 @@ declare namespace index {
|
|
|
1241
1307
|
export { index_assert as assert, index_asyncCallWithTimeout as asyncCallWithTimeout, index_defineSchema as defineSchema, index_filterObjectOnSchema as filterObjectOnSchema, index_guessProviderFromModel as guessProviderFromModel, index_importHelpers as importHelpers, index_importPartials as importPartials, index_isObjectStringified as isObjectStringified, index_maybeParseJSON as maybeParseJSON, index_maybeStringifyJSON as maybeStringifyJSON, index_registerHelpers as registerHelpers, index_registerPartials as registerPartials, index_replaceTemplateString as replaceTemplateString, index_replaceTemplateStringAsync as replaceTemplateStringAsync };
|
|
1242
1308
|
}
|
|
1243
1309
|
|
|
1310
|
+
declare function isOutputResult(obj: any): obj is OutputResult;
|
|
1311
|
+
declare function isOutputResultContentText(obj: any): obj is OutputResultsText;
|
|
1312
|
+
/**
|
|
1313
|
+
* Does a llm response have a tool/function call?
|
|
1314
|
+
*/
|
|
1315
|
+
declare function isFunctionCall(result: any): result is OutputResultsFunction;
|
|
1316
|
+
declare function isToolCall(result: any): result is OutputResultsFunction;
|
|
1317
|
+
/**
|
|
1318
|
+
* Is it a tool/function Call
|
|
1319
|
+
*/
|
|
1320
|
+
declare function hasFunctionCall(results: any): boolean;
|
|
1321
|
+
declare function hasToolCall(results: any): boolean;
|
|
1322
|
+
declare function isUserMessage(message: IChatMessage): message is IChatUserMessage;
|
|
1323
|
+
declare function isAssistantMessage(message: IChatMessage): message is IChatAssistantMessage;
|
|
1324
|
+
declare function isSystemMessage(message: IChatMessage): message is IChatSystemMessage;
|
|
1325
|
+
|
|
1326
|
+
declare const guards_hasFunctionCall: typeof hasFunctionCall;
|
|
1327
|
+
declare const guards_hasToolCall: typeof hasToolCall;
|
|
1328
|
+
declare const guards_isAssistantMessage: typeof isAssistantMessage;
|
|
1329
|
+
declare const guards_isFunctionCall: typeof isFunctionCall;
|
|
1330
|
+
declare const guards_isOutputResult: typeof isOutputResult;
|
|
1331
|
+
declare const guards_isOutputResultContentText: typeof isOutputResultContentText;
|
|
1332
|
+
declare const guards_isSystemMessage: typeof isSystemMessage;
|
|
1333
|
+
declare const guards_isToolCall: typeof isToolCall;
|
|
1334
|
+
declare const guards_isUserMessage: typeof isUserMessage;
|
|
1335
|
+
declare namespace guards {
|
|
1336
|
+
export { guards_hasFunctionCall as hasFunctionCall, guards_hasToolCall as hasToolCall, guards_isAssistantMessage as isAssistantMessage, guards_isFunctionCall as isFunctionCall, guards_isOutputResult as isOutputResult, guards_isOutputResultContentText as isOutputResultContentText, guards_isSystemMessage as isSystemMessage, guards_isToolCall as isToolCall, guards_isUserMessage as isUserMessage };
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1244
1339
|
declare const configs: {
|
|
1245
1340
|
"deepseek.chat.v1": Config<keyof AllLlm>;
|
|
1246
1341
|
"deepseek.chat": Config<keyof AllLlm>;
|
|
1247
1342
|
"google.chat.v1": Config<keyof AllLlm>;
|
|
1248
1343
|
"google.gemini-2.0-flash": Config<keyof AllLlm>;
|
|
1249
1344
|
"google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
|
|
1345
|
+
"google.gemini-2.5-flash": Config<keyof AllLlm>;
|
|
1346
|
+
"google.gemini-2.5-flash-lite": Config<keyof AllLlm>;
|
|
1250
1347
|
"google.gemini-1.5-pro": Config<keyof AllLlm>;
|
|
1348
|
+
"google.gemini-2.5-pro": Config<keyof AllLlm>;
|
|
1251
1349
|
"ollama.chat.v1": Config<keyof AllLlm>;
|
|
1252
1350
|
"ollama.deepseek-r1": Config<keyof AllLlm>;
|
|
1253
1351
|
"ollama.llama3.3": Config<keyof AllLlm>;
|
|
@@ -1256,9 +1354,13 @@ declare const configs: {
|
|
|
1256
1354
|
"ollama.qwq": Config<keyof AllLlm>;
|
|
1257
1355
|
"xai.chat.v1": Config<keyof AllLlm>;
|
|
1258
1356
|
"xai.grok-2": Config<keyof AllLlm>;
|
|
1357
|
+
"xai.grok-3": Config<keyof AllLlm>;
|
|
1358
|
+
"xai.grok-4": Config<keyof AllLlm>;
|
|
1259
1359
|
"amazon:anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1260
1360
|
"amazon:meta.chat.v1": Config<keyof AllLlm>;
|
|
1261
1361
|
"anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1362
|
+
"anthropic.claude-sonnet-4-0": Config<keyof AllLlm>;
|
|
1363
|
+
"anthropic.claude-opus-4-0": Config<keyof AllLlm>;
|
|
1262
1364
|
"anthropic.claude-3-7-sonnet": Config<keyof AllLlm>;
|
|
1263
1365
|
"anthropic.claude-3-5-sonnet": Config<keyof AllLlm>;
|
|
1264
1366
|
"anthropic.claude-3-5-haiku": Config<keyof AllLlm>;
|
|
@@ -1270,11 +1372,7 @@ declare const configs: {
|
|
|
1270
1372
|
};
|
|
1271
1373
|
|
|
1272
1374
|
declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): {
|
|
1273
|
-
call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<
|
|
1274
|
-
getResultContent: (index?: number) => OutputResultContent[];
|
|
1275
|
-
getResultText: () => string;
|
|
1276
|
-
getResult: () => OutputResult;
|
|
1277
|
-
}>;
|
|
1375
|
+
call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<BaseLlCall>;
|
|
1278
1376
|
getTraceId: () => string | null;
|
|
1279
1377
|
withTraceId: (id: string) => void;
|
|
1280
1378
|
getMetadata: () => {
|
|
@@ -1308,4 +1406,4 @@ declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, op
|
|
|
1308
1406
|
};
|
|
1309
1407
|
};
|
|
1310
1408
|
|
|
1311
|
-
export { BaseExecutor, type BaseLlm, BaseParser, BasePrompt, BaseStateItem, ChatPrompt, CustomParser, DefaultState, DefaultStateItem, type EmbeddingProviderKey, type ExecutorContext, type IChatMessages, LlmExecutorOpenAiFunctions, LlmExecutorWithFunctions, LlmNativeFunctionParser, type LlmProvider, type LlmProviderKey, type OpenAIModelName, OpenAiFunctionParser, TextPrompt, type UseLlmKey, createCallableExecutor, createChatPrompt, createCoreExecutor, createCustomParser, createDialogue, createEmbedding, createLlmExecutor, createLlmFunctionExecutor, createParser, createPrompt, createState, createStateItem, defineSchema, registerHelpers, registerPartials, useExecutors, useLlm, index as utils };
|
|
1409
|
+
export { BaseExecutor, type BaseLlm, BaseParser, BasePrompt, BaseStateItem, ChatPrompt, CustomParser, DefaultState, DefaultStateItem, type EmbeddingProviderKey, type ExecutorContext, type IChatMessages, LlmExecutorOpenAiFunctions, LlmExecutorWithFunctions, LlmNativeFunctionParser, type LlmProvider, type LlmProviderKey, type OpenAIModelName, OpenAiFunctionParser, TextPrompt, type UseLlmKey, createCallableExecutor, createChatPrompt, createCoreExecutor, createCustomParser, createDialogue, createEmbedding, createLlmExecutor, createLlmFunctionExecutor, createParser, createPrompt, createState, createStateItem, defineSchema, guards, registerHelpers, registerPartials, useExecutors, useLlm, index as utils };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,21 +31,23 @@ interface IChatUserMessage extends IChatMessageBase {
|
|
|
31
31
|
name?: string;
|
|
32
32
|
}
|
|
33
33
|
interface IChatFunctionMessage extends IChatMessageBase {
|
|
34
|
+
id?: string;
|
|
34
35
|
role: Extract<IChatMessageRole, "function">;
|
|
35
36
|
content: string;
|
|
36
37
|
name: string;
|
|
37
38
|
}
|
|
38
39
|
interface IChatAssistantMessage extends IChatMessageBase {
|
|
39
|
-
role: Extract<IChatMessageRole, "assistant">;
|
|
40
|
+
role: Extract<IChatMessageRole, "assistant" | "model">;
|
|
40
41
|
content: string;
|
|
41
42
|
function_call?: undefined;
|
|
42
43
|
}
|
|
43
|
-
interface
|
|
44
|
-
role: Extract<IChatMessageRole, "
|
|
44
|
+
interface IChatFunctionCallMessage extends IChatMessageBase {
|
|
45
|
+
role: Extract<IChatMessageRole, "function_call">;
|
|
45
46
|
content: null;
|
|
46
|
-
function_call
|
|
47
|
+
function_call: {
|
|
47
48
|
name: string;
|
|
48
49
|
arguments: string;
|
|
50
|
+
id?: string;
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
interface IChatSystemMessage extends IChatMessageBase {
|
|
@@ -57,8 +59,8 @@ interface IChatMessagesPlaceholder {
|
|
|
57
59
|
content: string;
|
|
58
60
|
}
|
|
59
61
|
type IPromptMessages = (IChatSystemMessage | IChatMessagesPlaceholder)[];
|
|
60
|
-
type IPromptChatMessages = (IChatUserMessage | IChatAssistantMessage |
|
|
61
|
-
type IChatMessage = IChatUserMessage | IChatAssistantMessage |
|
|
62
|
+
type IPromptChatMessages = (IChatUserMessage | IChatAssistantMessage | IChatFunctionCallMessage | IChatSystemMessage | IChatMessagesPlaceholder | IChatFunctionMessage)[];
|
|
63
|
+
type IChatMessage = IChatUserMessage | IChatAssistantMessage | IChatFunctionCallMessage | IChatSystemMessage | IChatFunctionMessage;
|
|
62
64
|
type IChatMessages = IChatMessage[];
|
|
63
65
|
|
|
64
66
|
type OpenAIChatModelName = "gpt-3.5-turbo" | "gpt-3.5-turbo-0613" | "gpt-3.5-turbo-16k" | "gpt-4-0613" | "gpt-4" | "gpt-4o" | "gpt-4o-mini" | "gpt-4-0613" | "gpt-4-32k-0613" | `gpt-4${string}` | `gpt-3.5-turbo-${string}`;
|
|
@@ -66,6 +68,7 @@ type OpenAIConversationModelName = "davinci" | "text-curie-001" | "text-babbage-
|
|
|
66
68
|
type OpenAIEmbeddingModelName = "text-embedding-ada-002";
|
|
67
69
|
type OpenAIModelName = OpenAIChatModelName | OpenAIConversationModelName | OpenAIEmbeddingModelName;
|
|
68
70
|
|
|
71
|
+
type ParserInput = string | OutputResult;
|
|
69
72
|
/**
|
|
70
73
|
* BaseParser is an abstract class for parsing text and enforcing JSON schema on the parsed data.
|
|
71
74
|
*/
|
|
@@ -86,7 +89,7 @@ declare abstract class BaseParser<T = any> {
|
|
|
86
89
|
* @param [attributes] - Optional attributes to use during parsing.
|
|
87
90
|
* @returns The parsed data.
|
|
88
91
|
*/
|
|
89
|
-
abstract parse(text:
|
|
92
|
+
abstract parse(text: ParserInput, attributes?: Record<string, any>): T;
|
|
90
93
|
}
|
|
91
94
|
declare abstract class BaseParserWithJson<S extends JSONSchema | undefined = undefined, T = S extends JSONSchema ? FromSchema<S> : Record<string, any>> extends BaseParser<T> {
|
|
92
95
|
schema: S;
|
|
@@ -103,7 +106,7 @@ interface StringParserOptions extends BaseParserOptions {
|
|
|
103
106
|
}
|
|
104
107
|
declare class StringParser extends BaseParser<string> {
|
|
105
108
|
constructor(options?: StringParserOptions);
|
|
106
|
-
parse(text: string |
|
|
109
|
+
parse(text: string | OutputResult, _options?: Record<string, any>): string;
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
interface BooleanParserOptions extends BaseParserOptions {
|
|
@@ -301,16 +304,27 @@ declare function createParser<T extends Extract<CreateParserType, "json">, S ext
|
|
|
301
304
|
declare function createParser<T extends CreateParserType, S extends JSONSchema | undefined = undefined>(type: T, options?: BaseParserOptionsWithSchema<S> | BaseParserOptions): JsonParser<S> | ListToJsonParser<S> | StringParser | NumberParser | BooleanParser | ListToArrayParser | ListToKeyValueParser | ReplaceStringTemplateParser | MarkdownCodeBlockParser | MarkdownCodeBlocksParser | StringExtractParser;
|
|
302
305
|
declare function createCustomParser<O>(name: string, parserFn: (text: string, inputValues: ExecutorContext<any, any>) => O): CustomParser<ReturnType<typeof parserFn>>;
|
|
303
306
|
|
|
307
|
+
declare class LlmFunctionParser<T extends BaseParser<any>> extends BaseParser<ParserOutput<T> | OutputResultContent[]> {
|
|
308
|
+
parser: T;
|
|
309
|
+
constructor(options: LlmNativeFunctionParserOptions<T>);
|
|
310
|
+
parse(text: OutputResult, _options?: Record<string, any>): OutputResultContent[] | ParserOutput<T>;
|
|
311
|
+
}
|
|
312
|
+
interface LlmNativeFunctionParserOptions<T extends BaseParser<any>> extends BaseParserOptions {
|
|
313
|
+
parser: T;
|
|
314
|
+
}
|
|
304
315
|
interface LlmNativeFunctionParserOptions<T extends BaseParser<any>> extends BaseParserOptions {
|
|
305
316
|
parser: T;
|
|
306
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* @deprecated Use `LlmFunctionParser` instead.
|
|
320
|
+
*/
|
|
307
321
|
declare class LlmNativeFunctionParser<T extends BaseParser<any>> extends BaseParser<ParserOutput<T> | {
|
|
308
322
|
name: any;
|
|
309
323
|
arguments: any;
|
|
310
324
|
}> {
|
|
311
325
|
parser: T;
|
|
312
326
|
constructor(options: LlmNativeFunctionParserOptions<T>);
|
|
313
|
-
parse(text:
|
|
327
|
+
parse(text: OutputResult, _options?: Record<string, any>): ParserOutput<T> | {
|
|
314
328
|
name: string;
|
|
315
329
|
arguments: any;
|
|
316
330
|
};
|
|
@@ -435,7 +449,7 @@ declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
|
|
|
435
449
|
* @param name (optional) The name of the user. Only accepted if role is `user`.
|
|
436
450
|
* @return instance of ChatPrompt.
|
|
437
451
|
*/
|
|
438
|
-
addToPrompt(content: string, role: Extract<IChatMessageRole, "assistant">, name?: undefined): ChatPrompt<I>;
|
|
452
|
+
addToPrompt(content: string, role: Extract<IChatMessageRole, "assistant" | "model">, name?: undefined): ChatPrompt<I>;
|
|
439
453
|
addToPrompt(content: string, role: Extract<IChatMessageRole, "system">, name?: undefined): ChatPrompt<I>;
|
|
440
454
|
addToPrompt(content: string, role: Extract<IChatMessageRole, "user">, name?: string): ChatPrompt<I>;
|
|
441
455
|
addToPrompt(content: string, role: Extract<IChatMessageRole, "function">, name: string): ChatPrompt<I>;
|
|
@@ -458,7 +472,7 @@ declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
|
|
|
458
472
|
* @param content The message content.
|
|
459
473
|
* @return ChatPrompt so it can be chained.
|
|
460
474
|
*/
|
|
461
|
-
addFunctionMessage(content: string, name: string): ChatPrompt<I>;
|
|
475
|
+
addFunctionMessage(content: string, name: string, id?: string): ChatPrompt<I>;
|
|
462
476
|
/**
|
|
463
477
|
* addFunctionCallMessage Helper to add an assistant message to the prompt.
|
|
464
478
|
* @param content The message content.
|
|
@@ -467,6 +481,7 @@ declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
|
|
|
467
481
|
addFunctionCallMessage(function_call?: {
|
|
468
482
|
name: string;
|
|
469
483
|
arguments: string;
|
|
484
|
+
id?: string;
|
|
470
485
|
}): this;
|
|
471
486
|
/**
|
|
472
487
|
* addFromHistory Adds multiple messages at one time.
|
|
@@ -657,13 +672,27 @@ declare class Dialogue extends BaseStateItem<IChatMessages> {
|
|
|
657
672
|
name: string;
|
|
658
673
|
constructor(name: string);
|
|
659
674
|
setUserMessage(content: string | IChatMessageContentDetailed[], name?: string): this;
|
|
660
|
-
setAssistantMessage(content: string): this;
|
|
675
|
+
setAssistantMessage(content: string | OutputResultsText): this;
|
|
661
676
|
setSystemMessage(content: string): this;
|
|
662
|
-
|
|
677
|
+
setToolMessage(content: string, name: string, id?: string): void;
|
|
678
|
+
setFunctionMessage(content: string, name: string, id?: string): this;
|
|
679
|
+
/**
|
|
680
|
+
* Set
|
|
681
|
+
*/
|
|
682
|
+
setToolCallMessage(input: {
|
|
683
|
+
name: string;
|
|
684
|
+
arguments: string;
|
|
685
|
+
id?: string;
|
|
686
|
+
}): void;
|
|
663
687
|
setFunctionCallMessage(input: {
|
|
688
|
+
name: string;
|
|
689
|
+
arguments: string;
|
|
690
|
+
id?: string;
|
|
691
|
+
} | {
|
|
664
692
|
function_call: {
|
|
665
693
|
name: string;
|
|
666
694
|
arguments: string;
|
|
695
|
+
id?: string;
|
|
667
696
|
};
|
|
668
697
|
}): this;
|
|
669
698
|
setMessageTurn(userMessage: string, assistantMessage: string, systemMessage?: string): this;
|
|
@@ -674,6 +703,13 @@ declare class Dialogue extends BaseStateItem<IChatMessages> {
|
|
|
674
703
|
name: string;
|
|
675
704
|
value: IChatMessage[];
|
|
676
705
|
};
|
|
706
|
+
/**
|
|
707
|
+
* Add LLM output to dialogue history in the order it was returned
|
|
708
|
+
*
|
|
709
|
+
* @param output - The LLM output result from llm.call()
|
|
710
|
+
* @returns this for chaining
|
|
711
|
+
*/
|
|
712
|
+
addFromOutput(output: OutputResult | BaseLlCall): this;
|
|
677
713
|
}
|
|
678
714
|
|
|
679
715
|
declare abstract class BaseState {
|
|
@@ -730,14 +766,19 @@ declare class LlmExecutor<Llm extends BaseLlm<any>, Prompt extends BasePrompt<Re
|
|
|
730
766
|
/**
|
|
731
767
|
* Core Executor With LLM
|
|
732
768
|
*/
|
|
733
|
-
declare class LlmExecutorWithFunctions<Llm extends BaseLlm, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState> extends LlmExecutor<Llm, Prompt, Parser
|
|
769
|
+
declare class LlmExecutorWithFunctions<Llm extends BaseLlm, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState = BaseState> extends LlmExecutor<Llm, Prompt, LlmFunctionParser<Parser>, State> {
|
|
734
770
|
constructor(llmConfiguration: ExecutorWithLlmOptions<Llm, Prompt, Parser, State>, options?: CoreExecutorExecuteOptions<LlmExecutorHooks>);
|
|
735
|
-
execute<T extends GenericFunctionCall>(_input: PromptInput<Prompt>, _options: LlmExecutorWithFunctionsOptions<T>): Promise<ParserOutput<Parser>>;
|
|
771
|
+
execute<T extends GenericFunctionCall>(_input: PromptInput<Prompt>, _options: LlmExecutorWithFunctionsOptions<T>): Promise<OutputResultContent[] | ParserOutput<Parser>>;
|
|
736
772
|
}
|
|
737
773
|
/**
|
|
738
774
|
* @deprecated Use `LlmExecutorWithFunctions` instead.
|
|
739
775
|
*/
|
|
740
|
-
declare class LlmExecutorOpenAiFunctions<Llm extends BaseLlm, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState> extends
|
|
776
|
+
declare class LlmExecutorOpenAiFunctions<Llm extends BaseLlm, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState = BaseState> extends LlmExecutor<Llm, Prompt, LlmNativeFunctionParser<Parser>, State> {
|
|
777
|
+
constructor(llmConfiguration: ExecutorWithLlmOptions<Llm, Prompt, Parser, State>, options?: CoreExecutorExecuteOptions<LlmExecutorHooks>);
|
|
778
|
+
execute<T extends GenericFunctionCall>(_input: PromptInput<Prompt>, _options: LlmExecutorWithFunctionsOptions<T>): Promise<ParserOutput<Parser> | {
|
|
779
|
+
name: string;
|
|
780
|
+
arguments: any;
|
|
781
|
+
}>;
|
|
741
782
|
}
|
|
742
783
|
|
|
743
784
|
/**
|
|
@@ -848,6 +889,9 @@ interface BaseParserOptionsWithSchema<S extends JSONSchema | undefined = undefin
|
|
|
848
889
|
validateSchema?: boolean;
|
|
849
890
|
}
|
|
850
891
|
|
|
892
|
+
/**
|
|
893
|
+
* Internal Formats
|
|
894
|
+
*/
|
|
851
895
|
interface OutputResultsBase {
|
|
852
896
|
type: "text" | "function_use";
|
|
853
897
|
text?: string;
|
|
@@ -860,6 +904,7 @@ interface OutputResultsFunction extends OutputResultsBase {
|
|
|
860
904
|
type: "function_use";
|
|
861
905
|
name: string;
|
|
862
906
|
input: Record<string, any>;
|
|
907
|
+
functionId: string;
|
|
863
908
|
}
|
|
864
909
|
type OutputResultContent = OutputResultsText | OutputResultsFunction;
|
|
865
910
|
interface OutputResult {
|
|
@@ -997,6 +1042,12 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
997
1042
|
"openai.gpt-4o-mini": {
|
|
998
1043
|
input: Omit<OpenAiRequest, "model">;
|
|
999
1044
|
};
|
|
1045
|
+
"anthropic.claude-sonnet-4-0": {
|
|
1046
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1047
|
+
};
|
|
1048
|
+
"anthropic.claude-opus-4-0": {
|
|
1049
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1050
|
+
};
|
|
1000
1051
|
"anthropic.claude-3-7-sonnet": {
|
|
1001
1052
|
input: Omit<AnthropicRequest, "model">;
|
|
1002
1053
|
};
|
|
@@ -1021,12 +1072,27 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1021
1072
|
"google.gemini-2.0-flash-lite": {
|
|
1022
1073
|
input: Omit<GeminiRequest, "model">;
|
|
1023
1074
|
};
|
|
1075
|
+
"google.gemini-2.5-flash": {
|
|
1076
|
+
input: Omit<GeminiRequest, "model">;
|
|
1077
|
+
};
|
|
1078
|
+
"google.gemini-2.5-flash-lite": {
|
|
1079
|
+
input: Omit<GeminiRequest, "model">;
|
|
1080
|
+
};
|
|
1024
1081
|
"google.gemini-1.5-pro": {
|
|
1025
1082
|
input: Omit<GeminiRequest, "model">;
|
|
1026
1083
|
};
|
|
1084
|
+
"google.gemini-2.5-pro": {
|
|
1085
|
+
input: Omit<GeminiRequest, "model">;
|
|
1086
|
+
};
|
|
1027
1087
|
"xai.grok-2": {
|
|
1028
1088
|
input: OpenAiRequest;
|
|
1029
1089
|
};
|
|
1090
|
+
"xai.grok-3": {
|
|
1091
|
+
input: OpenAiRequest;
|
|
1092
|
+
};
|
|
1093
|
+
"xai.grok-4": {
|
|
1094
|
+
input: OpenAiRequest;
|
|
1095
|
+
};
|
|
1030
1096
|
"ollama.deepseek-r1": {
|
|
1031
1097
|
input: GenericLLm;
|
|
1032
1098
|
};
|
|
@@ -1241,13 +1307,45 @@ declare namespace index {
|
|
|
1241
1307
|
export { index_assert as assert, index_asyncCallWithTimeout as asyncCallWithTimeout, index_defineSchema as defineSchema, index_filterObjectOnSchema as filterObjectOnSchema, index_guessProviderFromModel as guessProviderFromModel, index_importHelpers as importHelpers, index_importPartials as importPartials, index_isObjectStringified as isObjectStringified, index_maybeParseJSON as maybeParseJSON, index_maybeStringifyJSON as maybeStringifyJSON, index_registerHelpers as registerHelpers, index_registerPartials as registerPartials, index_replaceTemplateString as replaceTemplateString, index_replaceTemplateStringAsync as replaceTemplateStringAsync };
|
|
1242
1308
|
}
|
|
1243
1309
|
|
|
1310
|
+
declare function isOutputResult(obj: any): obj is OutputResult;
|
|
1311
|
+
declare function isOutputResultContentText(obj: any): obj is OutputResultsText;
|
|
1312
|
+
/**
|
|
1313
|
+
* Does a llm response have a tool/function call?
|
|
1314
|
+
*/
|
|
1315
|
+
declare function isFunctionCall(result: any): result is OutputResultsFunction;
|
|
1316
|
+
declare function isToolCall(result: any): result is OutputResultsFunction;
|
|
1317
|
+
/**
|
|
1318
|
+
* Is it a tool/function Call
|
|
1319
|
+
*/
|
|
1320
|
+
declare function hasFunctionCall(results: any): boolean;
|
|
1321
|
+
declare function hasToolCall(results: any): boolean;
|
|
1322
|
+
declare function isUserMessage(message: IChatMessage): message is IChatUserMessage;
|
|
1323
|
+
declare function isAssistantMessage(message: IChatMessage): message is IChatAssistantMessage;
|
|
1324
|
+
declare function isSystemMessage(message: IChatMessage): message is IChatSystemMessage;
|
|
1325
|
+
|
|
1326
|
+
declare const guards_hasFunctionCall: typeof hasFunctionCall;
|
|
1327
|
+
declare const guards_hasToolCall: typeof hasToolCall;
|
|
1328
|
+
declare const guards_isAssistantMessage: typeof isAssistantMessage;
|
|
1329
|
+
declare const guards_isFunctionCall: typeof isFunctionCall;
|
|
1330
|
+
declare const guards_isOutputResult: typeof isOutputResult;
|
|
1331
|
+
declare const guards_isOutputResultContentText: typeof isOutputResultContentText;
|
|
1332
|
+
declare const guards_isSystemMessage: typeof isSystemMessage;
|
|
1333
|
+
declare const guards_isToolCall: typeof isToolCall;
|
|
1334
|
+
declare const guards_isUserMessage: typeof isUserMessage;
|
|
1335
|
+
declare namespace guards {
|
|
1336
|
+
export { guards_hasFunctionCall as hasFunctionCall, guards_hasToolCall as hasToolCall, guards_isAssistantMessage as isAssistantMessage, guards_isFunctionCall as isFunctionCall, guards_isOutputResult as isOutputResult, guards_isOutputResultContentText as isOutputResultContentText, guards_isSystemMessage as isSystemMessage, guards_isToolCall as isToolCall, guards_isUserMessage as isUserMessage };
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1244
1339
|
declare const configs: {
|
|
1245
1340
|
"deepseek.chat.v1": Config<keyof AllLlm>;
|
|
1246
1341
|
"deepseek.chat": Config<keyof AllLlm>;
|
|
1247
1342
|
"google.chat.v1": Config<keyof AllLlm>;
|
|
1248
1343
|
"google.gemini-2.0-flash": Config<keyof AllLlm>;
|
|
1249
1344
|
"google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
|
|
1345
|
+
"google.gemini-2.5-flash": Config<keyof AllLlm>;
|
|
1346
|
+
"google.gemini-2.5-flash-lite": Config<keyof AllLlm>;
|
|
1250
1347
|
"google.gemini-1.5-pro": Config<keyof AllLlm>;
|
|
1348
|
+
"google.gemini-2.5-pro": Config<keyof AllLlm>;
|
|
1251
1349
|
"ollama.chat.v1": Config<keyof AllLlm>;
|
|
1252
1350
|
"ollama.deepseek-r1": Config<keyof AllLlm>;
|
|
1253
1351
|
"ollama.llama3.3": Config<keyof AllLlm>;
|
|
@@ -1256,9 +1354,13 @@ declare const configs: {
|
|
|
1256
1354
|
"ollama.qwq": Config<keyof AllLlm>;
|
|
1257
1355
|
"xai.chat.v1": Config<keyof AllLlm>;
|
|
1258
1356
|
"xai.grok-2": Config<keyof AllLlm>;
|
|
1357
|
+
"xai.grok-3": Config<keyof AllLlm>;
|
|
1358
|
+
"xai.grok-4": Config<keyof AllLlm>;
|
|
1259
1359
|
"amazon:anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1260
1360
|
"amazon:meta.chat.v1": Config<keyof AllLlm>;
|
|
1261
1361
|
"anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1362
|
+
"anthropic.claude-sonnet-4-0": Config<keyof AllLlm>;
|
|
1363
|
+
"anthropic.claude-opus-4-0": Config<keyof AllLlm>;
|
|
1262
1364
|
"anthropic.claude-3-7-sonnet": Config<keyof AllLlm>;
|
|
1263
1365
|
"anthropic.claude-3-5-sonnet": Config<keyof AllLlm>;
|
|
1264
1366
|
"anthropic.claude-3-5-haiku": Config<keyof AllLlm>;
|
|
@@ -1270,11 +1372,7 @@ declare const configs: {
|
|
|
1270
1372
|
};
|
|
1271
1373
|
|
|
1272
1374
|
declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): {
|
|
1273
|
-
call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<
|
|
1274
|
-
getResultContent: (index?: number) => OutputResultContent[];
|
|
1275
|
-
getResultText: () => string;
|
|
1276
|
-
getResult: () => OutputResult;
|
|
1277
|
-
}>;
|
|
1375
|
+
call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<BaseLlCall>;
|
|
1278
1376
|
getTraceId: () => string | null;
|
|
1279
1377
|
withTraceId: (id: string) => void;
|
|
1280
1378
|
getMetadata: () => {
|
|
@@ -1308,4 +1406,4 @@ declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, op
|
|
|
1308
1406
|
};
|
|
1309
1407
|
};
|
|
1310
1408
|
|
|
1311
|
-
export { BaseExecutor, type BaseLlm, BaseParser, BasePrompt, BaseStateItem, ChatPrompt, CustomParser, DefaultState, DefaultStateItem, type EmbeddingProviderKey, type ExecutorContext, type IChatMessages, LlmExecutorOpenAiFunctions, LlmExecutorWithFunctions, LlmNativeFunctionParser, type LlmProvider, type LlmProviderKey, type OpenAIModelName, OpenAiFunctionParser, TextPrompt, type UseLlmKey, createCallableExecutor, createChatPrompt, createCoreExecutor, createCustomParser, createDialogue, createEmbedding, createLlmExecutor, createLlmFunctionExecutor, createParser, createPrompt, createState, createStateItem, defineSchema, registerHelpers, registerPartials, useExecutors, useLlm, index as utils };
|
|
1409
|
+
export { BaseExecutor, type BaseLlm, BaseParser, BasePrompt, BaseStateItem, ChatPrompt, CustomParser, DefaultState, DefaultStateItem, type EmbeddingProviderKey, type ExecutorContext, type IChatMessages, LlmExecutorOpenAiFunctions, LlmExecutorWithFunctions, LlmNativeFunctionParser, type LlmProvider, type LlmProviderKey, type OpenAIModelName, OpenAiFunctionParser, TextPrompt, type UseLlmKey, createCallableExecutor, createChatPrompt, createCoreExecutor, createCustomParser, createDialogue, createEmbedding, createLlmExecutor, createLlmFunctionExecutor, createParser, createPrompt, createState, createStateItem, defineSchema, guards, registerHelpers, registerPartials, useExecutors, useLlm, index as utils };
|