llm-exe 2.3.1 → 2.3.2

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 CHANGED
@@ -602,6 +602,10 @@ declare abstract class BaseExecutor<I extends PlainObject, O = any, H extends Ba
602
602
  */
603
603
  hooks: any;
604
604
  readonly allowedHooks: any[];
605
+ /**
606
+ * @property maxHooksPerEvent - Maximum number of hooks allowed per event
607
+ */
608
+ readonly maxHooksPerEvent: number;
605
609
  constructor(name: string, type: string, options?: CoreExecutorExecuteOptions<H>);
606
610
  abstract handler(input: I, _options?: any): Promise<any>;
607
611
  /**
@@ -635,6 +639,18 @@ declare abstract class BaseExecutor<I extends PlainObject, O = any, H extends Ba
635
639
  once(eventName: keyof H, fn: ListenerFunction): this;
636
640
  withTraceId(traceId: string): this;
637
641
  getTraceId(): string | null;
642
+ /**
643
+ * Clear all hooks for a specific event or all events
644
+ * Useful for preventing memory leaks in long-running processes
645
+ * @param eventName - The event name to clear hooks for
646
+ */
647
+ clearHooks(eventName?: keyof H): this;
648
+ /**
649
+ * Get the count of hooks for monitoring memory usage
650
+ * @param eventName - Optional event name to get count for
651
+ * @returns Hook count for specific event or all events
652
+ */
653
+ getHookCount(eventName?: keyof H): number | Record<string, number>;
638
654
  }
639
655
 
640
656
  /**
@@ -938,6 +954,8 @@ interface BaseLlmOptions {
938
954
  numOfAttempts?: number;
939
955
  jitter?: "none" | "full";
940
956
  promptType?: PromptType;
957
+ endpoint?: string;
958
+ headers?: Record<string, string>;
941
959
  }
942
960
  interface GenericEmbeddingOptions extends BaseLlmOptions {
943
961
  model?: string;
@@ -966,6 +984,7 @@ interface GenericLLm extends BaseLlmOptions {
966
984
  streamOptions?: Record<string, any>;
967
985
  maxTokens?: number;
968
986
  stopSequences?: string[];
987
+ effort?: "minimal" | "low" | "medium" | "high";
969
988
  }
970
989
  interface OpenAiRequest extends GenericLLm {
971
990
  model: string;
@@ -984,6 +1003,11 @@ interface AmazonBedrockRequest extends GenericLLm {
984
1003
  interface AnthropicRequest extends GenericLLm {
985
1004
  model: string;
986
1005
  anthropicApiKey?: string;
1006
+ topK?: number;
1007
+ metadata?: {
1008
+ user_id?: string;
1009
+ };
1010
+ serviceTier?: "auto" | "standard_only";
987
1011
  }
988
1012
  interface GeminiRequest extends GenericLLm {
989
1013
  model: string;
@@ -1051,18 +1075,24 @@ type AllUseLlmOptions = AllLlm & {
1051
1075
  "anthropic.claude-3-7-sonnet": {
1052
1076
  input: Omit<AnthropicRequest, "model">;
1053
1077
  };
1054
- "anthropic.claude-3-5-sonnet": {
1078
+ "anthropic.claude-sonnet-4": {
1055
1079
  input: Omit<AnthropicRequest, "model">;
1056
1080
  };
1057
- "anthropic.claude-3-opus": {
1081
+ "anthropic.claude-opus-4": {
1058
1082
  input: Omit<AnthropicRequest, "model">;
1059
1083
  };
1060
- "anthropic.claude-3-sonnet": {
1084
+ "anthropic.claude-3-5-sonnet": {
1061
1085
  input: Omit<AnthropicRequest, "model">;
1062
1086
  };
1063
1087
  "anthropic.claude-3-5-haiku": {
1064
1088
  input: Omit<AnthropicRequest, "model">;
1065
1089
  };
1090
+ "anthropic.claude-3-opus": {
1091
+ input: Omit<AnthropicRequest, "model">;
1092
+ };
1093
+ "anthropic.claude-3-haiku": {
1094
+ input: Omit<AnthropicRequest, "model">;
1095
+ };
1066
1096
  "google.gemini-2.5-pro-exp-03-25": {
1067
1097
  input: Omit<GeminiRequest, "model">;
1068
1098
  };
@@ -1131,25 +1161,106 @@ interface BaseLlm<_T extends BaseLlCall = BaseLlCall> extends BaseRequest<_T> {
1131
1161
 
1132
1162
  type LlmProvider = "openai.chat" | "openai.embedding" | "google.embedding" | "openai.chat-mock" | "anthropic.chat" | "amazon:anthropic.chat" | "amazon:meta.chat" | "amazon:nova.chat" | "amazon.embedding" | "xai.chat" | "google.chat" | "ollama.chat" | "deepseek.chat";
1133
1163
  interface Config<Pk = LlmProviderKey> {
1164
+ /**
1165
+ * Unique identifier for this configuration (e.g., "openai.chat.v1", "anthropic.claude-3-opus")
1166
+ * Used to reference this config when calling useLlm()
1167
+ */
1134
1168
  key: Pk;
