llm-exe 2.3.10 → 3.0.0-beta.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 +578 -185
- package/dist/index.d.ts +578 -185
- package/dist/index.js +3027 -863
- package/dist/index.mjs +3024 -863
- package/package.json +3 -4
- package/readme.md +2 -0
package/dist/index.d.mts
CHANGED
|
@@ -68,20 +68,18 @@ type OpenAIConversationModelName = "davinci" | "text-curie-001" | "text-babbage-
|
|
|
68
68
|
type OpenAIEmbeddingModelName = "text-embedding-ada-002";
|
|
69
69
|
type OpenAIModelName = OpenAIChatModelName | OpenAIConversationModelName | OpenAIEmbeddingModelName;
|
|
70
70
|
|
|
71
|
-
type ParserInput = string | OutputResult;
|
|
72
71
|
/**
|
|
73
72
|
* BaseParser is an abstract class for parsing text and enforcing JSON schema on the parsed data.
|
|
74
73
|
*/
|
|
75
|
-
declare abstract class BaseParser<T = any> {
|
|
74
|
+
declare abstract class BaseParser<T = any, TInput = string> {
|
|
76
75
|
name: string;
|
|
77
|
-
options: BaseParserOptions;
|
|
78
76
|
target: "text" | "function_call";
|
|
79
77
|
/**
|
|
80
78
|
* Create a new BaseParser.
|
|
81
79
|
* @param name - The name of the parser.
|
|
82
|
-
* @param
|
|
80
|
+
* @param target - Whether the parser consumes text or function-call output.
|
|
83
81
|
*/
|
|
84
|
-
constructor(name: string,
|
|
82
|
+
constructor(name: string, target?: "text" | "function_call");
|
|
85
83
|
/**
|
|
86
84
|
* Parse the given text and return the parsed data.
|
|
87
85
|
* @abstract
|
|
@@ -89,59 +87,128 @@ declare abstract class BaseParser<T = any> {
|
|
|
89
87
|
* @param [attributes] - Optional attributes to use during parsing.
|
|
90
88
|
* @returns The parsed data.
|
|
91
89
|
*/
|
|
92
|
-
abstract parse(text:
|
|
90
|
+
abstract parse(text: TInput, attributes?: Record<string, any>): T;
|
|
93
91
|
}
|
|
94
|
-
declare abstract class BaseParserWithJson<S extends JSONSchema | undefined = undefined, T = S extends JSONSchema ? FromSchema<S> : Record<string, any
|
|
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> {
|
|
95
93
|
schema: S;
|
|
96
94
|
validateSchema: boolean;
|
|
97
|
-
|
|
98
|
-
* Create a new BaseParser.
|
|
99
|
-
* @param name - The name of the parser.
|
|
100
|
-
* @param options - options
|
|
101
|
-
*/
|
|
102
|
-
constructor(name: string, options: BaseParserOptionsWithSchema<S>);
|
|
95
|
+
constructor(name: string, options: JsonParserOptions<S>);
|
|
103
96
|
}
|
|
104
97
|
|
|
105
|
-
|
|
106
|
-
|
|
98
|
+
/**
|
|
99
|
+
* v3 parser contract:
|
|
100
|
+
* Category: pass-through
|
|
101
|
+
* Mode: string pass-through
|
|
102
|
+
*
|
|
103
|
+
* Accepts any string and returns it exactly.
|
|
104
|
+
* Throws LlmExeError(parser.parse_failed) for non-string input.
|
|
105
|
+
* Executor output normalization owns OutputResult handling before parser
|
|
106
|
+
* invocation.
|
|
107
|
+
*
|
|
108
|
+
*/
|
|
107
109
|
declare class StringParser extends BaseParser<string> {
|
|
108
|
-
constructor(
|
|
109
|
-
parse(text: string
|
|
110
|
+
constructor();
|
|
111
|
+
parse(text: string, _attributes?: Record<string, any>): string;
|
|
110
112
|
}
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
/**
|
|
115
|
+
* v3 parser contract:
|
|
116
|
+
* Category: strict
|
|
117
|
+
* Mode: whole-output
|
|
118
|
+
*
|
|
119
|
+
* Accepts only documented boolean literals after trim/lowercase.
|
|
120
|
+
* Returns true/false only when input is recognized.
|
|
121
|
+
* Throws LlmExeError(parser.parse_failed) for empty, invalid-type, or
|
|
122
|
+
* unrecognized input. Does not extract booleans from prose.
|
|
123
|
+
* Error context does not include input content unless LLM_EXE_DEBUG is enabled.
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
114
126
|
declare class BooleanParser extends BaseParser<boolean> {
|
|
115
|
-
constructor(
|
|
116
|
-
|
|
127
|
+
constructor();
|
|
128
|
+
private getInputErrorContext;
|
|
129
|
+
parse(text: string, _attributes?: Record<string, any>): boolean;
|
|
117
130
|
}
|
|
118
131
|
|
|
119
|
-
|
|
132
|
+
type NumberParserMatch = "extract" | "whole";
|
|
133
|
+
interface NumberParserOptions {
|
|
134
|
+
match?: NumberParserMatch;
|
|
120
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* v3 parser contract:
|
|
138
|
+
* Category: extractor
|
|
139
|
+
* Mode: numeric token extraction
|
|
140
|
+
*
|
|
141
|
+
* Extracts one documented numeric token from text. Pass match: "whole" to
|
|
142
|
+
* require the input to consist of exactly one numeric token (after trim) with
|
|
143
|
+
* no surrounding prose.
|
|
144
|
+
*
|
|
145
|
+
* Throws LlmExeError(parser.parse_failed) for empty input, no numeric token,
|
|
146
|
+
* multiple numeric tokens, invalid conversion. Invalid input type throws
|
|
147
|
+
* LlmExeError(parser.invalid_input).
|
|
148
|
+
*/
|
|
121
149
|
declare class NumberParser extends BaseParser<number> {
|
|
150
|
+
private match;
|
|
122
151
|
constructor(options?: NumberParserOptions);
|
|
123
|
-
parse(text: string): number;
|
|
152
|
+
parse(text: string, _attributes?: Record<string, any>): number;
|
|
124
153
|
}
|
|
125
154
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
155
|
+
type JsonParserInput = string | Record<string, unknown> | unknown[];
|
|
156
|
+
type JsonParserOutput<S extends JSONSchema | undefined> = S extends JSONSchema ? FromSchema<S> : Record<string, any>;
|
|
157
|
+
declare class JsonParser<S extends JSONSchema | undefined = undefined> extends BaseParserWithJson<S, JsonParserOutput<S>, JsonParserInput> {
|
|
158
|
+
private shouldValidateSchema;
|
|
159
|
+
constructor(options?: JsonParserOptions<S>);
|
|
160
|
+
/**
|
|
161
|
+
* v3 parser contract:
|
|
162
|
+
* Category: strict
|
|
163
|
+
* Mode: whole-output
|
|
164
|
+
*
|
|
165
|
+
* Parses strict JSON object/array output only. Invalid JSON, empty input,
|
|
166
|
+
* JSON primitives, and non-plain runtime objects throw typed parser errors.
|
|
167
|
+
* Schema validation is on by default when a schema is provided unless
|
|
168
|
+
* validateSchema: false is explicitly set.
|
|
169
|
+
*
|
|
170
|
+
*/
|
|
171
|
+
parse(text: JsonParserInput, _attributes?: Record<string, any>): JsonParserOutput<S>;
|
|
129
172
|
}
|
|
130
173
|
|
|
131
174
|
declare class ListToJsonParser<S extends JSONSchema | undefined = undefined> extends BaseParserWithJson<S> {
|
|
132
175
|
private keyTransform;
|
|
176
|
+
private shouldValidateSchema;
|
|
133
177
|
constructor(options?: ListToJsonParserOptions<S>);
|
|
178
|
+
/**
|
|
179
|
+
* v3 parser contract:
|
|
180
|
+
* Category: converter
|
|
181
|
+
* Mode: line-oriented format conversion
|
|
182
|
+
*
|
|
183
|
+
* Uses the shared list boundary. Parses normalized lines as key/value pairs
|
|
184
|
+
* split at the first colon. Duplicate keys throw because object output would
|
|
185
|
+
* overwrite data.
|
|
186
|
+
*
|
|
187
|
+
*/
|
|
134
188
|
parse(text: string): ParserOutput<BaseParserWithJson<S>>;
|
|
135
189
|
}
|
|
136
190
|
|
|
137
|
-
interface ListToKeyValueParserOptions
|
|
191
|
+
interface ListToKeyValueParserOptions {
|
|
192
|
+
keyTransform?: "preserve" | "camelCase";
|
|
138
193
|
}
|
|
139
194
|
declare class ListToKeyValueParser extends BaseParser<Array<{
|
|
140
195
|
key: string;
|
|
141
196
|
value: string;
|
|
142
197
|
}>> {
|
|
198
|
+
private keyTransform;
|
|
143
199
|
constructor(options?: ListToKeyValueParserOptions);
|
|
144
|
-
|
|
200
|
+
/**
|
|
201
|
+
* v3 parser contract:
|
|
202
|
+
* Category: converter
|
|
203
|
+
* Mode: line-oriented collector
|
|
204
|
+
*
|
|
205
|
+
* Uses the shared list boundary. Parses normalized lines as key/value pairs
|
|
206
|
+
* split at the first colon. Preserves duplicate keys because output is an
|
|
207
|
+
* ordered array. Keys are returned as written by default; pass
|
|
208
|
+
* keyTransform: "camelCase" to match listToJson's key normalization.
|
|
209
|
+
*
|
|
210
|
+
*/
|
|
211
|
+
parse(text: string, _attributes?: Record<string, any>): {
|
|
145
212
|
key: string;
|
|
146
213
|
value: string;
|
|
147
214
|
}[];
|
|
@@ -149,180 +216,171 @@ declare class ListToKeyValueParser extends BaseParser<Array<{
|
|
|
149
216
|
|
|
150
217
|
/**
|
|
151
218
|
* CustomParser class, extending the BaseParser class.
|
|
152
|
-
* @template I The expected type of the input
|
|
153
219
|
* @template O The type of the parsed value (output)
|
|
154
|
-
* @extends {BaseParser<
|
|
220
|
+
* @extends {BaseParser<O>}
|
|
221
|
+
*
|
|
222
|
+
* v3 parser contract:
|
|
223
|
+
* Category: pass-through extension point
|
|
224
|
+
* Mode: user-defined
|
|
225
|
+
*
|
|
226
|
+
* Calls the user parser function with text and the per-call ExecutionContext.
|
|
227
|
+
* Returns the user parser result exactly.
|
|
228
|
+
* Does not wrap user parser errors.
|
|
229
|
+
*
|
|
230
|
+
* When invoked through an executor, `context` includes the resolved trace ID,
|
|
231
|
+
* stable executor metadata, current execution metadata, and the attributes
|
|
232
|
+
* extension bag. When parse() is called directly without a context, callers
|
|
233
|
+
* may pass any shape they want; the type widens to allow that.
|
|
155
234
|
*/
|
|
156
235
|
declare class CustomParser<O = any> extends BaseParser<O> {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
*/
|
|
161
|
-
parserFn: (text: string, inputValues: ExecutorContext<any, any>) => O;
|
|
162
|
-
/**
|
|
163
|
-
* Creates a new CustomParser instance.
|
|
164
|
-
* @param {string} name The name of the parser.
|
|
165
|
-
* @param {any} parserFn The custom parsing function.
|
|
166
|
-
*/
|
|
167
|
-
constructor(name: string, parserFn: (text: string, inputValues: ExecutorContext<any, any>) => O);
|
|
168
|
-
/**
|
|
169
|
-
* Parses the text using the custom parsing function.
|
|
170
|
-
* @param {string} text The text to be parsed.
|
|
171
|
-
* @param {any} inputValues Additional input values for the parser function.
|
|
172
|
-
* @returns {O} The parsed value.
|
|
173
|
-
*/
|
|
174
|
-
parse(text: string, inputValues: ExecutorContext<any, O>): O;
|
|
236
|
+
parserFn: (text: string, context: ExecutionContext<any, O>) => O;
|
|
237
|
+
constructor(name: string, parserFn: (text: string, context: ExecutionContext<any, O>) => O);
|
|
238
|
+
parse(text: string, context?: ExecutionContext<any, O>): O;
|
|
175
239
|
}
|
|
176
240
|
|
|
241
|
+
/**
|
|
242
|
+
* v3 parser contract:
|
|
243
|
+
* Category: converter
|
|
244
|
+
* Mode: line-oriented collection conversion
|
|
245
|
+
*
|
|
246
|
+
* Uses the shared list boundary. Returns normalized item text exactly.
|
|
247
|
+
* Throws for empty input, invalid input type, mixed marked/unmarked lines, or
|
|
248
|
+
* a single unmarked prose line.
|
|
249
|
+
*
|
|
250
|
+
*/
|
|
177
251
|
declare class ListToArrayParser extends BaseParser<string[]> {
|
|
178
252
|
constructor();
|
|
179
|
-
parse(text: string): string[];
|
|
253
|
+
parse(text: string, _attributes?: Record<string, any>): string[];
|
|
180
254
|
}
|
|
181
255
|
|
|
182
|
-
|
|
183
|
-
|
|
256
|
+
/**
|
|
257
|
+
* v3 parser contract:
|
|
258
|
+
* Category: pass-through transformation
|
|
259
|
+
* Mode: template replacement
|
|
260
|
+
*
|
|
261
|
+
* Accepts a string template and optional attributes object.
|
|
262
|
+
* Returns the helper replacement result.
|
|
263
|
+
* Throws LlmExeError(parser.parse_failed) for invalid input type,
|
|
264
|
+
* invalid attributes, or template helper failures.
|
|
265
|
+
*
|
|
266
|
+
*/
|
|
184
267
|
declare class ReplaceStringTemplateParser extends BaseParser<string> {
|
|
185
|
-
constructor(
|
|
268
|
+
constructor();
|
|
186
269
|
parse(text: string, attributes?: Record<string, any>): string;
|
|
187
270
|
}
|
|
188
271
|
|
|
189
|
-
|
|
190
|
-
|
|
272
|
+
/**
|
|
273
|
+
* v3 parser contract:
|
|
274
|
+
* Category: strict
|
|
275
|
+
* Mode: singular fenced block
|
|
276
|
+
*
|
|
277
|
+
* Accepts input containing exactly one complete fenced markdown code block.
|
|
278
|
+
* Returns that block with exact code content and language string.
|
|
279
|
+
* Throws LlmExeError(parser.parse_failed) for empty input, no block, multiple
|
|
280
|
+
* blocks, malformed fences, or invalid input type.
|
|
281
|
+
*
|
|
282
|
+
*/
|
|
191
283
|
declare class MarkdownCodeBlockParser extends BaseParser<{
|
|
192
284
|
language: string;
|
|
193
285
|
code: string;
|
|
194
286
|
}> {
|
|
195
|
-
constructor(
|
|
196
|
-
parse(input: string): {
|
|
287
|
+
constructor();
|
|
288
|
+
parse(input: string, _attributes?: Record<string, any>): {
|
|
197
289
|
code: string;
|
|
198
290
|
language: string;
|
|
199
291
|
};
|
|
200
292
|
}
|
|
201
293
|
|
|
202
|
-
|
|
203
|
-
|
|
294
|
+
/**
|
|
295
|
+
* v3 parser contract:
|
|
296
|
+
* Category: collector
|
|
297
|
+
* Mode: markdown fenced block collection
|
|
298
|
+
*
|
|
299
|
+
* Accepts text containing zero or more complete fenced code blocks.
|
|
300
|
+
* Returns all complete blocks in source order.
|
|
301
|
+
* Returns [] when no complete block exists.
|
|
302
|
+
* Throws LlmExeError(parser.parse_failed) for invalid input type or malformed
|
|
303
|
+
* fence structure. Does not unwrap stringified JSON.
|
|
304
|
+
*
|
|
305
|
+
*/
|
|
204
306
|
declare class MarkdownCodeBlocksParser extends BaseParser<{
|
|
205
307
|
language: string;
|
|
206
308
|
code: string;
|
|
207
309
|
}[]> {
|
|
208
|
-
constructor(
|
|
209
|
-
parse(input: string): {
|
|
310
|
+
constructor();
|
|
311
|
+
parse(input: string, _attributes?: Record<string, any>): {
|
|
210
312
|
code: string;
|
|
211
313
|
language: string;
|
|
212
314
|
}[];
|
|
213
315
|
}
|
|
214
316
|
|
|
215
|
-
|
|
216
|
-
|
|
317
|
+
type StringExtractMatch = "word" | "whole" | "substring";
|
|
318
|
+
interface StringExtractParserOptions<E extends readonly string[] = readonly string[]> {
|
|
319
|
+
enum: E;
|
|
217
320
|
ignoreCase?: boolean;
|
|
321
|
+
match?: StringExtractMatch;
|
|
218
322
|
}
|
|
219
|
-
declare class StringExtractParser extends BaseParser<
|
|
323
|
+
declare class StringExtractParser<E extends readonly string[] = readonly string[]> extends BaseParser<E[number]> {
|
|
220
324
|
private enum;
|
|
221
325
|
private ignoreCase;
|
|
222
|
-
|
|
223
|
-
|
|
326
|
+
private match;
|
|
327
|
+
constructor(options?: StringExtractParserOptions<E>);
|
|
328
|
+
/**
|
|
329
|
+
* v3 parser contract:
|
|
330
|
+
* Category: extractor
|
|
331
|
+
* Mode: configured value extraction
|
|
332
|
+
*
|
|
333
|
+
* Returns the single configured enum value found in input. Matching is
|
|
334
|
+
* word-bounded by default; pass match: "whole" to require exact input or
|
|
335
|
+
* match: "substring" for legacy contains() behavior. Case-insensitive by
|
|
336
|
+
* default.
|
|
337
|
+
*
|
|
338
|
+
*/
|
|
339
|
+
parse(text: string, _attributes?: Record<string, any>): E[number];
|
|
340
|
+
private findMatches;
|
|
341
|
+
private matchWhole;
|
|
342
|
+
private matchSubstring;
|
|
343
|
+
private matchWord;
|
|
224
344
|
}
|
|
225
345
|
|
|
226
346
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
|
|
232
|
-
declare function createParser<T extends Extract<CreateParserType, "markdownCodeBlocks">>(type: T, options?: BaseParserOptions): MarkdownCodeBlocksParser;
|
|
233
|
-
/**
|
|
234
|
-
* Creates a parser based on the given type.
|
|
235
|
-
* @template S - JSON schema type.
|
|
236
|
-
* @param type - The type of parser to create.
|
|
237
|
-
* @returns An instance of MarkdownCodeBlockParser.
|
|
238
|
-
*/
|
|
239
|
-
declare function createParser<T extends Extract<CreateParserType, "markdownCodeBlock">>(type: T, options?: BaseParserOptions): MarkdownCodeBlockParser;
|
|
240
|
-
/**
|
|
241
|
-
* Creates a parser based on the given type.
|
|
242
|
-
* @template S - JSON schema type.
|
|
243
|
-
* @param type - The type of parser to create.
|
|
244
|
-
* @returns An instance of ListToKeyValueParser.
|
|
245
|
-
*/
|
|
246
|
-
declare function createParser<T extends Extract<CreateParserType, "listToKeyValue">>(type: T, options?: BaseParserOptions): ListToKeyValueParser;
|
|
247
|
-
/**
|
|
248
|
-
* Creates a parser based on the given type.
|
|
249
|
-
* @template S - JSON schema type.
|
|
250
|
-
* @param type - The type of parser to create.
|
|
251
|
-
* @returns An instance of ListToArrayParser.
|
|
252
|
-
*/
|
|
253
|
-
declare function createParser<T extends Extract<CreateParserType, "listToArray">, S extends JSONSchema | undefined = undefined>(type: T, options?: BaseParserOptions): ListToArrayParser;
|
|
254
|
-
/**
|
|
255
|
-
* Creates a parser based on the given type.
|
|
256
|
-
* @template S - JSON schema type.
|
|
257
|
-
* @param type - The type of parser to create.
|
|
258
|
-
* @returns An instance of NumberParser.
|
|
259
|
-
*/
|
|
260
|
-
declare function createParser<T extends Extract<CreateParserType, "number">, S extends JSONSchema | undefined = undefined>(type: T, options?: BaseParserOptions): NumberParser;
|
|
261
|
-
/**
|
|
262
|
-
* Creates a parser based on the given type.
|
|
263
|
-
* @template S - JSON schema type.
|
|
264
|
-
* @param type - The type of parser to create.
|
|
265
|
-
* @returns An instance of NumberParser.
|
|
266
|
-
*/
|
|
267
|
-
declare function createParser<T extends Extract<CreateParserType, "boolean">, S extends JSONSchema | undefined = undefined>(type: T, options?: BaseParserOptions): BooleanParser;
|
|
268
|
-
/**
|
|
269
|
-
* Creates a parser based on the given type.
|
|
270
|
-
* @template S - JSON schema type.
|
|
271
|
-
* @param type - The type of parser to create.
|
|
272
|
-
* @returns An instance of ReplaceStringTemplateParser.
|
|
273
|
-
*/
|
|
274
|
-
declare function createParser<T extends Extract<CreateParserType, "replaceStringTemplate">, S extends JSONSchema | undefined = undefined>(type: T, options?: BaseParserOptions): ReplaceStringTemplateParser;
|
|
275
|
-
/**
|
|
276
|
-
* Creates a parser based on the given type.
|
|
277
|
-
* @template S - JSON schema type.
|
|
278
|
-
* @param type - The type of parser to create.
|
|
279
|
-
* @returns An instance of StringParser.
|
|
280
|
-
*/
|
|
281
|
-
declare function createParser<T extends Extract<CreateParserType, "string">, S extends JSONSchema | undefined = undefined>(type: T, options?: BaseParserOptions): StringParser;
|
|
282
|
-
/**
|
|
283
|
-
* Creates a parser based on the given type.
|
|
284
|
-
* @template S - JSON schema type.
|
|
285
|
-
* @param type - The type of parser to create.
|
|
286
|
-
* @returns An instance of StringParser.
|
|
287
|
-
*/
|
|
288
|
-
declare function createParser<T extends Extract<CreateParserType, "stringExtract">, S extends JSONSchema | undefined = undefined>(type: T, options?: StringExtractParserOptions): StringExtractParser;
|
|
289
|
-
/**
|
|
290
|
-
* Creates a parser based on the given type and schema.
|
|
291
|
-
* @template S - JSON schema type.
|
|
292
|
-
* @param type - The type of parser to create.
|
|
293
|
-
* @param options - The JSON schema.
|
|
294
|
-
* @returns An instance of ListToJsonParser.
|
|
347
|
+
* Labeled-tuple union for `createParser` arguments. Each branch enumerates
|
|
348
|
+
* exactly what's valid for one parser type. TypeScript validates the whole
|
|
349
|
+
* argument tuple against this union, which produces useful error messages
|
|
350
|
+
* (e.g. "Source has 1 element(s) but target requires 2" when stringExtract
|
|
351
|
+
* is called without options) instead of overload-resolution mystery.
|
|
295
352
|
*/
|
|
296
|
-
|
|
353
|
+
type CreateParserArgs = [type: "string", options?: never] | [type: "boolean", options?: never] | [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
|
+
type: "listToJson",
|
|
355
|
+
options?: ListToJsonParserOptions<JSONSchema | undefined>
|
|
356
|
+
] | [type: "stringExtract", options: StringExtractParserOptions<readonly string[]>];
|
|
297
357
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* @param [options] - The JSON schema.
|
|
302
|
-
* @returns An instance of JsonParser.
|
|
358
|
+
* Maps a concrete argument tuple back to the parser instance type, preserving
|
|
359
|
+
* schema inference for json/listToJson and enum literal narrowing for
|
|
360
|
+
* stringExtract.
|
|
303
361
|
*/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
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 ["listToJson", ListToJsonParserOptions<infer S>] ? ListToJsonParser<S> : A extends readonly [
|
|
363
|
+
"stringExtract",
|
|
364
|
+
StringExtractParserOptions<infer E extends readonly string[]>
|
|
365
|
+
] ? StringExtractParser<E> : never;
|
|
366
|
+
declare function createParser<const A extends CreateParserArgs>(...args: A): CreateParserReturn<A>;
|
|
367
|
+
declare function createCustomParser<O>(name: string, parserFn: (text: string, context: ExecutionContext<any, any>) => O): CustomParser<ReturnType<typeof parserFn>>;
|
|
307
368
|
|
|
308
|
-
|
|
309
|
-
parser: T;
|
|
310
|
-
constructor(options: LlmNativeFunctionParserOptions<T>);
|
|
311
|
-
parse(text: OutputResult, _options?: Record<string, any>): OutputResultContent[] | ParserOutput<T>;
|
|
312
|
-
}
|
|
313
|
-
interface LlmNativeFunctionParserOptions<T extends BaseParser<any>> extends BaseParserOptions {
|
|
369
|
+
interface LlmNativeFunctionParserOptions<T extends BaseParser<any, any>> {
|
|
314
370
|
parser: T;
|
|
315
371
|
}
|
|
316
|
-
|
|
372
|
+
declare class LlmFunctionParser<T extends BaseParser<any, any>> extends BaseParser<ParserOutput<T> | OutputResultContent[], OutputResult | string> {
|
|
317
373
|
parser: T;
|
|
374
|
+
constructor(options: LlmNativeFunctionParserOptions<T>);
|
|
375
|
+
parse(text: OutputResult, _options?: Record<string, any>): ParserOutput<T> | OutputResultContent[];
|
|
318
376
|
}
|
|
319
377
|
/**
|
|
320
378
|
* @deprecated Use `LlmFunctionParser` instead.
|
|
321
379
|
*/
|
|
322
|
-
declare class LlmNativeFunctionParser<T extends BaseParser<any>> extends BaseParser<ParserOutput<T> | {
|
|
380
|
+
declare class LlmNativeFunctionParser<T extends BaseParser<any, any>> extends BaseParser<ParserOutput<T> | {
|
|
323
381
|
name: any;
|
|
324
382
|
arguments: any;
|
|
325
|
-
}> {
|
|
383
|
+
}, OutputResult | string> {
|
|
326
384
|
parser: T;
|
|
327
385
|
constructor(options: LlmNativeFunctionParserOptions<T>);
|
|
328
386
|
parse(text: OutputResult, _options?: Record<string, any>): ParserOutput<T> | {
|
|
@@ -347,6 +405,7 @@ declare abstract class BasePrompt<I extends Record<string, any>> {
|
|
|
347
405
|
messages: IPromptMessages | IPromptChatMessages;
|
|
348
406
|
partials: PromptPartial[];
|
|
349
407
|
helpers: PromptHelper[];
|
|
408
|
+
validateInput: ValidateInputMode;
|
|
350
409
|
replaceTemplateString: typeof replaceTemplateString;
|
|
351
410
|
replaceTemplateStringAsync: typeof replaceTemplateStringAsync;
|
|
352
411
|
filters: {
|
|
@@ -383,6 +442,16 @@ declare abstract class BasePrompt<I extends Record<string, any>> {
|
|
|
383
442
|
* @return BasePrompt so it can be chained.
|
|
384
443
|
*/
|
|
385
444
|
registerHelpers(helperOrHelpers: PromptHelper | PromptHelper[]): this;
|
|
445
|
+
/**
|
|
446
|
+
* Returns the Handlebars-bearing strings that should be validated, along
|
|
447
|
+
* with a location label used for error context. Subclasses with structured
|
|
448
|
+
* message content (e.g. ChatPrompt) should override.
|
|
449
|
+
*/
|
|
450
|
+
protected getTemplateContents(): {
|
|
451
|
+
content: string;
|
|
452
|
+
location: string;
|
|
453
|
+
}[];
|
|
454
|
+
protected preflightValidate(values: I): void;
|
|
386
455
|
/**
|
|
387
456
|
* format description
|
|
388
457
|
* @param values The message content
|
|
@@ -403,10 +472,17 @@ declare abstract class BasePrompt<I extends Record<string, any>> {
|
|
|
403
472
|
_input: any;
|
|
404
473
|
};
|
|
405
474
|
/**
|
|
406
|
-
* Validates
|
|
407
|
-
*
|
|
475
|
+
* Validates that `input` provides every variable referenced by this prompt's
|
|
476
|
+
* templates, and that every identifiable helper call is registered.
|
|
477
|
+
*
|
|
478
|
+
* @breaking v3: previously returned `this.messages.length > 0` with no
|
|
479
|
+
* `input` parameter. For the old behavior, read `prompt.messages.length > 0`
|
|
480
|
+
* directly.
|
|
481
|
+
*
|
|
482
|
+
* @throws LlmExeError with code `"prompt.missing_template_variable"` listing
|
|
483
|
+
* all missing variables and helpers.
|
|
408
484
|
*/
|
|
409
|
-
validate():
|
|
485
|
+
validate(input: I): void;
|
|
410
486
|
}
|
|
411
487
|
|
|
412
488
|
/**
|
|
@@ -535,6 +611,7 @@ type PromptPartial = {
|
|
|
535
611
|
name: string;
|
|
536
612
|
template: string;
|
|
537
613
|
};
|
|
614
|
+
type ValidateInputMode = false | "strict" | "warn";
|
|
538
615
|
interface PromptTemplateOptions {
|
|
539
616
|
partials?: PromptPartial[];
|
|
540
617
|
helpers?: PromptHelper[];
|
|
@@ -543,6 +620,15 @@ interface PromptOptions extends PromptTemplateOptions {
|
|
|
543
620
|
preFilters?: ((prompt: string) => string)[];
|
|
544
621
|
postFilters?: ((prompt: string) => string)[];
|
|
545
622
|
replaceTemplateString?: (...args: any[]) => string;
|
|
623
|
+
/**
|
|
624
|
+
* Controls whether `format()` preflights input against the variables
|
|
625
|
+
* referenced by the prompt's templates. See `validate(input)`.
|
|
626
|
+
*
|
|
627
|
+
* - `false` (default): no preflight; rendering proceeds.
|
|
628
|
+
* - `"strict"`: throw `LlmExeError("prompt.missing_template_variable")` before rendering.
|
|
629
|
+
* - `"warn"`: emit a Node warning via `process.emitWarning` and continue rendering.
|
|
630
|
+
*/
|
|
631
|
+
validateInput?: ValidateInputMode;
|
|
546
632
|
}
|
|
547
633
|
interface ChatPromptOptions extends PromptOptions {
|
|
548
634
|
allowUnsafeUserTemplate?: boolean;
|
|
@@ -602,10 +688,27 @@ declare abstract class BaseExecutor<I extends PlainObject, O = any, H extends Ba
|
|
|
602
688
|
*/
|
|
603
689
|
readonly maxHooksPerEvent: number;
|
|
604
690
|
constructor(name: string, type: string, options?: CoreExecutorExecuteOptions<H>);
|
|
605
|
-
abstract handler(input: I, _options?: any): Promise<any>;
|
|
691
|
+
abstract handler(input: I, _options?: any, _context?: ExecutionContext<I, O>): Promise<any>;
|
|
606
692
|
/**
|
|
693
|
+
* Build a per-call execution context snapshot. Captures the current
|
|
694
|
+
* execution metadata so the snapshot reflects state at the time it was
|
|
695
|
+
* taken (e.g. `handlerInput` becomes available after `getHandlerInput`).
|
|
696
|
+
*/
|
|
697
|
+
protected snapshotContext(execution: ExecutorExecutionMetadata<I, O>): ExecutionContext<I, O>;
|
|
698
|
+
/**
|
|
699
|
+
*
|
|
700
|
+
* Used to filter the input of the handler.
|
|
701
|
+
*
|
|
702
|
+
* Throws a `TypeError` if `_input` is `null` or `undefined`. The declared
|
|
703
|
+
* input type is `I extends PlainObject`; omitting input or passing an
|
|
704
|
+
* explicit `null` is a contract violation with no valid coercion, so we
|
|
705
|
+
* surface it loudly rather than silently wrapping it.
|
|
706
|
+
*
|
|
707
|
+
* Non-object inputs (strings, numbers, arrays) are intentionally coerced
|
|
708
|
+
* to `{ input: value }` via {@link ensureInputIsObject}. This preserves the
|
|
709
|
+
* convenience pattern used by tool/function callables, which forward raw
|
|
710
|
+
* string arguments into an executor.
|
|
607
711
|
*
|
|
608
|
-
* Used to filter the input of the handler
|
|
609
712
|
* @param _input
|
|
610
713
|
* @returns original input formatted for handler
|
|
611
714
|
*/
|
|
@@ -616,7 +719,7 @@ declare abstract class BaseExecutor<I extends PlainObject, O = any, H extends Ba
|
|
|
616
719
|
* @param _input
|
|
617
720
|
* @returns output O
|
|
618
721
|
*/
|
|
619
|
-
getHandlerOutput(out: any, _metadata: ExecutorExecutionMetadata<any, O>, _options?: any): O;
|
|
722
|
+
getHandlerOutput(out: any, _metadata: ExecutorExecutionMetadata<any, O>, _options?: any, _context?: ExecutionContext<I, O>): O;
|
|
620
723
|
/**
|
|
621
724
|
*
|
|
622
725
|
* execute - Runs the executor
|
|
@@ -624,9 +727,10 @@ declare abstract class BaseExecutor<I extends PlainObject, O = any, H extends Ba
|
|
|
624
727
|
* @returns handler output
|
|
625
728
|
*/
|
|
626
729
|
execute(_input: I, _options?: any): Promise<O>;
|
|
730
|
+
private collectHookErrors;
|
|
627
731
|
metadata(): Record<string, any>;
|
|
628
732
|
getMetadata(metadata?: Record<string, any>): ExecutorMetadata;
|
|
629
|
-
runHook(hook: keyof H, _metadata: ExecutorExecutionMetadata):
|
|
733
|
+
runHook(hook: keyof H, _metadata: ExecutorExecutionMetadata): HookErrorRecord[];
|
|
630
734
|
setHooks(hooks?: CoreExecutorHookInput<H>): this;
|
|
631
735
|
removeHook(eventName: keyof H, fn: ListenerFunction): this;
|
|
632
736
|
on(eventName: keyof H, fn: ListenerFunction): this;
|
|
@@ -785,16 +889,24 @@ declare function createStateItem<T>(name: string, defaultValue: T): DefaultState
|
|
|
785
889
|
/**
|
|
786
890
|
* Core Executor With LLM
|
|
787
891
|
*/
|
|
788
|
-
declare class LlmExecutor<Llm extends BaseLlm<any>, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser, State extends BaseState> extends BaseExecutor<PromptInput<Prompt>, ParserOutput<Parser>, LlmExecutorHooks> {
|
|
892
|
+
declare class LlmExecutor<Llm extends BaseLlm<any>, Prompt extends BasePrompt<Record<string, any>>, Parser extends BaseParser<any, any>, State extends BaseState> extends BaseExecutor<PromptInput<Prompt>, ParserOutput<Parser>, LlmExecutorHooks> {
|
|
789
893
|
llm: Llm;
|
|
790
894
|
prompt: Prompt | undefined;
|
|
791
895
|
promptFn: any;
|
|
792
896
|
parser: StringParser | Parser;
|
|
793
897
|
constructor(llmConfiguration: ExecutorWithLlmOptions<Llm, Prompt, Parser, State>, options?: CoreExecutorExecuteOptions<LlmExecutorHooks>);
|
|
898
|
+
/**
|
|
899
|
+
* Runs the executor against the configured LLM and prompt.
|
|
900
|
+
*
|
|
901
|
+
* `null` and `undefined` are rejected with a `TypeError`: the declared
|
|
902
|
+
* input type requires an object, and silently coercing missing input hides a
|
|
903
|
+
* clear contract violation. Use `{}` for prompts that declare no template
|
|
904
|
+
* variables. See issue #410.
|
|
905
|
+
*/
|
|
794
906
|
execute(_input: PromptInput<Prompt>, _options?: LlmExecutorExecuteOptions): Promise<ParserOutput<Parser>>;
|
|
795
|
-
handler(_input: PromptInput<Prompt>,
|
|
907
|
+
handler(_input: PromptInput<Prompt>, _options?: LlmExecutorExecuteOptions, _context?: ExecutionContext<PromptInput<Prompt>, ParserOutput<Parser>>): Promise<any>;
|
|
796
908
|
getHandlerInput(_input: PromptInput<Prompt>): Promise<any>;
|
|
797
|
-
getHandlerOutput(out: BaseLlCall, _metadata: ExecutorExecutionMetadata<PromptInput<Prompt>, ParserOutput<Parser>>): ParserOutput<Parser>;
|
|
909
|
+
getHandlerOutput(out: BaseLlCall, _metadata: ExecutorExecutionMetadata<PromptInput<Prompt>, ParserOutput<Parser>>, _options?: LlmExecutorExecuteOptions, _context?: ExecutionContext<PromptInput<Prompt>, ParserOutput<Parser>>): ParserOutput<Parser>;
|
|
798
910
|
metadata(): {
|
|
799
911
|
llm: Record<string, any>;
|
|
800
912
|
};
|
|
@@ -844,7 +956,7 @@ declare const hookOnError = "onError";
|
|
|
844
956
|
declare const hookOnSuccess = "onSuccess";
|
|
845
957
|
|
|
846
958
|
type ListenerFunction = (...args: any[]) => void;
|
|
847
|
-
type ParserOutput<P> = P extends BaseParser<infer T> ? T : never;
|
|
959
|
+
type ParserOutput<P> = P extends BaseParser<infer T, any> ? T : never;
|
|
848
960
|
type PromptInput<P> = P extends BasePrompt<infer T> ? T : never;
|
|
849
961
|
interface ExecutorWithLlmOptions<Llm, Prompt, Parser, State> {
|
|
850
962
|
name?: string;
|
|
@@ -871,6 +983,15 @@ interface ExecutorMetadata {
|
|
|
871
983
|
executions: number;
|
|
872
984
|
metadata?: Record<string, any>;
|
|
873
985
|
}
|
|
986
|
+
interface HookErrorRecord {
|
|
987
|
+
hook: string;
|
|
988
|
+
error: unknown;
|
|
989
|
+
errorMessage: string;
|
|
990
|
+
errorCategory?: string;
|
|
991
|
+
errorCode?: string;
|
|
992
|
+
errorContext?: unknown;
|
|
993
|
+
errorCause?: unknown;
|
|
994
|
+
}
|
|
874
995
|
interface ExecutorExecutionMetadata<I = any, O = any> {
|
|
875
996
|
start: null | number;
|
|
876
997
|
end: null | number;
|
|
@@ -880,12 +1001,29 @@ interface ExecutorExecutionMetadata<I = any, O = any> {
|
|
|
880
1001
|
output?: O;
|
|
881
1002
|
errorMessage?: string;
|
|
882
1003
|
error?: Error;
|
|
1004
|
+
errorCategory?: string;
|
|
1005
|
+
errorCode?: string;
|
|
1006
|
+
errorContext?: unknown;
|
|
1007
|
+
errorCause?: unknown;
|
|
1008
|
+
hookErrors?: HookErrorRecord[];
|
|
883
1009
|
metadata?: null | ExecutorMetadata;
|
|
884
1010
|
}
|
|
885
1011
|
interface ExecutorContext<I = any, O = any, A = Record<string, any>> extends ExecutorExecutionMetadata<I, O> {
|
|
886
1012
|
metadata: ExecutorMetadata;
|
|
887
1013
|
attributes: A;
|
|
888
1014
|
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Per-call execution context. Built by `BaseExecutor.execute()` and threaded
|
|
1017
|
+
* through `handler()`, `llm.call()`, parsers, and warnings. Provides a single
|
|
1018
|
+
* place to read the resolved trace ID, stable executor identity, and the
|
|
1019
|
+
* mutable execution state for the current run.
|
|
1020
|
+
*/
|
|
1021
|
+
interface ExecutionContext<I = any, O = any, A = Record<string, any>> {
|
|
1022
|
+
traceId?: string;
|
|
1023
|
+
executor: ExecutorMetadata;
|
|
1024
|
+
execution: ExecutorExecutionMetadata<I, O>;
|
|
1025
|
+
attributes: A;
|
|
1026
|
+
}
|
|
889
1027
|
interface BaseExecutorHooks {
|
|
890
1028
|
[hookOnError]: ListenerFunction[];
|
|
891
1029
|
[hookOnSuccess]: ListenerFunction[];
|
|
@@ -919,14 +1057,11 @@ interface LlmExecutorWithFunctionsOptions<T extends GenericFunctionCall = "auto"
|
|
|
919
1057
|
jsonSchema?: Record<string, any>;
|
|
920
1058
|
}
|
|
921
1059
|
|
|
922
|
-
|
|
923
|
-
interface BaseParserOptions {
|
|
924
|
-
}
|
|
925
|
-
interface BaseParserOptionsWithSchema<S extends JSONSchema | undefined = undefined> extends BaseParserOptions {
|
|
1060
|
+
interface JsonParserOptions<S extends JSONSchema | undefined = undefined> {
|
|
926
1061
|
schema?: S;
|
|
927
1062
|
validateSchema?: boolean;
|
|
928
1063
|
}
|
|
929
|
-
interface ListToJsonParserOptions<S extends JSONSchema | undefined = undefined> extends
|
|
1064
|
+
interface ListToJsonParserOptions<S extends JSONSchema | undefined = undefined> extends JsonParserOptions<S> {
|
|
930
1065
|
keyTransform?: "camelCase" | "preserve";
|
|
931
1066
|
}
|
|
932
1067
|
|
|
@@ -1187,6 +1322,9 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1187
1322
|
"google.gemini-3.1-flash-lite": {
|
|
1188
1323
|
input: Omit<GeminiRequest, "model">;
|
|
1189
1324
|
};
|
|
1325
|
+
"google.gemini-3.5-flash": {
|
|
1326
|
+
input: Omit<GeminiRequest, "model">;
|
|
1327
|
+
};
|
|
1190
1328
|
"google.gemini-2.0-flash": {
|
|
1191
1329
|
input: Omit<GeminiRequest, "model">;
|
|
1192
1330
|
};
|
|
@@ -1217,6 +1355,12 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1217
1355
|
"xai.grok-4.3": {
|
|
1218
1356
|
input: Omit<XAiRequest, "model">;
|
|
1219
1357
|
};
|
|
1358
|
+
"xai.grok-4.20": {
|
|
1359
|
+
input: Omit<XAiRequest, "model">;
|
|
1360
|
+
};
|
|
1361
|
+
"xai.grok-4.20-reasoning": {
|
|
1362
|
+
input: Omit<XAiRequest, "model">;
|
|
1363
|
+
};
|
|
1220
1364
|
"ollama.deepseek-r1": {
|
|
1221
1365
|
input: GenericLLm;
|
|
1222
1366
|
};
|
|
@@ -1244,6 +1388,15 @@ type AllUseLlmOptions = AllLlm & {
|
|
|
1244
1388
|
"ollama.qwen3": {
|
|
1245
1389
|
input: GenericLLm;
|
|
1246
1390
|
};
|
|
1391
|
+
"ollama.qwen3.5": {
|
|
1392
|
+
input: GenericLLm;
|
|
1393
|
+
};
|
|
1394
|
+
"ollama.gemma4": {
|
|
1395
|
+
input: GenericLLm;
|
|
1396
|
+
};
|
|
1397
|
+
"ollama.gpt-oss": {
|
|
1398
|
+
input: GenericLLm;
|
|
1399
|
+
};
|
|
1247
1400
|
"deepseek.chat": {
|
|
1248
1401
|
input: DeepseekRequest;
|
|
1249
1402
|
};
|
|
@@ -1379,8 +1532,224 @@ interface Config<Pk = LlmProviderKey> {
|
|
|
1379
1532
|
* `getEmbeddingOutputParser` instead.
|
|
1380
1533
|
*/
|
|
1381
1534
|
transformResponse?: (result: any, _config?: Config<any>) => OutputResult;
|
|
1535
|
+
/**
|
|
1536
|
+
* Marks this config as deprecated. When set, useLlm() will emit a one-time
|
|
1537
|
+
* deprecation warning to inform users about upcoming model shutdowns.
|
|
1538
|
+
*/
|
|
1539
|
+
deprecated?: {
|
|
1540
|
+
shorthand: string;
|
|
1541
|
+
message: string;
|
|
1542
|
+
};
|
|
1382
1543
|
}
|
|
1383
1544
|
|
|
1545
|
+
type JsonSafe = string | number | boolean | null | JsonSafe[] | {
|
|
1546
|
+
[key: string]: JsonSafe;
|
|
1547
|
+
};
|
|
1548
|
+
type ErrorCategory = "unknown" | "configuration" | "llm" | "embedding" | "prompt" | "parser" | "executor" | "callable" | "state" | "request" | "auth" | "template" | "internal";
|
|
1549
|
+
type BaseErrorContext = {
|
|
1550
|
+
operation?: string;
|
|
1551
|
+
provider?: string;
|
|
1552
|
+
model?: string;
|
|
1553
|
+
key?: string;
|
|
1554
|
+
input?: unknown;
|
|
1555
|
+
output?: unknown;
|
|
1556
|
+
response?: unknown;
|
|
1557
|
+
status?: number;
|
|
1558
|
+
url?: string;
|
|
1559
|
+
parser?: string;
|
|
1560
|
+
promptType?: string;
|
|
1561
|
+
functionName?: string;
|
|
1562
|
+
hook?: string;
|
|
1563
|
+
expected?: unknown;
|
|
1564
|
+
received?: unknown;
|
|
1565
|
+
resolution?: string;
|
|
1566
|
+
docsPath?: string;
|
|
1567
|
+
docsUrl?: string;
|
|
1568
|
+
};
|
|
1569
|
+
type ConfigurationProviderContext = BaseErrorContext & {
|
|
1570
|
+
provider?: string;
|
|
1571
|
+
availableProviders?: string[];
|
|
1572
|
+
};
|
|
1573
|
+
type MissingConfigurationContext = BaseErrorContext & {
|
|
1574
|
+
provider?: string;
|
|
1575
|
+
key?: string;
|
|
1576
|
+
option?: string;
|
|
1577
|
+
envVar?: string;
|
|
1578
|
+
};
|
|
1579
|
+
type InvalidHeadersContext = BaseErrorContext & {
|
|
1580
|
+
provider?: string;
|
|
1581
|
+
key?: string;
|
|
1582
|
+
headerTemplate?: string;
|
|
1583
|
+
replacedHeadersExcerpt?: string;
|
|
1584
|
+
};
|
|
1585
|
+
type ParserInvalidTypeContext = BaseErrorContext & {
|
|
1586
|
+
parser?: unknown;
|
|
1587
|
+
availableParsers?: string[];
|
|
1588
|
+
};
|
|
1589
|
+
type ParserSchemaValidationContext = BaseErrorContext & {
|
|
1590
|
+
parser?: string;
|
|
1591
|
+
schemaErrors?: unknown;
|
|
1592
|
+
outputExcerpt?: string;
|
|
1593
|
+
};
|
|
1594
|
+
type ParserParseFailedContext = BaseErrorContext & {
|
|
1595
|
+
parser?: string;
|
|
1596
|
+
reason?: string;
|
|
1597
|
+
inputExcerpt?: string;
|
|
1598
|
+
inputExcerptTruncated?: boolean;
|
|
1599
|
+
inputLength?: number;
|
|
1600
|
+
matchCount?: number;
|
|
1601
|
+
match?: string;
|
|
1602
|
+
outputExcerpt?: string;
|
|
1603
|
+
};
|
|
1604
|
+
type PromptInputContext = BaseErrorContext & {
|
|
1605
|
+
promptType?: string;
|
|
1606
|
+
};
|
|
1607
|
+
type PromptMessagesContext = BaseErrorContext & {
|
|
1608
|
+
provider?: string;
|
|
1609
|
+
};
|
|
1610
|
+
type PromptMissingTemplateVariableContext = BaseErrorContext & {
|
|
1611
|
+
promptType?: string;
|
|
1612
|
+
missingVariables: string[];
|
|
1613
|
+
missingHelpers: string[];
|
|
1614
|
+
};
|
|
1615
|
+
type NormalizedProviderError = {
|
|
1616
|
+
message?: string;
|
|
1617
|
+
providerType?: string;
|
|
1618
|
+
providerCode?: string;
|
|
1619
|
+
status?: number;
|
|
1620
|
+
statusText?: string;
|
|
1621
|
+
retryable?: boolean;
|
|
1622
|
+
retryAfterMs?: number;
|
|
1623
|
+
};
|
|
1624
|
+
type ProviderErrorContext = BaseErrorContext & {
|
|
1625
|
+
provider?: string;
|
|
1626
|
+
model?: string;
|
|
1627
|
+
status?: number;
|
|
1628
|
+
statusText?: string;
|
|
1629
|
+
url?: string;
|
|
1630
|
+
providerError?: NormalizedProviderError;
|
|
1631
|
+
providerErrorBody?: unknown;
|
|
1632
|
+
providerErrorRaw?: string;
|
|
1633
|
+
responseHeaders?: Record<string, string>;
|
|
1634
|
+
};
|
|
1635
|
+
type ProviderResponseContext = BaseErrorContext & {
|
|
1636
|
+
provider?: string;
|
|
1637
|
+
model?: string;
|
|
1638
|
+
responseExcerpt?: string;
|
|
1639
|
+
lineNumber?: number;
|
|
1640
|
+
lineExcerpt?: string;
|
|
1641
|
+
lineCount?: number;
|
|
1642
|
+
availableProviders?: string[];
|
|
1643
|
+
};
|
|
1644
|
+
type EmbeddingDimensionsContext = BaseErrorContext & {
|
|
1645
|
+
provider?: string;
|
|
1646
|
+
model?: string;
|
|
1647
|
+
dimensions?: number;
|
|
1648
|
+
};
|
|
1649
|
+
type ExecutorErrorContext = BaseErrorContext & {
|
|
1650
|
+
executorName?: string;
|
|
1651
|
+
executorType?: string;
|
|
1652
|
+
traceId?: string;
|
|
1653
|
+
};
|
|
1654
|
+
type ExecutorHookContext = ExecutorErrorContext & {
|
|
1655
|
+
hook?: string;
|
|
1656
|
+
hookCount?: number;
|
|
1657
|
+
maxHooksPerEvent?: number;
|
|
1658
|
+
};
|
|
1659
|
+
type CallableErrorContext = BaseErrorContext & {
|
|
1660
|
+
functionName?: string;
|
|
1661
|
+
availableFunctions?: string[];
|
|
1662
|
+
};
|
|
1663
|
+
type TemplateHelperContext = BaseErrorContext & {
|
|
1664
|
+
helper?: string;
|
|
1665
|
+
};
|
|
1666
|
+
type StateErrorContext = BaseErrorContext & {
|
|
1667
|
+
module?: string;
|
|
1668
|
+
};
|
|
1669
|
+
type AwsAuthContext = BaseErrorContext & {
|
|
1670
|
+
url?: string;
|
|
1671
|
+
regionName?: string;
|
|
1672
|
+
};
|
|
1673
|
+
type RequestErrorContext = BaseErrorContext & {
|
|
1674
|
+
url?: string;
|
|
1675
|
+
status?: number;
|
|
1676
|
+
statusText?: string;
|
|
1677
|
+
providerError?: NormalizedProviderError;
|
|
1678
|
+
providerErrorBody?: unknown;
|
|
1679
|
+
providerErrorRaw?: string;
|
|
1680
|
+
responseHeaders?: Record<string, string>;
|
|
1681
|
+
};
|
|
1682
|
+
type InternalErrorContext = BaseErrorContext & {
|
|
1683
|
+
invariant?: string;
|
|
1684
|
+
};
|
|
1685
|
+
type ErrorContextByCode = {
|
|
1686
|
+
"configuration.missing_provider": ConfigurationProviderContext;
|
|
1687
|
+
"configuration.invalid_provider": ConfigurationProviderContext;
|
|
1688
|
+
"configuration.missing_env": MissingConfigurationContext;
|
|
1689
|
+
"configuration.missing_option": MissingConfigurationContext;
|
|
1690
|
+
"configuration.invalid_headers": InvalidHeadersContext;
|
|
1691
|
+
"parser.invalid_type": ParserInvalidTypeContext;
|
|
1692
|
+
"parser.invalid_input": ParserParseFailedContext;
|
|
1693
|
+
"parser.parse_failed": ParserParseFailedContext;
|
|
1694
|
+
"parser.schema_validation_failed": ParserSchemaValidationContext;
|
|
1695
|
+
"prompt.missing_input": PromptInputContext;
|
|
1696
|
+
"prompt.invalid_messages": PromptMessagesContext;
|
|
1697
|
+
"prompt.missing_template_variable": PromptMissingTemplateVariableContext;
|
|
1698
|
+
"llm.provider_http_error": ProviderErrorContext;
|
|
1699
|
+
"llm.provider_rate_limited": ProviderErrorContext;
|
|
1700
|
+
"llm.provider_auth_failed": ProviderErrorContext;
|
|
1701
|
+
"llm.provider_invalid_request": ProviderErrorContext;
|
|
1702
|
+
"llm.provider_unavailable": ProviderErrorContext;
|
|
1703
|
+
"llm.invalid_response_shape": ProviderResponseContext;
|
|
1704
|
+
"llm.invalid_jsonl_response": ProviderResponseContext;
|
|
1705
|
+
"embedding.provider_http_error": ProviderErrorContext;
|
|
1706
|
+
"embedding.provider_rate_limited": ProviderErrorContext;
|
|
1707
|
+
"embedding.provider_auth_failed": ProviderErrorContext;
|
|
1708
|
+
"embedding.provider_invalid_request": ProviderErrorContext;
|
|
1709
|
+
"embedding.provider_unavailable": ProviderErrorContext;
|
|
1710
|
+
"embedding.missing_provider": ConfigurationProviderContext;
|
|
1711
|
+
"embedding.invalid_provider": ConfigurationProviderContext;
|
|
1712
|
+
"embedding.unsupported_dimensions": EmbeddingDimensionsContext;
|
|
1713
|
+
"embedding.invalid_response_shape": ProviderResponseContext;
|
|
1714
|
+
"executor.missing_prompt": ExecutorErrorContext;
|
|
1715
|
+
"executor.hook_limit_reached": ExecutorHookContext;
|
|
1716
|
+
"executor.hook_failed": ExecutorHookContext;
|
|
1717
|
+
"callable.invalid_handler": CallableErrorContext;
|
|
1718
|
+
"callable.handler_not_found": CallableErrorContext;
|
|
1719
|
+
"callable.validation_failed": CallableErrorContext;
|
|
1720
|
+
"template.invalid_helper_arguments": TemplateHelperContext;
|
|
1721
|
+
"state.invalid_arguments": StateErrorContext;
|
|
1722
|
+
"auth.aws_signing_input_missing": AwsAuthContext;
|
|
1723
|
+
"request.invalid_url": RequestErrorContext;
|
|
1724
|
+
"request.http_error": RequestErrorContext;
|
|
1725
|
+
"internal.invariant_failed": InternalErrorContext;
|
|
1726
|
+
"unknown.unclassified": Record<string, unknown>;
|
|
1727
|
+
};
|
|
1728
|
+
type ErrorCodes = keyof ErrorContextByCode;
|
|
1729
|
+
type CategoryFor<C extends ErrorCodes> = C extends `${infer Category}.${string}` ? Category & ErrorCategory : never;
|
|
1730
|
+
type SerializableCause = {
|
|
1731
|
+
name?: string;
|
|
1732
|
+
message?: string;
|
|
1733
|
+
category?: string;
|
|
1734
|
+
code?: string;
|
|
1735
|
+
context?: unknown;
|
|
1736
|
+
cause?: unknown;
|
|
1737
|
+
} | JsonSafe;
|
|
1738
|
+
type LlmExeErrorOptions<C extends ErrorCodes = ErrorCodes> = {
|
|
1739
|
+
code: C;
|
|
1740
|
+
context?: ErrorContextByCode[C];
|
|
1741
|
+
cause?: unknown;
|
|
1742
|
+
};
|
|
1743
|
+
type LlmExeErrorJson<C extends ErrorCodes = ErrorCodes> = {
|
|
1744
|
+
name: "LlmExeError";
|
|
1745
|
+
message: string;
|
|
1746
|
+
category: CategoryFor<C>;
|
|
1747
|
+
code: C;
|
|
1748
|
+
context?: ErrorContextByCode[C];
|
|
1749
|
+
cause?: SerializableCause;
|
|
1750
|
+
truncated?: boolean;
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1384
1753
|
declare function enforceResultAttributes<O>(input: any): {
|
|
1385
1754
|
result: O;
|
|
1386
1755
|
attributes: Record<string, any>;
|
|
@@ -1495,6 +1864,20 @@ declare function assert(condition: any, message?: string | Error | undefined): a
|
|
|
1495
1864
|
|
|
1496
1865
|
declare function defineSchema<T>(obj: Narrow<T>): Narrow<T>;
|
|
1497
1866
|
|
|
1867
|
+
declare const LLM_EXE_ERROR_SYMBOL: unique symbol;
|
|
1868
|
+
declare class LlmExeError<C extends ErrorCodes = "unknown.unclassified"> extends Error {
|
|
1869
|
+
readonly name: "LlmExeError";
|
|
1870
|
+
readonly isLlmExeError: true;
|
|
1871
|
+
readonly [LLM_EXE_ERROR_SYMBOL]: true;
|
|
1872
|
+
readonly category: CategoryFor<C>;
|
|
1873
|
+
readonly code: C;
|
|
1874
|
+
readonly context?: ErrorContextByCode[C];
|
|
1875
|
+
constructor(message: string, options: LlmExeErrorOptions<C>);
|
|
1876
|
+
toJSON(): LlmExeErrorJson<C>;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
declare function isLlmExeError<C extends ErrorCodes>(error: unknown, code?: C | readonly C[]): error is LlmExeError<C>;
|
|
1880
|
+
|
|
1498
1881
|
declare function importPartials(_partials: {
|
|
1499
1882
|
[key in string]: string;
|
|
1500
1883
|
}): PromptPartial[];
|
|
@@ -1518,6 +1901,9 @@ declare function isObjectStringified(maybeObject: string): boolean;
|
|
|
1518
1901
|
declare function registerHelpers(helpers: any[]): void;
|
|
1519
1902
|
declare function registerPartials(partials: any[]): void;
|
|
1520
1903
|
|
|
1904
|
+
declare const index_LLM_EXE_ERROR_SYMBOL: typeof LLM_EXE_ERROR_SYMBOL;
|
|
1905
|
+
type index_LlmExeError<C extends ErrorCodes = "unknown.unclassified"> = LlmExeError<C>;
|
|
1906
|
+
declare const index_LlmExeError: typeof LlmExeError;
|
|
1521
1907
|
declare const index_assert: typeof assert;
|
|
1522
1908
|
declare const index_asyncCallWithTimeout: typeof asyncCallWithTimeout;
|
|
1523
1909
|
declare const index_defineSchema: typeof defineSchema;
|
|
@@ -1525,6 +1911,7 @@ declare const index_filterObjectOnSchema: typeof filterObjectOnSchema;
|
|
|
1525
1911
|
declare const index_guessProviderFromModel: typeof guessProviderFromModel;
|
|
1526
1912
|
declare const index_importHelpers: typeof importHelpers;
|
|
1527
1913
|
declare const index_importPartials: typeof importPartials;
|
|
1914
|
+
declare const index_isLlmExeError: typeof isLlmExeError;
|
|
1528
1915
|
declare const index_isObjectStringified: typeof isObjectStringified;
|
|
1529
1916
|
declare const index_maybeParseJSON: typeof maybeParseJSON;
|
|
1530
1917
|
declare const index_maybeStringifyJSON: typeof maybeStringifyJSON;
|
|
@@ -1533,7 +1920,7 @@ declare const index_registerPartials: typeof registerPartials;
|
|
|
1533
1920
|
declare const index_replaceTemplateString: typeof replaceTemplateString;
|
|
1534
1921
|
declare const index_replaceTemplateStringAsync: typeof replaceTemplateStringAsync;
|
|
1535
1922
|
declare namespace index {
|
|
1536
|
-
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 };
|
|
1923
|
+
export { index_LLM_EXE_ERROR_SYMBOL as LLM_EXE_ERROR_SYMBOL, index_LlmExeError as LlmExeError, 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_isLlmExeError as isLlmExeError, 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 };
|
|
1537
1924
|
}
|
|
1538
1925
|
|
|
1539
1926
|
declare function isOutputResult(obj: any): obj is OutputResult;
|
|
@@ -1570,14 +1957,15 @@ declare const configs: {
|
|
|
1570
1957
|
"deepseek.chat": Config<keyof AllLlm>;
|
|
1571
1958
|
"deepseek.v4-flash": Config<keyof AllLlm>;
|
|
1572
1959
|
"deepseek.v4-pro": Config<keyof AllLlm>;
|
|
1573
|
-
"google.chat.v1": Config<keyof AllLlm>;
|
|
1574
|
-
"google.gemini-2.5-flash": Config<keyof AllLlm>;
|
|
1575
|
-
"google.gemini-2.5-flash-lite": Config<keyof AllLlm>;
|
|
1576
|
-
"google.gemini-2.5-pro": Config<keyof AllLlm>;
|
|
1577
|
-
"google.gemini-3.1-flash-lite": Config<keyof AllLlm>;
|
|
1578
1960
|
"google.gemini-2.0-flash": Config<keyof AllLlm>;
|
|
1579
1961
|
"google.gemini-2.0-flash-lite": Config<keyof AllLlm>;
|
|
1580
1962
|
"google.gemini-1.5-pro": Config<keyof AllLlm>;
|
|
1963
|
+
"google.gemini-2.5-pro": Config<any>;
|
|
1964
|
+
"google.gemini-2.5-flash-lite": Config<any>;
|
|
1965
|
+
"google.gemini-2.5-flash": Config<any>;
|
|
1966
|
+
"google.chat.v1": Config<keyof AllLlm>;
|
|
1967
|
+
"google.gemini-3.1-flash-lite": Config<keyof AllLlm>;
|
|
1968
|
+
"google.gemini-3.5-flash": Config<keyof AllLlm>;
|
|
1581
1969
|
"ollama.chat.v1": Config<keyof AllLlm>;
|
|
1582
1970
|
"ollama.deepseek-r1": Config<keyof AllLlm>;
|
|
1583
1971
|
"ollama.llama3.3": Config<keyof AllLlm>;
|
|
@@ -1588,6 +1976,9 @@ declare const configs: {
|
|
|
1588
1976
|
"ollama.mistral": Config<keyof AllLlm>;
|
|
1589
1977
|
"ollama.qwen2.5": Config<keyof AllLlm>;
|
|
1590
1978
|
"ollama.qwen3": Config<keyof AllLlm>;
|
|
1979
|
+
"ollama.qwen3.5": Config<keyof AllLlm>;
|
|
1980
|
+
"ollama.gemma4": Config<keyof AllLlm>;
|
|
1981
|
+
"ollama.gpt-oss": Config<keyof AllLlm>;
|
|
1591
1982
|
"xai.chat.v1": Config<keyof AllLlm>;
|
|
1592
1983
|
"xai.grok-2": Config<keyof AllLlm>;
|
|
1593
1984
|
"xai.grok-3": Config<keyof AllLlm>;
|
|
@@ -1596,22 +1987,25 @@ declare const configs: {
|
|
|
1596
1987
|
"xai.grok-4-fast": Config<keyof AllLlm>;
|
|
1597
1988
|
"xai.grok-4-1-fast": Config<keyof AllLlm>;
|
|
1598
1989
|
"xai.grok-4.3": Config<keyof AllLlm>;
|
|
1990
|
+
"xai.grok-4.20": Config<keyof AllLlm>;
|
|
1991
|
+
"xai.grok-4.20-reasoning": Config<keyof AllLlm>;
|
|
1599
1992
|
"amazon:anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1600
1993
|
"amazon:meta.chat.v1": Config<keyof AllLlm>;
|
|
1994
|
+
"anthropic.claude-3-opus": Config<any>;
|
|
1995
|
+
"anthropic.claude-3-5-haiku": Config<any>;
|
|
1996
|
+
"anthropic.claude-3-5-sonnet": Config<any>;
|
|
1997
|
+
"anthropic.claude-3-7-sonnet": Config<any>;
|
|
1998
|
+
"anthropic.claude-opus-4": Config<any>;
|
|
1999
|
+
"anthropic.claude-sonnet-4": Config<any>;
|
|
2000
|
+
"anthropic.claude-opus-4-1": Config<any>;
|
|
2001
|
+
"anthropic.claude-opus-4-6": Config<any>;
|
|
1601
2002
|
"anthropic.chat.v1": Config<keyof AllLlm>;
|
|
1602
2003
|
"anthropic.claude-opus-4-7": Config<keyof AllLlm>;
|
|
1603
2004
|
"anthropic.claude-sonnet-4-6": Config<keyof AllLlm>;
|
|
1604
2005
|
"anthropic.claude-opus-4-5": Config<keyof AllLlm>;
|
|
1605
2006
|
"anthropic.claude-haiku-4-5": Config<keyof AllLlm>;
|
|
1606
2007
|
"anthropic.claude-sonnet-4-5": Config<keyof AllLlm>;
|
|
1607
|
-
"
|
|
1608
|
-
"anthropic.claude-opus-4-1": Config<keyof AllLlm>;
|
|
1609
|
-
"anthropic.claude-sonnet-4": Config<keyof AllLlm>;
|
|
1610
|
-
"anthropic.claude-opus-4": Config<keyof AllLlm>;
|
|
1611
|
-
"anthropic.claude-3-7-sonnet": Config<keyof AllLlm>;
|
|
1612
|
-
"anthropic.claude-3-5-sonnet": Config<keyof AllLlm>;
|
|
1613
|
-
"anthropic.claude-3-5-haiku": Config<keyof AllLlm>;
|
|
1614
|
-
"anthropic.claude-3-opus": Config<keyof AllLlm>;
|
|
2008
|
+
"openai.o4-mini": Config<any>;
|
|
1615
2009
|
"openai.chat.v1": Config<keyof AllLlm>;
|
|
1616
2010
|
"openai.chat-mock.v1": Config<keyof AllLlm>;
|
|
1617
2011
|
"openai.gpt-5.2": Config<keyof AllLlm>;
|
|
@@ -1624,12 +2018,11 @@ declare const configs: {
|
|
|
1624
2018
|
"openai.gpt-4": Config<keyof AllLlm>;
|
|
1625
2019
|
"openai.gpt-4o": Config<keyof AllLlm>;
|
|
1626
2020
|
"openai.gpt-4o-mini": Config<keyof AllLlm>;
|
|
1627
|
-
"openai.o4-mini": Config<keyof AllLlm>;
|
|
1628
2021
|
};
|
|
1629
2022
|
|
|
1630
2023
|
declare function useLlm<T extends keyof typeof configs>(provider: T, options?: AllUseLlmOptions[T]["input"]): BaseLlm;
|
|
1631
2024
|
declare function useLlmConfiguration<T extends keyof typeof configs>(config: Config<any>): (options?: AllUseLlmOptions[T]["input"]) => {
|
|
1632
|
-
call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions) => Promise<{
|
|
2025
|
+
call: (messages: string | IChatMessages, options?: LlmExecutorWithFunctionsOptions, context?: ExecutionContext) => Promise<{
|
|
1633
2026
|
getResultContent: (index?: number) => OutputResultContent[];
|
|
1634
2027
|
getResultText: (index?: number) => string;
|
|
1635
2028
|
getResult: () => OutputResult;
|
|
@@ -1658,7 +2051,7 @@ declare function createOpenAiCompatibleConfiguration<K extends Config["key"]>(ov
|
|
|
1658
2051
|
}): Config<keyof AllLlm>;
|
|
1659
2052
|
|
|
1660
2053
|
declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, options: AllEmbedding[T]["input"]): {
|
|
1661
|
-
call: (messages: string | string[], options?: LlmExecutorWithFunctionsOptions) => Promise<{
|
|
2054
|
+
call: (messages: string | string[], options?: LlmExecutorWithFunctionsOptions, context?: ExecutionContext) => Promise<{
|
|
1662
2055
|
getEmbedding: (index?: number) => number[];
|
|
1663
2056
|
getResult: () => EmbeddingOutputResult;
|
|
1664
2057
|
}>;
|
|
@@ -1676,4 +2069,4 @@ declare function createEmbedding<T extends EmbeddingProviderKey>(provider: T, op
|
|
|
1676
2069
|
};
|
|
1677
2070
|
};
|
|
1678
2071
|
|
|
1679
|
-
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 };
|
|
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 };
|