llm-exe 3.0.0-beta.1 → 3.0.0-beta.3
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 +44 -21
- package/dist/index.d.ts +44 -21
- package/dist/index.js +299 -78
- package/dist/index.mjs +299 -78
- package/package.json +1 -1
- package/readme.md +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -92,7 +92,7 @@ declare abstract class BaseParser<T = any, TInput = string> {
|
|
|
92
92
|
declare abstract class BaseParserWithJson<S extends JSONSchema | undefined = undefined, T = S extends JSONSchema ? FromSchema<S> : Record<string, any>, TInput = string> extends BaseParser<T, TInput> {
|
|
93
93
|
schema: S;
|
|
94
94
|
validateSchema: boolean;
|
|
95
|
-
constructor(name: string, options:
|
|
95
|
+
constructor(name: string, options: ParserSchemaOptions<S>);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
@@ -111,25 +111,31 @@ declare class StringParser extends BaseParser<string> {
|
|
|
111
111
|
parse(text: string, _attributes?: Record<string, any>): string;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
type BooleanParserMatch = "exact" | "extract";
|
|
115
|
+
interface BooleanParserOptions {
|
|
116
|
+
match?: BooleanParserMatch;
|
|
117
|
+
}
|
|
114
118
|
/**
|
|
115
119
|
* v3 parser contract:
|
|
116
120
|
* Category: strict
|
|
117
|
-
* Mode:
|
|
121
|
+
* Mode: exact
|
|
118
122
|
*
|
|
119
123
|
* Accepts only documented boolean literals after trim/lowercase.
|
|
120
|
-
* Returns true/false only when input is recognized.
|
|
121
|
-
*
|
|
122
|
-
*
|
|
124
|
+
* Returns true/false only when input is recognized. Pass match: "extract" to
|
|
125
|
+
* extract one documented boolean literal from surrounding text.
|
|
126
|
+
* Throws LlmExeError(parser.parse_failed) for empty or unrecognized input.
|
|
127
|
+
* Invalid input types throw LlmExeError(parser.invalid_input).
|
|
123
128
|
* Error context does not include input content unless LLM_EXE_DEBUG is enabled.
|
|
124
129
|
*
|
|
125
130
|
*/
|
|
126
131
|
declare class BooleanParser extends BaseParser<boolean> {
|
|
127
|
-
|
|
132
|
+
private match;
|
|
133
|
+
constructor(options?: BooleanParserOptions);
|
|
128
134
|
private getInputErrorContext;
|
|
129
135
|
parse(text: string, _attributes?: Record<string, any>): boolean;
|
|
130
136
|
}
|
|
131
137
|
|
|
132
|
-
type NumberParserMatch = "
|
|
138
|
+
type NumberParserMatch = "exact" | "extract";
|
|
133
139
|
interface NumberParserOptions {
|
|
134
140
|
match?: NumberParserMatch;
|
|
135
141
|
}
|
|
@@ -138,7 +144,7 @@ interface NumberParserOptions {
|
|
|
138
144
|
* Category: extractor
|
|
139
145
|
* Mode: numeric token extraction
|
|
140
146
|
*
|
|
141
|
-
* Extracts one documented numeric token from text. Pass match: "
|
|
147
|
+
* Extracts one documented numeric token from text. Pass match: "exact" to
|
|
142
148
|
* require the input to consist of exactly one numeric token (after trim) with
|
|
143
149
|
* no surrounding prose.
|
|
144
150
|
*
|
|
@@ -156,14 +162,16 @@ type JsonParserInput = string | Record<string, unknown> | unknown[];
|
|
|
156
162
|
type JsonParserOutput<S extends JSONSchema | undefined> = S extends JSONSchema ? FromSchema<S> : Record<string, any>;
|
|
157
163
|
declare class JsonParser<S extends JSONSchema | undefined = undefined> extends BaseParserWithJson<S, JsonParserOutput<S>, JsonParserInput> {
|
|
158
164
|
private shouldValidateSchema;
|
|
165
|
+
private match;
|
|
159
166
|
constructor(options?: JsonParserOptions<S>);
|
|
160
167
|
/**
|
|
161
168
|
* v3 parser contract:
|
|
162
169
|
* Category: strict
|
|
163
|
-
* Mode:
|
|
170
|
+
* Mode: exact
|
|
164
171
|
*
|
|
165
|
-
* Parses strict JSON object/array output
|
|
166
|
-
*
|
|
172
|
+
* Parses strict JSON object/array output by default. Pass match: "extract"
|
|
173
|
+
* to extract one JSON object or array from surrounding text. Invalid JSON,
|
|
174
|
+
* empty input, JSON primitives, and non-plain runtime objects throw typed parser errors.
|
|
167
175
|
* Schema validation is on by default when a schema is provided unless
|
|
168
176
|
* validateSchema: false is explicitly set.
|
|
169
177
|
*
|
|
@@ -314,7 +322,7 @@ declare class MarkdownCodeBlocksParser extends BaseParser<{
|
|
|
314
322
|
}[];
|
|
315
323
|
}
|
|
316
324
|
|
|
317
|
-
type StringExtractMatch = "
|
|
325
|
+
type StringExtractMatch = "exact" | "word" | "substring";
|
|
318
326
|
interface StringExtractParserOptions<E extends readonly string[] = readonly string[]> {
|
|
319
327
|
enum: E;
|
|
320
328
|
ignoreCase?: boolean;
|
|
@@ -331,14 +339,14 @@ declare class StringExtractParser<E extends readonly string[] = readonly string[
|
|
|
331
339
|
* Mode: configured value extraction
|
|
332
340
|
*
|
|
333
341
|
* Returns the single configured enum value found in input. Matching is
|
|
334
|
-
* word-bounded by default; pass match: "
|
|
342
|
+
* word-bounded by default; pass match: "exact" to require exact input or
|
|
335
343
|
* match: "substring" for legacy contains() behavior. Case-insensitive by
|
|
336
344
|
* default.
|
|
337
345
|
*
|
|
338
346
|
*/
|
|
339
347
|
parse(text: string, _attributes?: Record<string, any>): E[number];
|
|
340
348
|
private findMatches;
|
|
341
|
-
private
|
|
349
|
+
private matchExact;
|
|
342
350
|
private matchSubstring;
|
|
343
351
|
private matchWord;
|
|
344
352
|
}
|
|
@@ -350,16 +358,22 @@ declare class StringExtractParser<E extends readonly string[] = readonly string[
|
|
|
350
358
|
* (e.g. "Source has 1 element(s) but target requires 2" when stringExtract
|
|
351
359
|
* is called without options) instead of overload-resolution mystery.
|
|
352
360
|
*/
|
|
353
|
-
type CreateParserArgs = [type: "string", options?: never] | [type: "boolean", options?:
|
|
361
|
+
type CreateParserArgs = [type: "string", options?: never] | [type: "boolean", options?: BooleanParserOptions] | [type: "listToArray", options?: never] | [type: "markdownCodeBlock", options?: never] | [type: "markdownCodeBlocks", options?: never] | [type: "replaceStringTemplate", options?: never] | [type: "number", options?: NumberParserOptions] | [type: "listToKeyValue", options?: ListToKeyValueParserOptions] | [type: "json", options?: JsonParserOptions<JSONSchema | undefined>] | [
|
|
354
362
|
type: "listToJson",
|
|
355
363
|
options?: ListToJsonParserOptions<JSONSchema | undefined>
|
|
356
|
-
] | [
|
|
364
|
+
] | [
|
|
365
|
+
type: "stringExtract",
|
|
366
|
+
options: StringExtractParserOptions<readonly string[]>
|
|
367
|
+
];
|
|
357
368
|
/**
|
|
358
369
|
* Maps a concrete argument tuple back to the parser instance type, preserving
|
|
359
370
|
* schema inference for json/listToJson and enum literal narrowing for
|
|
360
371
|
* stringExtract.
|
|
361
372
|
*/
|
|
362
|
-
type CreateParserReturn<A extends readonly unknown[]> = A extends readonly ["string", ...unknown[]] ? StringParser : A extends readonly ["boolean", ...unknown[]] ? BooleanParser : A extends readonly ["number", ...unknown[]] ? NumberParser : A extends readonly ["listToArray", ...unknown[]] ? ListToArrayParser : A extends readonly ["listToKeyValue", ...unknown[]] ? ListToKeyValueParser : A extends readonly ["markdownCodeBlock", ...unknown[]] ? MarkdownCodeBlockParser : A extends readonly ["markdownCodeBlocks", ...unknown[]] ? MarkdownCodeBlocksParser : A extends readonly ["replaceStringTemplate", ...unknown[]] ? ReplaceStringTemplateParser : A extends readonly ["json"] | readonly ["json", undefined] ? JsonParser<undefined> : A extends readonly ["json", JsonParserOptions<infer S>] ? JsonParser<S> : A extends readonly ["listToJson"] | readonly ["listToJson", undefined] ? ListToJsonParser<undefined> : A extends readonly [
|
|
373
|
+
type CreateParserReturn<A extends readonly unknown[]> = A extends readonly ["string", ...unknown[]] ? StringParser : A extends readonly ["boolean", ...unknown[]] ? BooleanParser : A extends readonly ["number", ...unknown[]] ? NumberParser : A extends readonly ["listToArray", ...unknown[]] ? ListToArrayParser : A extends readonly ["listToKeyValue", ...unknown[]] ? ListToKeyValueParser : A extends readonly ["markdownCodeBlock", ...unknown[]] ? MarkdownCodeBlockParser : A extends readonly ["markdownCodeBlocks", ...unknown[]] ? MarkdownCodeBlocksParser : A extends readonly ["replaceStringTemplate", ...unknown[]] ? ReplaceStringTemplateParser : A extends readonly ["json"] | readonly ["json", undefined] ? JsonParser<undefined> : A extends readonly ["json", JsonParserOptions<infer S>] ? JsonParser<S> : A extends readonly ["listToJson"] | readonly ["listToJson", undefined] ? ListToJsonParser<undefined> : A extends readonly [
|
|
374
|
+
"listToJson",
|
|
375
|
+
ListToJsonParserOptions<infer S>
|
|
376
|
+
] ? ListToJsonParser<S> : A extends readonly [
|
|
363
377
|
"stringExtract",
|
|
364
378
|
StringExtractParserOptions<infer E extends readonly string[]>
|
|
365
379
|
] ? StringExtractParser<E> : never;
|
|
@@ -1057,11 +1071,15 @@ interface LlmExecutorWithFunctionsOptions<T extends GenericFunctionCall = "auto"
|
|
|
1057
1071
|
jsonSchema?: Record<string, any>;
|
|
1058
1072
|
}
|
|
1059
1073
|
|
|
1060
|
-
interface
|
|
1074
|
+
interface ParserSchemaOptions<S extends JSONSchema | undefined = undefined> {
|
|
1061
1075
|
schema?: S;
|
|
1062
1076
|
validateSchema?: boolean;
|
|
1063
1077
|
}
|
|
1064
|
-
|
|
1078
|
+
type JsonParserMatch = "exact" | "extract";
|
|
1079
|
+
interface JsonParserOptions<S extends JSONSchema | undefined = undefined> extends ParserSchemaOptions<S> {
|
|
1080
|
+
match?: JsonParserMatch;
|
|
1081
|
+
}
|
|
1082
|
+
interface ListToJsonParserOptions<S extends JSONSchema | undefined = undefined> extends ParserSchemaOptions<S> {
|
|
1065
1083
|
keyTransform?: "camelCase" | "preserve";
|
|
1066
1084
|
}
|
|
1067
1085
|
|
|
@@ -1124,6 +1142,7 @@ interface GenericEmbeddingOptions extends BaseLlmOptions {
|
|
|
1124
1142
|
interface OpenAiEmbeddingOptions extends GenericEmbeddingOptions {
|
|
1125
1143
|
model?: string;
|
|
1126
1144
|
openAiApiKey?: string;
|
|
1145
|
+
baseUrl?: string;
|
|
1127
1146
|
}
|
|
1128
1147
|
interface AmazonEmbeddingOptions extends GenericEmbeddingOptions {
|
|
1129
1148
|
model: string;
|
|
@@ -1265,6 +1284,9 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1265
1284
|
"openai.o4-mini": {
|
|
1266
1285
|
input: Omit<OpenAiRequest, "model">;
|
|
1267
1286
|
};
|
|
1287
|
+
"anthropic.claude-opus-4-8": {
|
|
1288
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1289
|
+
};
|
|
1268
1290
|
"anthropic.claude-opus-4-7": {
|
|
1269
1291
|
input: Omit<AnthropicRequest, "model">;
|
|
1270
1292
|
};
|
|
@@ -1531,7 +1553,7 @@ interface Config<Pk = LlmProviderKey> {
|
|
|
1531
1553
|
* Embedding configs do not use this — their flow dispatches via
|
|
1532
1554
|
* `getEmbeddingOutputParser` instead.
|
|
1533
1555
|
*/
|
|
1534
|
-
transformResponse?: (result: any, _config?: Config<any>) => OutputResult;
|
|
1556
|
+
transformResponse?: (result: any, _config?: Config<any>, headers?: Record<string, string>) => OutputResult;
|
|
1535
1557
|
/**
|
|
1536
1558
|
* Marks this config as deprecated. When set, useLlm() will emit a one-time
|
|
1537
1559
|
* deprecation warning to inform users about upcoming model shutdowns.
|
|
@@ -2000,6 +2022,7 @@ declare const configs: {
|
|
|
2000
2022
|
"anthropic.claude-opus-4-1": Config<any>;
|
|
2001
2023
|
"anthropic.claude-opus-4-6": Config<any>;
|
|
2002
2024
|
"anthropic.chat.v1": Config<keyof AllLlm>;
|
|
2025
|
+
"anthropic.claude-opus-4-8": Config<keyof AllLlm>;
|
|
2003
2026
|
"anthropic.claude-opus-4-7": Config<keyof AllLlm>;
|
|
2004
2027
|
"anthropic.claude-sonnet-4-6": Config<keyof AllLlm>;
|
|
2005
2028
|
"anthropic.claude-opus-4-5": Config<keyof AllLlm>;
|
|
@@ -2069,4 +2092,4 @@ declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, op
|
|
|
2069
2092
|
};
|
|
2070
2093
|
};
|
|
2071
2094
|
|
|
2072
|
-
export { BaseExecutor, type BaseLlm, BaseParser, BasePrompt, BaseStateItem, ChatPrompt, CustomParser, DefaultState, DefaultStateItem, type EmbeddingProviderKey, type ErrorCategory, type ErrorCodes, type ErrorContextByCode, type ExecutionContext, type ExecutorContext, type ExecutorExecutionMetadata, type HookErrorRecord, type IChatMessages, LLM_EXE_ERROR_SYMBOL, LlmExeError, LlmExecutorOpenAiFunctions, LlmExecutorWithFunctions, LlmNativeFunctionParser, type LlmProvider, type LlmProviderKey, type NormalizedProviderError, type OpenAIModelName, OpenAiFunctionParser, type ProviderErrorContext, TextPrompt, type UseLlmKey, createCallableExecutor, createChatPrompt, createCoreExecutor, createCustomParser, createDialogue, createEmbedding, createLlmExecutor, createLlmFunctionExecutor, createOpenAiCompatibleConfiguration, createParser, createPrompt, createState, createStateItem, defineSchema, guards, isLlmExeError, registerHelpers, registerPartials, useExecutors, useLlm, useLlmConfiguration, index as utils };
|
|
2095
|
+
export { BaseExecutor, type BaseLlm, BaseParser, BasePrompt, BaseStateItem, type BooleanParserMatch, type BooleanParserOptions, ChatPrompt, CustomParser, DefaultState, DefaultStateItem, type EmbeddingProviderKey, type ErrorCategory, type ErrorCodes, type ErrorContextByCode, type ExecutionContext, type ExecutorContext, type ExecutorExecutionMetadata, type HookErrorRecord, type IChatMessages, type JsonParserMatch, type JsonParserOptions, LLM_EXE_ERROR_SYMBOL, LlmExeError, LlmExecutorOpenAiFunctions, LlmExecutorWithFunctions, LlmNativeFunctionParser, type LlmProvider, type LlmProviderKey, type NormalizedProviderError, type NumberParserMatch, type NumberParserOptions, type OpenAIModelName, OpenAiFunctionParser, type ProviderErrorContext, type StringExtractMatch, type StringExtractParserOptions, TextPrompt, type UseLlmKey, createCallableExecutor, createChatPrompt, createCoreExecutor, createCustomParser, createDialogue, createEmbedding, createLlmExecutor, createLlmFunctionExecutor, createOpenAiCompatibleConfiguration, createParser, createPrompt, createState, createStateItem, defineSchema, guards, isLlmExeError, registerHelpers, registerPartials, useExecutors, useLlm, useLlmConfiguration, index as utils };
|
package/dist/index.d.ts
CHANGED
|
@@ -92,7 +92,7 @@ declare abstract class BaseParser<T = any, TInput = string> {
|
|
|
92
92
|
declare abstract class BaseParserWithJson<S extends JSONSchema | undefined = undefined, T = S extends JSONSchema ? FromSchema<S> : Record<string, any>, TInput = string> extends BaseParser<T, TInput> {
|
|
93
93
|
schema: S;
|
|
94
94
|
validateSchema: boolean;
|
|
95
|
-
constructor(name: string, options:
|
|
95
|
+
constructor(name: string, options: ParserSchemaOptions<S>);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
/**
|
|
@@ -111,25 +111,31 @@ declare class StringParser extends BaseParser<string> {
|
|
|
111
111
|
parse(text: string, _attributes?: Record<string, any>): string;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
type BooleanParserMatch = "exact" | "extract";
|
|
115
|
+
interface BooleanParserOptions {
|
|
116
|
+
match?: BooleanParserMatch;
|
|
117
|
+
}
|
|
114
118
|
/**
|
|
115
119
|
* v3 parser contract:
|
|
116
120
|
* Category: strict
|
|
117
|
-
* Mode:
|
|
121
|
+
* Mode: exact
|
|
118
122
|
*
|
|
119
123
|
* Accepts only documented boolean literals after trim/lowercase.
|
|
120
|
-
* Returns true/false only when input is recognized.
|
|
121
|
-
*
|
|
122
|
-
*
|
|
124
|
+
* Returns true/false only when input is recognized. Pass match: "extract" to
|
|
125
|
+
* extract one documented boolean literal from surrounding text.
|
|
126
|
+
* Throws LlmExeError(parser.parse_failed) for empty or unrecognized input.
|
|
127
|
+
* Invalid input types throw LlmExeError(parser.invalid_input).
|
|
123
128
|
* Error context does not include input content unless LLM_EXE_DEBUG is enabled.
|
|
124
129
|
*
|
|
125
130
|
*/
|
|
126
131
|
declare class BooleanParser extends BaseParser<boolean> {
|
|
127
|
-
|
|
132
|
+
private match;
|
|
133
|
+
constructor(options?: BooleanParserOptions);
|
|
128
134
|
private getInputErrorContext;
|
|
129
135
|
parse(text: string, _attributes?: Record<string, any>): boolean;
|
|
130
136
|
}
|
|
131
137
|
|
|
132
|
-
type NumberParserMatch = "
|
|
138
|
+
type NumberParserMatch = "exact" | "extract";
|
|
133
139
|
interface NumberParserOptions {
|
|
134
140
|
match?: NumberParserMatch;
|
|
135
141
|
}
|
|
@@ -138,7 +144,7 @@ interface NumberParserOptions {
|
|
|
138
144
|
* Category: extractor
|
|
139
145
|
* Mode: numeric token extraction
|
|
140
146
|
*
|
|
141
|
-
* Extracts one documented numeric token from text. Pass match: "
|
|
147
|
+
* Extracts one documented numeric token from text. Pass match: "exact" to
|
|
142
148
|
* require the input to consist of exactly one numeric token (after trim) with
|
|
143
149
|
* no surrounding prose.
|
|
144
150
|
*
|
|
@@ -156,14 +162,16 @@ type JsonParserInput = string | Record<string, unknown> | unknown[];
|
|
|
156
162
|
type JsonParserOutput<S extends JSONSchema | undefined> = S extends JSONSchema ? FromSchema<S> : Record<string, any>;
|
|
157
163
|
declare class JsonParser<S extends JSONSchema | undefined = undefined> extends BaseParserWithJson<S, JsonParserOutput<S>, JsonParserInput> {
|
|
158
164
|
private shouldValidateSchema;
|
|
165
|
+
private match;
|
|
159
166
|
constructor(options?: JsonParserOptions<S>);
|
|
160
167
|
/**
|
|
161
168
|
* v3 parser contract:
|
|
162
169
|
* Category: strict
|
|
163
|
-
* Mode:
|
|
170
|
+
* Mode: exact
|
|
164
171
|
*
|
|
165
|
-
* Parses strict JSON object/array output
|
|
166
|
-
*
|
|
172
|
+
* Parses strict JSON object/array output by default. Pass match: "extract"
|
|
173
|
+
* to extract one JSON object or array from surrounding text. Invalid JSON,
|
|
174
|
+
* empty input, JSON primitives, and non-plain runtime objects throw typed parser errors.
|
|
167
175
|
* Schema validation is on by default when a schema is provided unless
|
|
168
176
|
* validateSchema: false is explicitly set.
|
|
169
177
|
*
|
|
@@ -314,7 +322,7 @@ declare class MarkdownCodeBlocksParser extends BaseParser<{
|
|
|
314
322
|
}[];
|
|
315
323
|
}
|
|
316
324
|
|
|
317
|
-
type StringExtractMatch = "
|
|
325
|
+
type StringExtractMatch = "exact" | "word" | "substring";
|
|
318
326
|
interface StringExtractParserOptions<E extends readonly string[] = readonly string[]> {
|
|
319
327
|
enum: E;
|
|
320
328
|
ignoreCase?: boolean;
|
|
@@ -331,14 +339,14 @@ declare class StringExtractParser<E extends readonly string[] = readonly string[
|
|
|
331
339
|
* Mode: configured value extraction
|
|
332
340
|
*
|
|
333
341
|
* Returns the single configured enum value found in input. Matching is
|
|
334
|
-
* word-bounded by default; pass match: "
|
|
342
|
+
* word-bounded by default; pass match: "exact" to require exact input or
|
|
335
343
|
* match: "substring" for legacy contains() behavior. Case-insensitive by
|
|
336
344
|
* default.
|
|
337
345
|
*
|
|
338
346
|
*/
|
|
339
347
|
parse(text: string, _attributes?: Record<string, any>): E[number];
|
|
340
348
|
private findMatches;
|
|
341
|
-
private
|
|
349
|
+
private matchExact;
|
|
342
350
|
private matchSubstring;
|
|
343
351
|
private matchWord;
|
|
344
352
|
}
|
|
@@ -350,16 +358,22 @@ declare class StringExtractParser<E extends readonly string[] = readonly string[
|
|
|
350
358
|
* (e.g. "Source has 1 element(s) but target requires 2" when stringExtract
|
|
351
359
|
* is called without options) instead of overload-resolution mystery.
|
|
352
360
|
*/
|
|
353
|
-
type CreateParserArgs = [type: "string", options?: never] | [type: "boolean", options?:
|
|
361
|
+
type CreateParserArgs = [type: "string", options?: never] | [type: "boolean", options?: BooleanParserOptions] | [type: "listToArray", options?: never] | [type: "markdownCodeBlock", options?: never] | [type: "markdownCodeBlocks", options?: never] | [type: "replaceStringTemplate", options?: never] | [type: "number", options?: NumberParserOptions] | [type: "listToKeyValue", options?: ListToKeyValueParserOptions] | [type: "json", options?: JsonParserOptions<JSONSchema | undefined>] | [
|
|
354
362
|
type: "listToJson",
|
|
355
363
|
options?: ListToJsonParserOptions<JSONSchema | undefined>
|
|
356
|
-
] | [
|
|
364
|
+
] | [
|
|
365
|
+
type: "stringExtract",
|
|
366
|
+
options: StringExtractParserOptions<readonly string[]>
|
|
367
|
+
];
|
|
357
368
|
/**
|
|
358
369
|
* Maps a concrete argument tuple back to the parser instance type, preserving
|
|
359
370
|
* schema inference for json/listToJson and enum literal narrowing for
|
|
360
371
|
* stringExtract.
|
|
361
372
|
*/
|
|
362
|
-
type CreateParserReturn<A extends readonly unknown[]> = A extends readonly ["string", ...unknown[]] ? StringParser : A extends readonly ["boolean", ...unknown[]] ? BooleanParser : A extends readonly ["number", ...unknown[]] ? NumberParser : A extends readonly ["listToArray", ...unknown[]] ? ListToArrayParser : A extends readonly ["listToKeyValue", ...unknown[]] ? ListToKeyValueParser : A extends readonly ["markdownCodeBlock", ...unknown[]] ? MarkdownCodeBlockParser : A extends readonly ["markdownCodeBlocks", ...unknown[]] ? MarkdownCodeBlocksParser : A extends readonly ["replaceStringTemplate", ...unknown[]] ? ReplaceStringTemplateParser : A extends readonly ["json"] | readonly ["json", undefined] ? JsonParser<undefined> : A extends readonly ["json", JsonParserOptions<infer S>] ? JsonParser<S> : A extends readonly ["listToJson"] | readonly ["listToJson", undefined] ? ListToJsonParser<undefined> : A extends readonly [
|
|
373
|
+
type CreateParserReturn<A extends readonly unknown[]> = A extends readonly ["string", ...unknown[]] ? StringParser : A extends readonly ["boolean", ...unknown[]] ? BooleanParser : A extends readonly ["number", ...unknown[]] ? NumberParser : A extends readonly ["listToArray", ...unknown[]] ? ListToArrayParser : A extends readonly ["listToKeyValue", ...unknown[]] ? ListToKeyValueParser : A extends readonly ["markdownCodeBlock", ...unknown[]] ? MarkdownCodeBlockParser : A extends readonly ["markdownCodeBlocks", ...unknown[]] ? MarkdownCodeBlocksParser : A extends readonly ["replaceStringTemplate", ...unknown[]] ? ReplaceStringTemplateParser : A extends readonly ["json"] | readonly ["json", undefined] ? JsonParser<undefined> : A extends readonly ["json", JsonParserOptions<infer S>] ? JsonParser<S> : A extends readonly ["listToJson"] | readonly ["listToJson", undefined] ? ListToJsonParser<undefined> : A extends readonly [
|
|
374
|
+
"listToJson",
|
|
375
|
+
ListToJsonParserOptions<infer S>
|
|
376
|
+
] ? ListToJsonParser<S> : A extends readonly [
|
|
363
377
|
"stringExtract",
|
|
364
378
|
StringExtractParserOptions<infer E extends readonly string[]>
|
|
365
379
|
] ? StringExtractParser<E> : never;
|
|
@@ -1057,11 +1071,15 @@ interface LlmExecutorWithFunctionsOptions<T extends GenericFunctionCall = "auto"
|
|
|
1057
1071
|
jsonSchema?: Record<string, any>;
|
|
1058
1072
|
}
|
|
1059
1073
|
|
|
1060
|
-
interface
|
|
1074
|
+
interface ParserSchemaOptions<S extends JSONSchema | undefined = undefined> {
|
|
1061
1075
|
schema?: S;
|
|
1062
1076
|
validateSchema?: boolean;
|
|
1063
1077
|
}
|
|
1064
|
-
|
|
1078
|
+
type JsonParserMatch = "exact" | "extract";
|
|
1079
|
+
interface JsonParserOptions<S extends JSONSchema | undefined = undefined> extends ParserSchemaOptions<S> {
|
|
1080
|
+
match?: JsonParserMatch;
|
|
1081
|
+
}
|
|
1082
|
+
interface ListToJsonParserOptions<S extends JSONSchema | undefined = undefined> extends ParserSchemaOptions<S> {
|
|
1065
1083
|
keyTransform?: "camelCase" | "preserve";
|
|
1066
1084
|
}
|
|
1067
1085
|
|
|
@@ -1124,6 +1142,7 @@ interface GenericEmbeddingOptions extends BaseLlmOptions {
|
|
|
1124
1142
|
interface OpenAiEmbeddingOptions extends GenericEmbeddingOptions {
|
|
1125
1143
|
model?: string;
|
|
1126
1144
|
openAiApiKey?: string;
|
|
1145
|
+
baseUrl?: string;
|
|
1127
1146
|
}
|
|
1128
1147
|
interface AmazonEmbeddingOptions extends GenericEmbeddingOptions {
|
|
1129
1148
|
model: string;
|
|
@@ -1265,6 +1284,9 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1265
1284
|
"openai.o4-mini": {
|
|
1266
1285
|
input: Omit<OpenAiRequest, "model">;
|
|
1267
1286
|
};
|
|
1287
|
+
"anthropic.claude-opus-4-8": {
|
|
1288
|
+
input: Omit<AnthropicRequest, "model">;
|
|
1289
|
+
};
|
|
1268
1290
|
"anthropic.claude-opus-4-7": {
|
|
1269
1291
|
input: Omit<AnthropicRequest, "model">;
|
|
1270
1292
|
};
|
|
@@ -1531,7 +1553,7 @@ interface Config<Pk = LlmProviderKey> {
|
|
|
1531
1553
|
* Embedding configs do not use this — their flow dispatches via
|
|
1532
1554
|
* `getEmbeddingOutputParser` instead.
|
|
1533
1555
|
*/
|
|
1534
|
-
transformResponse?: (result: any, _config?: Config<any>) => OutputResult;
|
|
1556
|
+
transformResponse?: (result: any, _config?: Config<any>, headers?: Record<string, string>) => OutputResult;
|
|
1535
1557
|
/**
|
|
1536
1558
|
* Marks this config as deprecated. When set, useLlm() will emit a one-time
|
|
1537
1559
|
* deprecation warning to inform users about upcoming model shutdowns.
|
|
@@ -2000,6 +2022,7 @@ declare const configs: {
|
|
|
2000
2022
|
"anthropic.claude-opus-4-1": Config<any>;
|
|
2001
2023
|
"anthropic.claude-opus-4-6": Config<any>;
|
|
2002
2024
|
"anthropic.chat.v1": Config<keyof AllLlm>;
|
|
2025
|
+
"anthropic.claude-opus-4-8": Config<keyof AllLlm>;
|
|
2003
2026
|
"anthropic.claude-opus-4-7": Config<keyof AllLlm>;
|
|
2004
2027
|
"anthropic.claude-sonnet-4-6": Config<keyof AllLlm>;
|
|
2005
2028
|
"anthropic.claude-opus-4-5": Config<keyof AllLlm>;
|
|
@@ -2069,4 +2092,4 @@ declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, op
|
|
|
2069
2092
|
};
|
|
2070
2093
|
};
|
|
2071
2094
|
|
|
2072
|
-
export { BaseExecutor, type BaseLlm, BaseParser, BasePrompt, BaseStateItem, ChatPrompt, CustomParser, DefaultState, DefaultStateItem, type EmbeddingProviderKey, type ErrorCategory, type ErrorCodes, type ErrorContextByCode, type ExecutionContext, type ExecutorContext, type ExecutorExecutionMetadata, type HookErrorRecord, type IChatMessages, LLM_EXE_ERROR_SYMBOL, LlmExeError, LlmExecutorOpenAiFunctions, LlmExecutorWithFunctions, LlmNativeFunctionParser, type LlmProvider, type LlmProviderKey, type NormalizedProviderError, type OpenAIModelName, OpenAiFunctionParser, type ProviderErrorContext, TextPrompt, type UseLlmKey, createCallableExecutor, createChatPrompt, createCoreExecutor, createCustomParser, createDialogue, createEmbedding, createLlmExecutor, createLlmFunctionExecutor, createOpenAiCompatibleConfiguration, createParser, createPrompt, createState, createStateItem, defineSchema, guards, isLlmExeError, registerHelpers, registerPartials, useExecutors, useLlm, useLlmConfiguration, index as utils };
|
|
2095
|
+
export { BaseExecutor, type BaseLlm, BaseParser, BasePrompt, BaseStateItem, type BooleanParserMatch, type BooleanParserOptions, ChatPrompt, CustomParser, DefaultState, DefaultStateItem, type EmbeddingProviderKey, type ErrorCategory, type ErrorCodes, type ErrorContextByCode, type ExecutionContext, type ExecutorContext, type ExecutorExecutionMetadata, type HookErrorRecord, type IChatMessages, type JsonParserMatch, type JsonParserOptions, LLM_EXE_ERROR_SYMBOL, LlmExeError, LlmExecutorOpenAiFunctions, LlmExecutorWithFunctions, LlmNativeFunctionParser, type LlmProvider, type LlmProviderKey, type NormalizedProviderError, type NumberParserMatch, type NumberParserOptions, type OpenAIModelName, OpenAiFunctionParser, type ProviderErrorContext, type StringExtractMatch, type StringExtractParserOptions, TextPrompt, type UseLlmKey, createCallableExecutor, createChatPrompt, createCoreExecutor, createCustomParser, createDialogue, createEmbedding, createLlmExecutor, createLlmFunctionExecutor, createOpenAiCompatibleConfiguration, createParser, createPrompt, createState, createStateItem, defineSchema, guards, isLlmExeError, registerHelpers, registerPartials, useExecutors, useLlm, useLlmConfiguration, index as utils };
|