1169
+ /**
1170
+ * The provider type this config is for (e.g., "openai.chat", "anthropic.chat")
1171
+ * Used internally for provider-specific logic
1172
+ */
1135
1173
  provider: LlmProvider;
1136
- method: string;
1174
+ /**
1175
+ * HTTP method for the API request (typically "POST" for LLM providers)
1176
+ */
1177
+ method: "POST" | "PUT" | "GET";
1178
+ /**
1179
+ * API endpoint URL template. Supports template variables using {{variable}} syntax
1180
+ * Variables are replaced with values from the state object
1181
+ * @example "https://api.openai.com/v1/chat/completions"
1182
+ * @example "https://bedrock-runtime.{{awsRegion}}.amazonaws.com/model/{{model}}/invoke"
1183
+ */
1137
1184
  endpoint: string;
1185
+ /**
1186
+ * HTTP headers template as a JSON string. Supports template variables using {{variable}} syntax
1187
+ * @example '{"Authorization":"Bearer {{openAiApiKey}}", "Content-Type": "application/json"}'
1188
+ * // TODO: make this also accept object and function
1189
+ */
1190
+ headers: string;
1138
1191
  options: {
1139
1192
  [key in string]: {
1140
- default?: number | string;
1193
+ /**
1194
+ * Default value for this parameter if not provided by the user
1195
+ * Can be a static value or a function that returns the value
1196
+ * @example 4096
1197
+ * @example () => process.env.OPENAI_API_KEY
1198
+ */
1199
+ default?: any;
1200
+ /**
1201
+ * Whether this parameter is required
1202
+ * [true, "error message"] - Required with custom error
1203
+ * [true] - Required with default error message
1204
+ * @example [true, "maxTokens is required for Anthropic"]
1205
+ */
1141
1206
  required?: [boolean, string] | [boolean];
1142
1207
  };
1143
1208
  };
1144
1209
  mapBody: {
1145
1210
  [key in string]: {
1211
+ /**
1212
+ * The target field name in the provider's request body.
1213
+ * Supports dot notation for nested fields (e.g., "response_format.type")
1214
+ */
1146
1215
  key: string;
1147
- default?: number | string;
1148
- sanitize?: (i: any, arg: Record<string, any>, arg2: Record<string, any>) => any;
1216
+ /**
1217
+ * Default value to use if the source field is not provided
1218
+ */
1219
+ default?: any;
1220
+ /**
1221
+ * Transform function to convert the value before mapping to the request body
1222
+ * @param value - The input value from the user's state
1223
+ * @param state - The complete user state object containing all parameters
1224
+ * @param config - The current Config object (for access to options, etc.)
1225
+ * @returns The transformed value to be included in the request body
1226
+ */
1227
+ transform?: (value: any, state: Record<string, any>, config: Record<string, any>) => any;
1149
1228
  };
1150
1229
  };
