llm-exe 2.3.4 → 2.3.6
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 +111 -39
- package/dist/index.d.ts +111 -39
- package/dist/index.js +190 -73
- package/dist/index.mjs +190 -73
- package/package.json +1 -1
- package/readme.md +25 -2
package/dist/index.d.mts
CHANGED
|
@@ -129,7 +129,8 @@ declare class JsonParser<S extends JSONSchema | undefined = undefined> extends B
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
declare class ListToJsonParser<S extends JSONSchema | undefined = undefined> extends BaseParserWithJson<S> {
|
|
132
|
-
|
|
132
|
+
private keyTransform;
|
|
133
|
+
constructor(options?: ListToJsonParserOptions<S>);
|
|
133
134
|
parse(text: string): ParserOutput<BaseParserWithJson<S>>;
|
|
134
135
|
}
|
|
135
136
|
|
|
@@ -292,7 +293,7 @@ declare function createParser<T extends Extract<CreateParserType, "stringExtract
|
|
|
292
293
|
* @param options - The JSON schema.
|
|
293
294
|
* @returns An instance of ListToJsonParser.
|
|
294
295
|
*/
|
|
295
|
-
declare function createParser<T extends Extract<CreateParserType, "listToJson">, S extends JSONSchema | undefined = undefined>(type: T, options?:
|
|
296
|
+
declare function createParser<T extends Extract<CreateParserType, "listToJson">, S extends JSONSchema | undefined = undefined>(type: T, options?: ListToJsonParserOptions<S>): ListToJsonParser<S>;
|
|
296
297
|
/**
|
|
297
298
|
* Creates a parser based on the given type and schema.
|
|
298
299
|
* @template S - JSON schema type.
|
|
@@ -402,8 +403,8 @@ declare abstract class BasePrompt<I extends Record<string, any>> {
|
|
|
402
403
|
_input: any;
|
|
403
404
|
};
|
|
404
405
|
/**
|
|
405
|
-
*
|
|
406
|
-
* @return {boolean} Returns false if the
|
|
406
|
+
* Validates the prompt structure.
|
|
407
|
+
* @return {boolean} Returns false if the prompt has no messages defined.
|
|
407
408
|
*/
|
|
408
409
|
validate(): boolean;
|
|
409
410
|
}
|
|
@@ -521,12 +522,6 @@ declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
|
|
|
521
522
|
* @return formatted prompt.
|
|
522
523
|
*/
|
|
523
524
|
formatAsync(values: I): Promise<IChatMessages>;
|
|
524
|
-
/**
|
|
525
|
-
* validate Ensures there are not unresolved tokens in prompt.
|
|
526
|
-
* @TODO Make this work!
|
|
527
|
-
* @return Returns false if the template is not valid.
|
|
528
|
-
*/
|
|
529
|
-
validate(): boolean;
|
|
530
525
|
}
|
|
531
526
|
|
|
532
527
|
type TextPromptType = "text";
|
|
@@ -712,6 +707,33 @@ declare class Dialogue extends BaseStateItem<IChatMessages> {
|
|
|
712
707
|
};
|
|
713
708
|
}): this;
|
|
714
709
|
setMessageTurn(userMessage: string, assistantMessage: string, systemMessage?: string): this;
|
|
710
|
+
/**
|
|
711
|
+
* Aliases using `add*` naming to match ChatPrompt's API.
|
|
712
|
+
* These delegate to the corresponding `set*` methods.
|
|
713
|
+
*/
|
|
714
|
+
addUserMessage(content: string | IChatMessageContentDetailed[], name?: string): this;
|
|
715
|
+
addAssistantMessage(content: string | OutputResultsText): this;
|
|
716
|
+
addSystemMessage(content: string): this;
|
|
717
|
+
addToolMessage(content: string, name: string, id?: string): this;
|
|
718
|
+
addToolCallMessage(input: {
|
|
719
|
+
name: string;
|
|
720
|
+
arguments: string;
|
|
721
|
+
id?: string;
|
|
722
|
+
}): this;
|
|
723
|
+
addFunctionMessage(content: string, name: string, id?: string): this;
|
|
724
|
+
addFunctionCallMessage(input: {
|
|
725
|
+
name: string;
|
|
726
|
+
arguments: string;
|
|
727
|
+
id?: string;
|
|
728
|
+
} | {
|
|
729
|
+
function_call: {
|
|
730
|
+
name: string;
|
|
731
|
+
arguments: string;
|
|
732
|
+
id?: string;
|
|
733
|
+
};
|
|
734
|
+
}): this;
|
|
735
|
+
addMessageTurn(userMessage: string, assistantMessage: string, systemMessage?: string): this;
|
|
736
|
+
addHistory(messages: IChatMessages): this;
|
|
715
737
|
setHistory(messages: IChatMessages): this;
|
|
716
738
|
getHistory(): IChatMessages;
|
|
717
739
|
serialize(): {
|
|
@@ -904,6 +926,9 @@ interface BaseParserOptionsWithSchema<S extends JSONSchema | undefined = undefin
|
|
|
904
926
|
schema?: S;
|
|
905
927
|
validateSchema?: boolean;
|
|
906
928
|
}
|
|
929
|
+
interface ListToJsonParserOptions<S extends JSONSchema | undefined = undefined> extends BaseParserOptionsWithSchema<S> {
|
|
930
|
+
keyTransform?: "camelCase" | "preserve";
|
|
931
|
+
}
|
|
907
932
|
|
|
908
933
|
/**
|
|
909
934
|
* Internal Formats
|
|
@@ -994,6 +1019,14 @@ interface OpenAiRequest extends GenericLLm {
|
|
|
994
1019
|
openAiApiKey?: string;
|
|
995
1020
|
useJson?: boolean;
|
|
996
1021
|
}
|
|
1022
|
+
interface XAiRequest extends GenericLLm {
|
|
1023
|
+
model: string;
|
|
1024
|
+
frequencyPenalty?: number;
|
|
1025
|
+
logitBias?: Record<string, any> | null;
|
|
1026
|
+
responseFormat?: Record<string, any>;
|
|
1027
|
+
xAiApiKey?: string;
|
|
1028
|
+
useJson?: boolean;
|
|
1029
|
+
}
|
|
997
1030
|
interface AmazonBedrockRequest extends GenericLLm {
|
|
998
1031
|
model: string;
|
|
999
1032
|
awsRegion?: string;
|
|
@@ -1044,7 +1077,7 @@ type AllLlm = {
|
|
|
1044
1077
|
input: AmazonBedrockRequest;
|
|
1045
1078
|
};
|
|
1046
1079
|
"xai.chat.v1": {
|
|
1047
|
-
input:
|
|
1080
|
+
input: XAiRequest;
|
|
1048
1081
|
};
|
|
1049
1082
|
"ollama.chat.v1": {
|
|
1050
1083
|
input: GenericLLm;
|
|
@@ -1078,11 +1111,8 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1078
1111
|
"openai.o3": {
|
|
1079
1112
|
input: Omit<OpenAiRequest, "model">;
|
|
1080
1113
|
};
|
|
1081
|
-
"openai.o4-mini": {
|
|
1082
|
-
input: Omit<OpenAiRequest, "model">;
|
|
1083
|
-
};
|
|
1084
1114
|
"openai.gpt-4": {
|
|
1085
|
-
input: OpenAiRequest
|
|
1115
|
+
input: Omit<OpenAiRequest, "model">;
|
|
1086
1116
|
};
|
|
1087
1117
|
"openai.gpt-4o": {
|
|
1088
1118
|
input: Omit<OpenAiRequest, "model">;
|
|
@@ -1090,19 +1120,31 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1090
1120
|
"openai.gpt-4o-mini": {
|
|
1091
1121
|
input: Omit<OpenAiRequest, "model">;
|
|
1092
1122
|
};
|
|
1123
|
+
"openai.o4-mini": {
|
|
1124
|
+
input: Omit<OpenAiRequest, "model">;
|
|
1125
|
+
};
|
|
1126
|
+
"anthropic.claude-opus-4-7": {
|
|
1127
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1128
|
+
};
|
|
1093
1129
|
"anthropic.claude-opus-4-6": {
|
|
1094
1130
|
input: Omit<AnthropicRequest, "model">;
|
|
1095
1131
|
};
|
|
1096
1132
|
"anthropic.claude-sonnet-4-6": {
|
|
1097
1133
|
input: Omit<AnthropicRequest, "model">;
|
|
1098
1134
|
};
|
|
1099
|
-
"anthropic.claude-
|
|
1135
|
+
"anthropic.claude-haiku-4-5": {
|
|
1100
1136
|
input: Omit<AnthropicRequest, "model">;
|
|
1101
1137
|
};
|
|
1102
|
-
"anthropic.claude-
|
|
1138
|
+
"anthropic.claude-sonnet-4-5": {
|
|
1103
1139
|
input: Omit<AnthropicRequest, "model">;
|
|
1104
1140
|
};
|
|
1105
|
-
"anthropic.claude-
|
|
1141
|
+
"anthropic.claude-opus-4-1": {
|
|
1142
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1143
|
+
};
|
|
1144
|
+
"anthropic.claude-sonnet-4-0": {
|
|
1145
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1146
|
+
};
|
|
1147
|
+
"anthropic.claude-opus-4-0": {
|
|
1106
1148
|
input: Omit<AnthropicRequest, "model">;
|
|
1107
1149
|
};
|
|
1108
1150
|
"anthropic.claude-sonnet-4": {
|
|
@@ -1111,6 +1153,9 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1111
1153
|
"anthropic.claude-opus-4": {
|
|
1112
1154
|
input: Omit<AnthropicRequest, "model">;
|
|
1113
1155
|
};
|
|
1156
|
+
"anthropic.claude-3-7-sonnet": {
|
|
1157
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1158
|
+
};
|
|
1114
1159
|
"anthropic.claude-3-5-sonnet": {
|
|
1115
1160
|
input: Omit<AnthropicRequest, "model">;
|
|
1116
1161
|
};
|
|
@@ -1120,44 +1165,41 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1120
1165
|
"anthropic.claude-3-opus": {
|
|
1121
1166
|
input: Omit<AnthropicRequest, "model">;
|
|
1122
1167
|
};
|
|
1123
|
-
"
|
|
1124
|
-
input: Omit<AnthropicRequest, "model">;
|
|
1125
|
-
};
|
|
1126
|
-
"google.gemini-2.5-pro-exp-03-25": {
|
|
1168
|
+
"google.gemini-2.5-flash": {
|
|
1127
1169
|
input: Omit<GeminiRequest, "model">;
|
|
1128
1170
|
};
|
|
1129
|
-
"google.gemini-2.
|
|
1171
|
+
"google.gemini-2.5-flash-lite": {
|
|
1130
1172
|
input: Omit<GeminiRequest, "model">;
|
|
1131
1173
|
};
|
|
1132
|
-
"google.gemini-2.
|
|
1174
|
+
"google.gemini-2.5-pro": {
|
|
1133
1175
|
input: Omit<GeminiRequest, "model">;
|
|
1134
1176
|
};
|
|
1135
|
-
"google.gemini-2.
|
|
1177
|
+
"google.gemini-2.0-flash": {
|
|
1136
1178
|
input: Omit<GeminiRequest, "model">;
|
|
1137
1179
|
};
|
|
1138
|
-
"google.gemini-2.
|
|
1180
|
+
"google.gemini-2.0-flash-lite": {
|
|
1139
1181
|
input: Omit<GeminiRequest, "model">;
|
|
1140
1182
|
};
|
|
1141
1183
|
"google.gemini-1.5-pro": {
|
|
1142
1184
|
input: Omit<GeminiRequest, "model">;
|
|
1143
1185
|
};
|
|
1144
|
-
"google.gemini-2.5-pro": {
|
|
1145
|
-
input: Omit<GeminiRequest, "model">;
|
|
1146
|
-
};
|
|
1147
1186
|
"xai.grok-2": {
|
|
1148
|
-
input:
|
|
1187
|
+
input: Omit<XAiRequest, "model">;
|
|
1149
1188
|
};
|
|
1150
1189
|
"xai.grok-3": {
|
|
1151
|
-
input:
|
|
1190
|
+
input: Omit<XAiRequest, "model">;
|
|
1152
1191
|
};
|
|
1153
1192
|
"xai.grok-3-mini": {
|
|
1154
|
-
input: Omit<
|
|
1193
|
+
input: Omit<XAiRequest, "model">;
|
|
1155
1194
|
};
|
|
1156
1195
|
"xai.grok-4": {
|
|
1157
|
-
input:
|
|
1196
|
+
input: Omit<XAiRequest, "model">;
|
|
1158
1197
|
};
|
|
1159
1198
|
"xai.grok-4-fast": {
|
|
1160
|
-
input: Omit<
|
|
1199
|
+
input: Omit<XAiRequest, "model">;
|
|
1200
|
+
};
|
|
1201
|
+
"xai.grok-4-1-fast": {
|
|
1202
|
+
input: Omit<XAiRequest, "model">;
|
|
1161
1203
|
};
|
|
1162
1204
|
"ollama.deepseek-r1": {
|
|
1163
1205
|
input: GenericLLm;
|
|
@@ -1174,9 +1216,27 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1174
1216
|
"ollama.qwq": {
|
|
1175
1217
|
input: GenericLLm;
|
|
1176
1218
|
};
|
|
1219
|
+
"ollama.gemma3": {
|
|
1220
|
+
input: GenericLLm;
|
|
1221
|
+
};
|
|
1222
|
+
"ollama.mistral": {
|
|
1223
|
+
input: GenericLLm;
|
|
1224
|
+
};
|
|
1225
|
+
"ollama.qwen2.5": {
|
|
1226
|
+
input: GenericLLm;
|
|
1227
|
+
};
|
|
1228
|
+
"ollama.qwen3": {
|
|
1229
|
+
input: GenericLLm;
|
|
1230
|
+
};
|
|
1177
1231
|
"deepseek.chat": {
|
|
1178
1232
|
input: DeepseekRequest;
|
|
1179
1233
|
};
|
|
1234
|
+
"deepseek.v4-flash": {
|
|
1235
|
+
input: Omit<DeepseekRequest, "model">;
|
|
1236
|
+
};
|
|
1237
|
+
"deepseek.v4-pro": {
|
|
1238
|
+
input: Omit<DeepseekRequest, "model">;
|
|
1239
|
+
};
|
|
1180
1240
|
};
|
|
1181
1241
|
type LlmProviderKey = keyof AllLlm;
|
|
1182
1242
|
type EmbeddingProviderKey = keyof AllEmbedding;
|
|
@@ -1486,37 +1546,47 @@ declare namespace guards {
|
|
|
1486
1546
|
declare const configs: {
|
|
1487
1547
|
"deepseek.chat.v1": Config<keyof AllLlm>;
|
|
1488
1548
|
"deepseek.chat": Config<keyof AllLlm>;
|
|
1549
|
+
"deepseek.v4-flash": Config<keyof AllLlm>;
|
|
1550
|
+
"deepseek.v4-pro": Config<keyof AllLlm>;
|
|
1489
1551
|
"google.chat.v1": Config<keyof AllLlm>;
|
|
1490
|
-
"google.gemini-2.0-flash": Config<keyof AllLlm>;
|
|
1491
|
-
"google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
|
|
1492
1552
|
"google.gemini-2.5-flash": Config<keyof AllLlm>;
|
|
1493
1553
|
"google.gemini-2.5-flash-lite": Config<keyof AllLlm>;
|
|
1494
|
-
"google.gemini-1.5-pro": Config<keyof AllLlm>;
|
|
1495
1554
|
"google.gemini-2.5-pro": Config<keyof AllLlm>;
|
|
1555
|
+
"google.gemini-2.0-flash": Config<keyof AllLlm>;
|
|
1556
|
+
"google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
|
|
1557
|
+
"google.gemini-1.5-pro": Config<keyof AllLlm>;
|
|
1496
1558
|
"ollama.chat.v1": Config<keyof AllLlm>;
|
|
1497
1559
|
"ollama.deepseek-r1": Config<keyof AllLlm>;
|
|
1498
1560
|
"ollama.llama3.3": Config<keyof AllLlm>;
|
|
1499
1561
|
"ollama.llama3.2": Config<keyof AllLlm>;
|
|
1500
1562
|
"ollama.llama3.1": Config<keyof AllLlm>;
|
|
1501
1563
|
"ollama.qwq": Config<keyof AllLlm>;
|
|
1564
|
+
"ollama.gemma3": Config<keyof AllLlm>;
|
|
1565
|
+
"ollama.mistral": Config<keyof AllLlm>;
|
|
1566
|
+
"ollama.qwen2.5": Config<keyof AllLlm>;
|
|
1567
|
+
"ollama.qwen3": Config<keyof AllLlm>;
|
|
1502
1568
|
"xai.chat.v1": Config<keyof AllLlm>;
|
|
1503
1569
|
"xai.grok-2": Config<keyof AllLlm>;
|
|
1504
1570
|
"xai.grok-3": Config<keyof AllLlm>;
|
|
1505
1571
|
"xai.grok-3-mini": Config<keyof AllLlm>;
|
|
1506
1572
|
"xai.grok-4": Config<keyof AllLlm>;
|
|
1507
1573
|
"xai.grok-4-fast": Config<keyof AllLlm>;
|
|
1574
|
+
"xai.grok-4-1-fast": Config<keyof AllLlm>;
|
|
1508
1575
|
"amazon:anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1509
1576
|
"amazon:meta.chat.v1": Config<keyof AllLlm>;
|
|
1510
1577
|
"anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1578
|
+
"anthropic.claude-opus-4-7": Config<keyof AllLlm>;
|
|
1511
1579
|
"anthropic.claude-opus-4-6": Config<keyof AllLlm>;
|
|
1512
1580
|
"anthropic.claude-sonnet-4-6": Config<keyof AllLlm>;
|
|
1581
|
+
"anthropic.claude-haiku-4-5": Config<keyof AllLlm>;
|
|
1582
|
+
"anthropic.claude-sonnet-4-5": Config<keyof AllLlm>;
|
|
1583
|
+
"anthropic.claude-opus-4-1": Config<keyof AllLlm>;
|
|
1513
1584
|
"anthropic.claude-sonnet-4": Config<keyof AllLlm>;
|
|
1514
1585
|
"anthropic.claude-opus-4": Config<keyof AllLlm>;
|
|
1515
1586
|
"anthropic.claude-3-7-sonnet": Config<keyof AllLlm>;
|
|
1516
1587
|
"anthropic.claude-3-5-sonnet": Config<keyof AllLlm>;
|
|
1517
1588
|
"anthropic.claude-3-5-haiku": Config<keyof AllLlm>;
|
|
1518
1589
|
"anthropic.claude-3-opus": Config<keyof AllLlm>;
|
|
1519
|
-
"anthropic.claude-3-haiku": Config<keyof AllLlm>;
|
|
1520
1590
|
"openai.chat.v1": Config<keyof AllLlm>;
|
|
1521
1591
|
"openai.chat-mock.v1": Config<keyof AllLlm>;
|
|
1522
1592
|
"openai.gpt-5.2": Config<keyof AllLlm>;
|
|
@@ -1526,9 +1596,10 @@ declare const configs: {
|
|
|
1526
1596
|
"openai.gpt-4.1-mini": Config<keyof AllLlm>;
|
|
1527
1597
|
"openai.gpt-4.1-nano": Config<keyof AllLlm>;
|
|
1528
1598
|
"openai.o3": Config<keyof AllLlm>;
|
|
1529
|
-
"openai.
|
|
1599
|
+
"openai.gpt-4": Config<keyof AllLlm>;
|
|
1530
1600
|
"openai.gpt-4o": Config<keyof AllLlm>;
|
|
1531
1601
|
"openai.gpt-4o-mini": Config<keyof AllLlm>;
|
|
1602
|
+
"openai.o4-mini": Config<keyof AllLlm>;
|
|
1532
1603
|
};
|
|
1533
1604
|
|
|
1534
1605
|
declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): BaseLlm;
|
|
@@ -1557,6 +1628,7 @@ declare function createOpenAiCompatibleConfiguration<K extends Config["key"]>(ov
|
|
|
1557
1628
|
provider: string;
|
|
1558
1629
|
endpoint: string;
|
|
1559
1630
|
apiKeyMapping: [string, string];
|
|
1631
|
+
isReasoningModel?: (model: string) => boolean;
|
|
1560
1632
|
transformResponse?: any;
|
|
1561
1633
|
}): Config<keyof AllLlm>;
|
|
1562
1634
|
|
package/dist/index.d.ts
CHANGED
|
@@ -129,7 +129,8 @@ declare class JsonParser<S extends JSONSchema | undefined = undefined> extends B
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
declare class ListToJsonParser<S extends JSONSchema | undefined = undefined> extends BaseParserWithJson<S> {
|
|
132
|
-
|
|
132
|
+
private keyTransform;
|
|
133
|
+
constructor(options?: ListToJsonParserOptions<S>);
|
|
133
134
|
parse(text: string): ParserOutput<BaseParserWithJson<S>>;
|
|
134
135
|
}
|
|
135
136
|
|
|
@@ -292,7 +293,7 @@ declare function createParser<T extends Extract<CreateParserType, "stringExtract
|
|
|
292
293
|
* @param options - The JSON schema.
|
|
293
294
|
* @returns An instance of ListToJsonParser.
|
|
294
295
|
*/
|
|
295
|
-
declare function createParser<T extends Extract<CreateParserType, "listToJson">, S extends JSONSchema | undefined = undefined>(type: T, options?:
|
|
296
|
+
declare function createParser<T extends Extract<CreateParserType, "listToJson">, S extends JSONSchema | undefined = undefined>(type: T, options?: ListToJsonParserOptions<S>): ListToJsonParser<S>;
|
|
296
297
|
/**
|
|
297
298
|
* Creates a parser based on the given type and schema.
|
|
298
299
|
* @template S - JSON schema type.
|
|
@@ -402,8 +403,8 @@ declare abstract class BasePrompt<I extends Record<string, any>> {
|
|
|
402
403
|
_input: any;
|
|
403
404
|
};
|
|
404
405
|
/**
|
|
405
|
-
*
|
|
406
|
-
* @return {boolean} Returns false if the
|
|
406
|
+
* Validates the prompt structure.
|
|
407
|
+
* @return {boolean} Returns false if the prompt has no messages defined.
|
|
407
408
|
*/
|
|
408
409
|
validate(): boolean;
|
|
409
410
|
}
|
|
@@ -521,12 +522,6 @@ declare class ChatPrompt<I extends Record<string, any>> extends BasePrompt<I> {
|
|
|
521
522
|
* @return formatted prompt.
|
|
522
523
|
*/
|
|
523
524
|
formatAsync(values: I): Promise<IChatMessages>;
|
|
524
|
-
/**
|
|
525
|
-
* validate Ensures there are not unresolved tokens in prompt.
|
|
526
|
-
* @TODO Make this work!
|
|
527
|
-
* @return Returns false if the template is not valid.
|
|
528
|
-
*/
|
|
529
|
-
validate(): boolean;
|
|
530
525
|
}
|
|
531
526
|
|
|
532
527
|
type TextPromptType = "text";
|
|
@@ -712,6 +707,33 @@ declare class Dialogue extends BaseStateItem<IChatMessages> {
|
|
|
712
707
|
};
|
|
713
708
|
}): this;
|
|
714
709
|
setMessageTurn(userMessage: string, assistantMessage: string, systemMessage?: string): this;
|
|
710
|
+
/**
|
|
711
|
+
* Aliases using `add*` naming to match ChatPrompt's API.
|
|
712
|
+
* These delegate to the corresponding `set*` methods.
|
|
713
|
+
*/
|
|
714
|
+
addUserMessage(content: string | IChatMessageContentDetailed[], name?: string): this;
|
|
715
|
+
addAssistantMessage(content: string | OutputResultsText): this;
|
|
716
|
+
addSystemMessage(content: string): this;
|
|
717
|
+
addToolMessage(content: string, name: string, id?: string): this;
|
|
718
|
+
addToolCallMessage(input: {
|
|
719
|
+
name: string;
|
|
720
|
+
arguments: string;
|
|
721
|
+
id?: string;
|
|
722
|
+
}): this;
|
|
723
|
+
addFunctionMessage(content: string, name: string, id?: string): this;
|
|
724
|
+
addFunctionCallMessage(input: {
|
|
725
|
+
name: string;
|
|
726
|
+
arguments: string;
|
|
727
|
+
id?: string;
|
|
728
|
+
} | {
|
|
729
|
+
function_call: {
|
|
730
|
+
name: string;
|
|
731
|
+
arguments: string;
|
|
732
|
+
id?: string;
|
|
733
|
+
};
|
|
734
|
+
}): this;
|
|
735
|
+
addMessageTurn(userMessage: string, assistantMessage: string, systemMessage?: string): this;
|
|
736
|
+
addHistory(messages: IChatMessages): this;
|
|
715
737
|
setHistory(messages: IChatMessages): this;
|
|
716
738
|
getHistory(): IChatMessages;
|
|
717
739
|
serialize(): {
|
|
@@ -904,6 +926,9 @@ interface BaseParserOptionsWithSchema<S extends JSONSchema | undefined = undefin
|
|
|
904
926
|
schema?: S;
|
|
905
927
|
validateSchema?: boolean;
|
|
906
928
|
}
|
|
929
|
+
interface ListToJsonParserOptions<S extends JSONSchema | undefined = undefined> extends BaseParserOptionsWithSchema<S> {
|
|
930
|
+
keyTransform?: "camelCase" | "preserve";
|
|
931
|
+
}
|
|
907
932
|
|
|
908
933
|
/**
|
|
909
934
|
* Internal Formats
|
|
@@ -994,6 +1019,14 @@ interface OpenAiRequest extends GenericLLm {
|
|
|
994
1019
|
openAiApiKey?: string;
|
|
995
1020
|
useJson?: boolean;
|
|
996
1021
|
}
|
|
1022
|
+
interface XAiRequest extends GenericLLm {
|
|
1023
|
+
model: string;
|
|
1024
|
+
frequencyPenalty?: number;
|
|
1025
|
+
logitBias?: Record<string, any> | null;
|
|
1026
|
+
responseFormat?: Record<string, any>;
|
|
1027
|
+
xAiApiKey?: string;
|
|
1028
|
+
useJson?: boolean;
|
|
1029
|
+
}
|
|
997
1030
|
interface AmazonBedrockRequest extends GenericLLm {
|
|
998
1031
|
model: string;
|
|
999
1032
|
awsRegion?: string;
|
|
@@ -1044,7 +1077,7 @@ type AllLlm = {
|
|
|
1044
1077
|
input: AmazonBedrockRequest;
|
|
1045
1078
|
};
|
|
1046
1079
|
"xai.chat.v1": {
|
|
1047
|
-
input:
|
|
1080
|
+
input: XAiRequest;
|
|
1048
1081
|
};
|
|
1049
1082
|
"ollama.chat.v1": {
|
|
1050
1083
|
input: GenericLLm;
|
|
@@ -1078,11 +1111,8 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1078
1111
|
"openai.o3": {
|
|
1079
1112
|
input: Omit<OpenAiRequest, "model">;
|
|
1080
1113
|
};
|
|
1081
|
-
"openai.o4-mini": {
|
|
1082
|
-
input: Omit<OpenAiRequest, "model">;
|
|
1083
|
-
};
|
|
1084
1114
|
"openai.gpt-4": {
|
|
1085
|
-
input: OpenAiRequest
|
|
1115
|
+
input: Omit<OpenAiRequest, "model">;
|
|
1086
1116
|
};
|
|
1087
1117
|
"openai.gpt-4o": {
|
|
1088
1118
|
input: Omit<OpenAiRequest, "model">;
|
|
@@ -1090,19 +1120,31 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1090
1120
|
"openai.gpt-4o-mini": {
|
|
1091
1121
|
input: Omit<OpenAiRequest, "model">;
|
|
1092
1122
|
};
|
|
1123
|
+
"openai.o4-mini": {
|
|
1124
|
+
input: Omit<OpenAiRequest, "model">;
|
|
1125
|
+
};
|
|
1126
|
+
"anthropic.claude-opus-4-7": {
|
|
1127
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1128
|
+
};
|
|
1093
1129
|
"anthropic.claude-opus-4-6": {
|
|
1094
1130
|
input: Omit<AnthropicRequest, "model">;
|
|
1095
1131
|
};
|
|
1096
1132
|
"anthropic.claude-sonnet-4-6": {
|
|
1097
1133
|
input: Omit<AnthropicRequest, "model">;
|
|
1098
1134
|
};
|
|
1099
|
-
"anthropic.claude-
|
|
1135
|
+
"anthropic.claude-haiku-4-5": {
|
|
1100
1136
|
input: Omit<AnthropicRequest, "model">;
|
|
1101
1137
|
};
|
|
1102
|
-
"anthropic.claude-
|
|
1138
|
+
"anthropic.claude-sonnet-4-5": {
|
|
1103
1139
|
input: Omit<AnthropicRequest, "model">;
|
|
1104
1140
|
};
|
|
1105
|
-
"anthropic.claude-
|
|
1141
|
+
"anthropic.claude-opus-4-1": {
|
|
1142
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1143
|
+
};
|
|
1144
|
+
"anthropic.claude-sonnet-4-0": {
|
|
1145
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1146
|
+
};
|
|
1147
|
+
"anthropic.claude-opus-4-0": {
|
|
1106
1148
|
input: Omit<AnthropicRequest, "model">;
|
|
1107
1149
|
};
|
|
1108
1150
|
"anthropic.claude-sonnet-4": {
|
|
@@ -1111,6 +1153,9 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1111
1153
|
"anthropic.claude-opus-4": {
|
|
1112
1154
|
input: Omit<AnthropicRequest, "model">;
|
|
1113
1155
|
};
|
|
1156
|
+
"anthropic.claude-3-7-sonnet": {
|
|
1157
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1158
|
+
};
|
|
1114
1159
|
"anthropic.claude-3-5-sonnet": {
|
|
1115
1160
|
input: Omit<AnthropicRequest, "model">;
|
|
1116
1161
|
};
|
|
@@ -1120,44 +1165,41 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1120
1165
|
"anthropic.claude-3-opus": {
|
|
1121
1166
|
input: Omit<AnthropicRequest, "model">;
|
|
1122
1167
|
};
|
|
1123
|
-
"
|
|
1124
|
-
input: Omit<AnthropicRequest, "model">;
|
|
1125
|
-
};
|
|
1126
|
-
"google.gemini-2.5-pro-exp-03-25": {
|
|
1168
|
+
"google.gemini-2.5-flash": {
|
|
1127
1169
|
input: Omit<GeminiRequest, "model">;
|
|
1128
1170
|
};
|
|
1129
|
-
"google.gemini-2.
|
|
1171
|
+
"google.gemini-2.5-flash-lite": {
|
|
1130
1172
|
input: Omit<GeminiRequest, "model">;
|
|
1131
1173
|
};
|
|
1132
|
-
"google.gemini-2.
|
|
1174
|
+
"google.gemini-2.5-pro": {
|
|
1133
1175
|
input: Omit<GeminiRequest, "model">;
|
|
1134
1176
|
};
|
|
1135
|
-
"google.gemini-2.
|
|
1177
|
+
"google.gemini-2.0-flash": {
|
|
1136
1178
|
input: Omit<GeminiRequest, "model">;
|
|
1137
1179
|
};
|
|
1138
|
-
"google.gemini-2.
|
|
1180
|
+
"google.gemini-2.0-flash-lite": {
|
|
1139
1181
|
input: Omit<GeminiRequest, "model">;
|
|
1140
1182
|
};
|
|
1141
1183
|
"google.gemini-1.5-pro": {
|
|
1142
1184
|
input: Omit<GeminiRequest, "model">;
|
|
1143
1185
|
};
|
|
1144
|
-
"google.gemini-2.5-pro": {
|
|
1145
|
-
input: Omit<GeminiRequest, "model">;
|
|
1146
|
-
};
|
|
1147
1186
|
"xai.grok-2": {
|
|
1148
|
-
input:
|
|
1187
|
+
input: Omit<XAiRequest, "model">;
|
|
1149
1188
|
};
|
|
1150
1189
|
"xai.grok-3": {
|
|
1151
|
-
input:
|
|
1190
|
+
input: Omit<XAiRequest, "model">;
|
|
1152
1191
|
};
|
|
1153
1192
|
"xai.grok-3-mini": {
|
|
1154
|
-
input: Omit<
|
|
1193
|
+
input: Omit<XAiRequest, "model">;
|
|
1155
1194
|
};
|
|
1156
1195
|
"xai.grok-4": {
|
|
1157
|
-
input:
|
|
1196
|
+
input: Omit<XAiRequest, "model">;
|
|
1158
1197
|
};
|
|
1159
1198
|
"xai.grok-4-fast": {
|
|
1160
|
-
input: Omit<
|
|
1199
|
+
input: Omit<XAiRequest, "model">;
|
|
1200
|
+
};
|
|
1201
|
+
"xai.grok-4-1-fast": {
|
|
1202
|
+
input: Omit<XAiRequest, "model">;
|
|
1161
1203
|
};
|
|
1162
1204
|
"ollama.deepseek-r1": {
|
|
1163
1205
|
input: GenericLLm;
|
|
@@ -1174,9 +1216,27 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1174
1216
|
"ollama.qwq": {
|
|
1175
1217
|
input: GenericLLm;
|
|
1176
1218
|
};
|
|
1219
|
+
"ollama.gemma3": {
|
|
1220
|
+
input: GenericLLm;
|
|
1221
|
+
};
|
|
1222
|
+
"ollama.mistral": {
|
|
1223
|
+
input: GenericLLm;
|
|
1224
|
+
};
|
|
1225
|
+
"ollama.qwen2.5": {
|
|
1226
|
+
input: GenericLLm;
|
|
1227
|
+
};
|
|
1228
|
+
"ollama.qwen3": {
|
|
1229
|
+
input: GenericLLm;
|
|
1230
|
+
};
|
|
1177
1231
|
"deepseek.chat": {
|
|
1178
1232
|
input: DeepseekRequest;
|
|
1179
1233
|
};
|
|
1234
|
+
"deepseek.v4-flash": {
|
|
1235
|
+
input: Omit<DeepseekRequest, "model">;
|
|
1236
|
+
};
|
|
1237
|
+
"deepseek.v4-pro": {
|
|
1238
|
+
input: Omit<DeepseekRequest, "model">;
|
|
1239
|
+
};
|
|
1180
1240
|
};
|
|
1181
1241
|
type LlmProviderKey = keyof AllLlm;
|
|
1182
1242
|
type EmbeddingProviderKey = keyof AllEmbedding;
|
|
@@ -1486,37 +1546,47 @@ declare namespace guards {
|
|
|
1486
1546
|
declare const configs: {
|
|
1487
1547
|
"deepseek.chat.v1": Config<keyof AllLlm>;
|
|
1488
1548
|
"deepseek.chat": Config<keyof AllLlm>;
|
|
1549
|
+
"deepseek.v4-flash": Config<keyof AllLlm>;
|
|
1550
|
+
"deepseek.v4-pro": Config<keyof AllLlm>;
|
|
1489
1551
|
"google.chat.v1": Config<keyof AllLlm>;
|
|
1490
|
-
"google.gemini-2.0-flash": Config<keyof AllLlm>;
|
|
1491
|
-
"google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
|
|
1492
1552
|
"google.gemini-2.5-flash": Config<keyof AllLlm>;
|
|
1493
1553
|
"google.gemini-2.5-flash-lite": Config<keyof AllLlm>;
|
|
1494
|
-
"google.gemini-1.5-pro": Config<keyof AllLlm>;
|
|
1495
1554
|
"google.gemini-2.5-pro": Config<keyof AllLlm>;
|
|
1555
|
+
"google.gemini-2.0-flash": Config<keyof AllLlm>;
|
|
1556
|
+
"google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
|
|
1557
|
+
"google.gemini-1.5-pro": Config<keyof AllLlm>;
|
|
1496
1558
|
"ollama.chat.v1": Config<keyof AllLlm>;
|
|
1497
1559
|
"ollama.deepseek-r1": Config<keyof AllLlm>;
|
|
1498
1560
|
"ollama.llama3.3": Config<keyof AllLlm>;
|
|
1499
1561
|
"ollama.llama3.2": Config<keyof AllLlm>;
|
|
1500
1562
|
"ollama.llama3.1": Config<keyof AllLlm>;
|
|
1501
1563
|
"ollama.qwq": Config<keyof AllLlm>;
|
|
1564
|
+
"ollama.gemma3": Config<keyof AllLlm>;
|
|
1565
|
+
"ollama.mistral": Config<keyof AllLlm>;
|
|
1566
|
+
"ollama.qwen2.5": Config<keyof AllLlm>;
|
|
1567
|
+
"ollama.qwen3": Config<keyof AllLlm>;
|
|
1502
1568
|
"xai.chat.v1": Config<keyof AllLlm>;
|
|
1503
1569
|
"xai.grok-2": Config<keyof AllLlm>;
|
|
1504
1570
|
"xai.grok-3": Config<keyof AllLlm>;
|
|
1505
1571
|
"xai.grok-3-mini": Config<keyof AllLlm>;
|
|
1506
1572
|
"xai.grok-4": Config<keyof AllLlm>;
|
|
1507
1573
|
"xai.grok-4-fast": Config<keyof AllLlm>;
|
|
1574
|
+
"xai.grok-4-1-fast": Config<keyof AllLlm>;
|
|
1508
1575
|
"amazon:anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1509
1576
|
"amazon:meta.chat.v1": Config<keyof AllLlm>;
|
|
1510
1577
|
"anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1578
|
+
"anthropic.claude-opus-4-7": Config<keyof AllLlm>;
|
|
1511
1579
|
"anthropic.claude-opus-4-6": Config<keyof AllLlm>;
|
|
1512
1580
|
"anthropic.claude-sonnet-4-6": Config<keyof AllLlm>;
|
|
1581
|
+
"anthropic.claude-haiku-4-5": Config<keyof AllLlm>;
|
|
1582
|
+
"anthropic.claude-sonnet-4-5": Config<keyof AllLlm>;
|
|
1583
|
+
"anthropic.claude-opus-4-1": Config<keyof AllLlm>;
|
|
1513
1584
|
"anthropic.claude-sonnet-4": Config<keyof AllLlm>;
|
|
1514
1585
|
"anthropic.claude-opus-4": Config<keyof AllLlm>;
|
|
1515
1586
|
"anthropic.claude-3-7-sonnet": Config<keyof AllLlm>;
|
|
1516
1587
|
"anthropic.claude-3-5-sonnet": Config<keyof AllLlm>;
|
|
1517
1588
|
"anthropic.claude-3-5-haiku": Config<keyof AllLlm>;
|
|
1518
1589
|
"anthropic.claude-3-opus": Config<keyof AllLlm>;
|
|
1519
|
-
"anthropic.claude-3-haiku": Config<keyof AllLlm>;
|
|
1520
1590
|
"openai.chat.v1": Config<keyof AllLlm>;
|
|
1521
1591
|
"openai.chat-mock.v1": Config<keyof AllLlm>;
|
|
1522
1592
|
"openai.gpt-5.2": Config<keyof AllLlm>;
|
|
@@ -1526,9 +1596,10 @@ declare const configs: {
|
|
|
1526
1596
|
"openai.gpt-4.1-mini": Config<keyof AllLlm>;
|
|
1527
1597
|
"openai.gpt-4.1-nano": Config<keyof AllLlm>;
|
|
1528
1598
|
"openai.o3": Config<keyof AllLlm>;
|
|
1529
|
-
"openai.
|
|
1599
|
+
"openai.gpt-4": Config<keyof AllLlm>;
|
|
1530
1600
|
"openai.gpt-4o": Config<keyof AllLlm>;
|
|
1531
1601
|
"openai.gpt-4o-mini": Config<keyof AllLlm>;
|
|
1602
|
+
"openai.o4-mini": Config<keyof AllLlm>;
|
|
1532
1603
|
};
|
|
1533
1604
|
|
|
1534
1605
|
declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): BaseLlm;
|
|
@@ -1557,6 +1628,7 @@ declare function createOpenAiCompatibleConfiguration<K extends Config["key"]>(ov
|
|
|
1557
1628
|
provider: string;
|
|
1558
1629
|
endpoint: string;
|
|
1559
1630
|
apiKeyMapping: [string, string];
|
|
1631
|
+
isReasoningModel?: (model: string) => boolean;
|
|
1560
1632
|
transformResponse?: any;
|
|
1561
1633
|
}): Config<keyof AllLlm>;
|
|
1562
1634
|
|