1151
- headers: string;
1152
- prompt?: (messages: IChatMessages) => any;
1230
+ /**
1231
+ * Maps executor-level options (jsonSchema, functions, functionCall) to provider-specific request formats
1232
+ * @optional - Only needed if provider supports these features
1233
+ */
1234
+ mapOptions?: {
1235
+ /**
1236
+ * Transform JSON schema into provider-specific format
1237
+ * @param schema - The JSON schema object
1238
+ * @param options - Executor options (e.g., functionCallStrictInput)
1239
+ * @param currentInput - Current accumulated input state (for merging)
1240
+ * @param config - The full config object
1241
+ * @returns Provider-specific request body additions
1242
+ */
1243
+ jsonSchema?: (schema: any, options: any, currentInput?: Record<string, any>, config?: Config) => Record<string, any>;
1244
+ /**
1245
+ * Transform function call mode into provider-specific format
1246
+ * @param call - Function call mode ("auto", "any", "none", or specific function)
1247
+ * @param options - Executor options
1248
+ * @param currentInput - Current accumulated input state (for merging)
1249
+ * @param config - The full config object
1250
+ * @returns Provider-specific request body additions
1251
+ */
1252
+ functionCall?: (call: any, options?: any, currentInput?: Record<string, any>, config?: Config) => Record<string, any>;
1253
+ /**
1254
+ * Transform function definitions into provider-specific format
1255
+ * @param functions - Array of function definitions
1256
+ * @param options - Executor options (e.g., functionCallStrictInput)
1257
+ * @param currentInput - Current accumulated input state (for merging)
1258
+ * @param config - The full config object
1259
+ * @returns Provider-specific request body additions
1260
+ */
1261
+ functions?: (functions: any[], options?: any, currentInput?: Record<string, any>, config?: Config) => Record<string, any>;
1262
+ };
1263
+ transformResponse: (result: any, _config?: Config<any>) => OutputResult;
1153
1264
  }
1154
1265
 
1155
1266
  declare function enforceResultAttributes<O>(input: any): {
@@ -1359,20 +1470,26 @@ declare const configs: {
1359
1470
  "amazon:anthropic.chat.v1": Config<keyof AllLlm>;
1360
1471
  "amazon:meta.chat.v1": Config<keyof AllLlm>;
1361
1472
  "anthropic.chat.v1": Config<keyof AllLlm>;
1362
- "anthropic.claude-sonnet-4-0": Config<keyof AllLlm>;
1363
- "anthropic.claude-opus-4-0": Config<keyof AllLlm>;
1473
+ "anthropic.claude-sonnet-4": Config<keyof AllLlm>;
1474
+ "anthropic.claude-opus-4": Config<keyof AllLlm>;
1364
1475
  "anthropic.claude-3-7-sonnet": Config<keyof AllLlm>;
1365
1476
  "anthropic.claude-3-5-sonnet": Config<keyof AllLlm>;
1366
1477
  "anthropic.claude-3-5-haiku": Config<keyof AllLlm>;
1367
1478
  "anthropic.claude-3-opus": Config<keyof AllLlm>;
1479
+ "anthropic.claude-3-haiku": Config<keyof AllLlm>;
1368
1480
  "openai.chat.v1": Config<keyof AllLlm>;
1369
1481
  "openai.chat-mock.v1": Config<keyof AllLlm>;
1370
1482
  "openai.gpt-4o": Config<keyof AllLlm>;
1371
1483
  "openai.gpt-4o-mini": Config<keyof AllLlm>;
1372
1484
  };
1373
1485
 
1374
- declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): {
1375
- call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<BaseLlCall>;
1486
+ declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): BaseLlm;
1487
+ declare function useLlmConfiguration<T extends keyof typeof configs>(config: Config<any>): (options?: AllUseLlmOptions[T]["input"]) => {
1488
+ call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<{
1489
+ getResultContent: (index?: number) => OutputResultContent[];
1490
+ getResultText: (index?: number) => string;
1491
+ getResult: () => OutputResult;
1492
+ }>;
1376
1493
  getTraceId: () => string | null;
1377
1494
  withTraceId: (id: string) => void;
1378
1495
  getMetadata: () => {
@@ -1387,6 +1504,14 @@ declare function useLlm<T extends keyof typeof configs>(provider: T, options?: A
1387
1504
  };
1388
1505
  };
1389
1506
 
1507
+ declare function createOpenAiCompatibleConfiguration<K extends Config["key"]>(overrides: {
1508
+ key: string;
1509
+ provider: string;
1510
+ endpoint: string;
1511
+ apiKeyMapping: [string, string];
1512
+ transformResponse?: any;
1513
+ }): Config<keyof AllLlm>;
1514
+
1390
1515
  declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, options: AllEmbedding[T]["input"]): {
1391
1516
  call: (messages: string | string[], options?: LlmExecutorWithFunctionsOptions) => Promise<{
1392
1517
  getEmbedding: (index?: number) => number[];
@@ -1406,4 +1531,4 @@ declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, op
1406
1531
  };
1407
1532
  };
1408
1533
 
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 };
1534
+ 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, createOpenAiCompatibleConfiguration, createParser, createPrompt, createState, createStateItem, defineSchema, guards, registerHelpers, registerPartials, useExecutors, useLlm, useLlmConfiguration, index as utils };
package/dist/index.d.ts CHANGED
@@ -602,6 +602,10 @@ declare abstract class BaseExecutor<I extends PlainObject, O = any, H extends Ba
602
602
  */
603
603
  hooks: any;
604
604
  readonly allowedHooks: any[];
605
+ /**
606
+ * @property maxHooksPerEvent - Maximum number of hooks allowed per event
607
+ */
608
+ readonly maxHooksPerEvent: number;
605
609
  constructor(name: string, type: string, options?: CoreExecutorExecuteOptions<H>);
606
610
  abstract handler(input: I, _options?: any): Promise<any>;
607
611
  /**
@@ -635,6 +639,18 @@ declare abstract class BaseExecutor<I extends PlainObject, O = any, H extends Ba
635
639
  once(eventName: keyof H, fn: ListenerFunction): this;
636
640
  withTraceId(traceId: string): this;
637
641
  getTraceId(): string | null;
642
+ /**
643
+ * Clear all hooks for a specific event or all events
644
+ * Useful for preventing memory leaks in long-running processes
645
+ * @param eventName - The event name to clear hooks for
646
+ */
647
+ clearHooks(eventName?: keyof H): this;
648
+ /**
649
+ * Get the count of hooks for monitoring memory usage
650
+ * @param eventName - Optional event name to get count for
651
+ * @returns Hook count for specific event or all events
652
+ */
653
+ getHookCount(eventName?: keyof H): number | Record<string, number>;
638
654
  }
639
655
 
640
656
  /**
@@ -938,6 +954,8 @@ interface BaseLlmOptions {
938
954
  numOfAttempts?: number;
939
955
  jitter?: "none" | "full";
940
956
  promptType?: PromptType;
957
+ endpoint?: string;
958
+ headers?: Record<string, string>;
941
959
  }
942
960
  interface GenericEmbeddingOptions extends BaseLlmOptions {
943
961
  model?: string;
@@ -966,6 +984,7 @@ interface GenericLLm extends BaseLlmOptions {
966
984
  streamOptions?: Record<string, any>;
967
985
  maxTokens?: number;
968
986
  stopSequences?: string[];
987
+ effort?: "minimal" | "low" | "medium" | "high";
969
988
  }
970
989
  interface OpenAiRequest extends GenericLLm {
971
990
  model: string;
@@ -984,6 +1003,11 @@ interface AmazonBedrockRequest extends GenericLLm {
984
1003
  interface AnthropicRequest extends GenericLLm {
985
1004
  model: string;
986
1005
  anthropicApiKey?: string;
1006
+ topK?: number;
1007
+ metadata?: {
1008
+ user_id?: string;
1009
+ };
1010
+ serviceTier?: "auto" | "standard_only";
987
1011
  }
988
1012
  interface GeminiRequest extends GenericLLm {
989
1013
  model: string;
@@ -1051,18 +1075,24 @@ type AllUseLlmOptions = AllLlm & {
1051
1075
  "anthropic.claude-3-7-sonnet": {
1052
1076
  input: Omit<AnthropicRequest, "model">;
1053
1077
  };
1054
- "anthropic.claude-3-5-sonnet": {
1078
+ "anthropic.claude-sonnet-4": {
1055
1079
  input: Omit<AnthropicRequest, "model">;
1056
1080
  };
1057
- "anthropic.claude-3-opus": {
1081
+ "anthropic.claude-opus-4": {
1058
1082
  input: Omit<AnthropicRequest, "model">;
1059
1083
  };
1060
- "anthropic.claude-3-sonnet": {
1084
+ "anthropic.claude-3-5-sonnet": {
1061
1085
  input: Omit<AnthropicRequest, "model">;
1062
1086
  };
1063
1087
  "anthropic.claude-3-5-haiku": {
1064
1088
  input: Omit<AnthropicRequest, "model">;
1065
1089
  };
1090
+ "anthropic.claude-3-opus": {
1091
+ input: Omit<AnthropicRequest, "model">;
1092
+ };
1093
+ "anthropic.claude-3-haiku": {
1094
+ input: Omit<AnthropicRequest, "model">;
1095
+ };
1066
1096
  "google.gemini-2.5-pro-exp-03-25": {
1067
1097
  input: Omit<GeminiRequest, "model">;
1068
1098
  };
@@ -1131,25 +1161,106 @@ interface BaseLlm<_T extends BaseLlCall = BaseLlCall> extends BaseRequest<_T> {
1131
1161
 
1132
1162
  type LlmProvider = "openai.chat" | "openai.embedding" | "google.embedding" | "openai.chat-mock" | "anthropic.chat" | "amazon:anthropic.chat" | "amazon:meta.chat" | "amazon:nova.chat" | "amazon.embedding" | "xai.chat" | "google.chat" | "ollama.chat" | "deepseek.chat";
1133
1163
  interface Config<Pk = LlmProviderKey> {
1164
+ /**
1165
+ * Unique identifier for this configuration (e.g., "openai.chat.v1", "anthropic.claude-3-opus")
1166
+ * Used to reference this config when calling useLlm()
1167
+ */
1134
1168
  key: Pk;
1169
+ /**
1170
+ * The provider type this config is for (e.g., "openai.chat", "anthropic.chat")
1171
+ * Used internally for provider-specific logic
1172
+ */
1135
1173
  provider: LlmProvider;
1136
- method: string;
1174
+ /**
1175
+ * HTTP method for the API request (typically "POST" for LLM providers)
1176
+ */
1177
+ method: "POST" | "PUT" | "GET";
1178
+ /**
1179
+ * API endpoint URL template. Supports template variables using {{variable}} syntax
1180
+ * Variables are replaced with values from the state object
1181
+ * @example "https://api.openai.com/v1/chat/completions"
1182
+ * @example "https://bedrock-runtime.{{awsRegion}}.amazonaws.com/model/{{model}}/invoke"
1183
+ */
1137
1184
  endpoint: string;
1185
+ /**
1186
+ * HTTP headers template as a JSON string. Supports template variables using {{variable}} syntax
1187
+ * @example '{"Authorization":"Bearer {{openAiApiKey}}", "Content-Type": "application/json"}'
1188
+ * // TODO: make this also accept object and function
1189
+ */
1190
+ headers: string;
1138
1191
  options: {
1139
1192
  [key in string]: {
1140
- default?: number | string;
1193
+ /**
1194
+ * Default value for this parameter if not provided by the user
1195
+ * Can be a static value or a function that returns the value
1196
+ * @example 4096
1197
+ * @example () => process.env.OPENAI_API_KEY
1198
+ */
1199
+ default?: any;
1200
+ /**
1201
+ * Whether this parameter is required
1202
+ * [true, "error message"] - Required with custom error
1203
+ * [true] - Required with default error message
1204
+ * @example [true, "maxTokens is required for Anthropic"]
1205
+ */
1141
1206
  required?: [boolean, string] | [boolean];
1142
1207
  };
1143
1208
  };
1144
1209
  mapBody: {
1145
1210
  [key in string]: {
1211
+ /**
1212
+ * The target field name in the provider's request body.
1213
+ * Supports dot notation for nested fields (e.g., "response_format.type")
1214
+ */
1146
1215
  key: string;
1147
- default?: number | string;
1148
- sanitize?: (i: any, arg: Record<string, any>, arg2: Record<string, any>) => any;
1216
+ /**
1217
+ * Default value to use if the source field is not provided
1218
+ */
1219
+ default?: any;
1220
+ /**
1221
+ * Transform function to convert the value before mapping to the request body
1222
+ * @param value - The input value from the user's state
1223
+ * @param state - The complete user state object containing all parameters
1224
+ * @param config - The current Config object (for access to options, etc.)
1225
+ * @returns The transformed value to be included in the request body
1226
+ */
1227
+ transform?: (value: any, state: Record<string, any>, config: Record<string, any>) => any;
1149
1228
  };
1150
1229
  };
1151
- headers: string;
1152
- prompt?: (messages: IChatMessages) => any;
1230
+ /**
1231
+ * Maps executor-level options (jsonSchema, functions, functionCall) to provider-specific request formats
1232
+ * @optional - Only needed if provider supports these features
1233
+ */
1234
+ mapOptions?: {
1235
+ /**
1236
+ * Transform JSON schema into provider-specific format
1237
+ * @param schema - The JSON schema object
1238
+ * @param options - Executor options (e.g., functionCallStrictInput)
1239
+ * @param currentInput - Current accumulated input state (for merging)
1240
+ * @param config - The full config object
1241
+ * @returns Provider-specific request body additions
1242
+ */
1243
+ jsonSchema?: (schema: any, options: any, currentInput?: Record<string, any>, config?: Config) => Record<string, any>;
1244
+ /**
1245
+ * Transform function call mode into provider-specific format
1246
+ * @param call - Function call mode ("auto", "any", "none", or specific function)
1247
+ * @param options - Executor options
1248
+ * @param currentInput - Current accumulated input state (for merging)
1249
+ * @param config - The full config object
1250
+ * @returns Provider-specific request body additions
1251
+ */
1252
+ functionCall?: (call: any, options?: any, currentInput?: Record<string, any>, config?: Config) => Record<string, any>;
1253
+ /**
1254
+ * Transform function definitions into provider-specific format
1255
+ * @param functions - Array of function definitions
1256
+ * @param options - Executor options (e.g., functionCallStrictInput)
1257
+ * @param currentInput - Current accumulated input state (for merging)
1258
+ * @param config - The full config object
1259
+ * @returns Provider-specific request body additions
1260
+ */
1261
+ functions?: (functions: any[], options?: any, currentInput?: Record<string, any>, config?: Config) => Record<string, any>;
1262
+ };
1263
+ transformResponse: (result: any, _config?: Config<any>) => OutputResult;
1153
1264
  }
1154
1265
 
1155
1266
  declare function enforceResultAttributes<O>(input: any): {
@@ -1359,20 +1470,26 @@ declare const configs: {
1359
1470
  "amazon:anthropic.chat.v1": Config<keyof AllLlm>;
1360
1471
  "amazon:meta.chat.v1": Config<keyof AllLlm>;
1361
1472
  "anthropic.chat.v1": Config<keyof AllLlm>;
1362
- "anthropic.claude-sonnet-4-0": Config<keyof AllLlm>;
1363
- "anthropic.claude-opus-4-0": Config<keyof AllLlm>;
1473
+ "anthropic.claude-sonnet-4": Config<keyof AllLlm>;
1474
+ "anthropic.claude-opus-4": Config<keyof AllLlm>;
1364
1475
  "anthropic.claude-3-7-sonnet": Config<keyof AllLlm>;
1365
1476
  "anthropic.claude-3-5-sonnet": Config<keyof AllLlm>;
1366
1477
  "anthropic.claude-3-5-haiku": Config<keyof AllLlm>;
1367
1478
  "anthropic.claude-3-opus": Config<keyof AllLlm>;
1479
+ "anthropic.claude-3-haiku": Config<keyof AllLlm>;
1368
1480
  "openai.chat.v1": Config<keyof AllLlm>;
1369
1481
  "openai.chat-mock.v1": Config<keyof AllLlm>;
1370
1482
  "openai.gpt-4o": Config<keyof AllLlm>;
1371
1483
  "openai.gpt-4o-mini": Config<keyof AllLlm>;
1372
1484
  };
1373
1485
 
1374
- declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): {
1375
- call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<BaseLlCall>;
1486
+ declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): BaseLlm;
1487
+ declare function useLlmConfiguration<T extends keyof typeof configs>(config: Config<any>): (options?: AllUseLlmOptions[T]["input"]) => {
1488
+ call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<{
1489
+ getResultContent: (index?: number) => OutputResultContent[];
1490
+ getResultText: (index?: number) => string;
1491
+ getResult: () => OutputResult;
1492
+ }>;
1376
1493
  getTraceId: () => string | null;
1377
1494
  withTraceId: (id: string) => void;
1378
1495
  getMetadata: () => {
@@ -1387,6 +1504,14 @@ declare function useLlm<T extends keyof typeof configs>(provider: T, options?: A
1387
1504
  };
1388
1505
  };
1389
1506
 
1507
+ declare function createOpenAiCompatibleConfiguration<K extends Config["key"]>(overrides: {
1508
+ key: string;
1509
+ provider: string;
1510
+ endpoint: string;
1511
+ apiKeyMapping: [string, string];
1512
+ transformResponse?: any;
1513
+ }): Config<keyof AllLlm>;
1514
+
1390
1515
  declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, options: AllEmbedding[T]["input"]): {
1391
1516
  call: (messages: string | string[], options?: LlmExecutorWithFunctionsOptions) => Promise<{
1392
1517
  getEmbedding: (index?: number) => number[];
@@ -1406,4 +1531,4 @@ declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, op
1406
1531
  };
1407
1532
  };
1408
1533
 
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 };
1534
+ 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, createOpenAiCompatibleConfiguration, createParser, createPrompt, createState, createStateItem, defineSchema, guards, registerHelpers, registerPartials, useExecutors, useLlm, useLlmConfiguration, index as utils };