@ai-sdk-tool/parser 2.1.4 → 2.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.cjs +200 -331
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -19
- package/dist/index.d.ts +32 -19
- package/dist/index.js +186 -332
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -267,18 +267,6 @@ declare namespace robustJson {
|
|
|
267
267
|
export { type robustJson_ParseOptions as ParseOptions, robustJson_parse as parse, robustJson_stringify as stringify, robustJson_transform as transform };
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
declare function unwrapJsonSchema(schema: unknown): unknown;
|
|
271
|
-
declare function getSchemaType(schema: unknown): string | undefined;
|
|
272
|
-
declare function coerceBySchema(value: unknown, schema?: unknown): unknown;
|
|
273
|
-
declare function fixToolCallWithSchema(part: LanguageModelV2Content, tools: Array<{
|
|
274
|
-
name?: string;
|
|
275
|
-
inputSchema?: unknown;
|
|
276
|
-
}>): LanguageModelV2Content;
|
|
277
|
-
declare function coerceToolCallInput(part: LanguageModelV2Content, tools: Array<{
|
|
278
|
-
name?: string;
|
|
279
|
-
inputSchema?: unknown;
|
|
280
|
-
}>): LanguageModelV2Content;
|
|
281
|
-
|
|
282
270
|
type DebugLevel = "off" | "stream" | "parse";
|
|
283
271
|
declare function getDebugLevel(): DebugLevel;
|
|
284
272
|
declare function logRawChunk(part: unknown): void;
|
|
@@ -293,6 +281,37 @@ declare function extractOnErrorOption(providerOptions?: unknown): {
|
|
|
293
281
|
onError?: OnErrorFn;
|
|
294
282
|
} | undefined;
|
|
295
283
|
|
|
284
|
+
type ToolCallMiddlewareProviderOptions = {
|
|
285
|
+
toolCallMiddleware?: {
|
|
286
|
+
debugSummary?: {
|
|
287
|
+
originalText?: string;
|
|
288
|
+
toolCalls?: string;
|
|
289
|
+
};
|
|
290
|
+
toolChoice?: {
|
|
291
|
+
type: string;
|
|
292
|
+
};
|
|
293
|
+
originalTools?: Array<{
|
|
294
|
+
name: string;
|
|
295
|
+
inputSchema: string;
|
|
296
|
+
}>;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
declare const originalToolsSchema: {
|
|
300
|
+
encode: typeof encodeOriginalTools;
|
|
301
|
+
decode: typeof decodeOriginalTools;
|
|
302
|
+
};
|
|
303
|
+
declare function encodeOriginalTools(tools: LanguageModelV2FunctionTool[] | undefined): Array<{
|
|
304
|
+
name: string;
|
|
305
|
+
inputSchema: string;
|
|
306
|
+
}>;
|
|
307
|
+
declare function decodeOriginalTools(originalTools: Array<{
|
|
308
|
+
name: string;
|
|
309
|
+
inputSchema: string;
|
|
310
|
+
}> | undefined): LanguageModelV2FunctionTool[];
|
|
311
|
+
declare function extractToolNamesFromOriginalTools(originalTools: Array<{
|
|
312
|
+
name: string;
|
|
313
|
+
inputSchema: string;
|
|
314
|
+
}> | undefined): string[];
|
|
296
315
|
declare function isToolChoiceActive(params: {
|
|
297
316
|
providerOptions?: {
|
|
298
317
|
toolCallMiddleware?: {
|
|
@@ -302,12 +321,6 @@ declare function isToolChoiceActive(params: {
|
|
|
302
321
|
};
|
|
303
322
|
};
|
|
304
323
|
}): boolean;
|
|
305
|
-
declare function getFunctionTools(params: {
|
|
306
|
-
tools?: Array<LanguageModelV2FunctionTool | {
|
|
307
|
-
type: string;
|
|
308
|
-
}>;
|
|
309
|
-
providerOptions?: unknown;
|
|
310
|
-
}): LanguageModelV2FunctionTool[];
|
|
311
324
|
|
|
312
325
|
declare function isToolCallContent(content: unknown): content is LanguageModelV2ToolCall;
|
|
313
326
|
declare function isToolResultPart(content: unknown): content is LanguageModelV2ToolResultPart;
|
|
@@ -319,4 +332,4 @@ declare const gemmaToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
|
319
332
|
declare const hermesToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
320
333
|
declare const xmlToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
321
334
|
|
|
322
|
-
export { type DebugLevel, type OnErrorFn, robustJson as RJSON,
|
|
335
|
+
export { type DebugLevel, type OnErrorFn, robustJson as RJSON, type ToolCallMiddlewareProviderOptions, createDynamicIfThenElseSchema, createToolMiddleware, decodeOriginalTools, encodeOriginalTools, escapeRegExp, extractOnErrorOption, extractToolNamesFromOriginalTools, gemmaToolMiddleware, getDebugLevel, getPotentialStartIndex, hasInputProperty, hermesToolMiddleware, isToolCallContent, isToolChoiceActive, isToolResultPart, jsonMixProtocol, logParsedChunk, logParsedSummary, logRawChunk, morphXmlProtocol, originalToolsSchema, xmlToolMiddleware };
|
package/dist/index.d.ts
CHANGED
|
@@ -267,18 +267,6 @@ declare namespace robustJson {
|
|
|
267
267
|
export { type robustJson_ParseOptions as ParseOptions, robustJson_parse as parse, robustJson_stringify as stringify, robustJson_transform as transform };
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
-
declare function unwrapJsonSchema(schema: unknown): unknown;
|
|
271
|
-
declare function getSchemaType(schema: unknown): string | undefined;
|
|
272
|
-
declare function coerceBySchema(value: unknown, schema?: unknown): unknown;
|
|
273
|
-
declare function fixToolCallWithSchema(part: LanguageModelV2Content, tools: Array<{
|
|
274
|
-
name?: string;
|
|
275
|
-
inputSchema?: unknown;
|
|
276
|
-
}>): LanguageModelV2Content;
|
|
277
|
-
declare function coerceToolCallInput(part: LanguageModelV2Content, tools: Array<{
|
|
278
|
-
name?: string;
|
|
279
|
-
inputSchema?: unknown;
|
|
280
|
-
}>): LanguageModelV2Content;
|
|
281
|
-
|
|
282
270
|
type DebugLevel = "off" | "stream" | "parse";
|
|
283
271
|
declare function getDebugLevel(): DebugLevel;
|
|
284
272
|
declare function logRawChunk(part: unknown): void;
|
|
@@ -293,6 +281,37 @@ declare function extractOnErrorOption(providerOptions?: unknown): {
|
|
|
293
281
|
onError?: OnErrorFn;
|
|
294
282
|
} | undefined;
|
|
295
283
|
|
|
284
|
+
type ToolCallMiddlewareProviderOptions = {
|
|
285
|
+
toolCallMiddleware?: {
|
|
286
|
+
debugSummary?: {
|
|
287
|
+
originalText?: string;
|
|
288
|
+
toolCalls?: string;
|
|
289
|
+
};
|
|
290
|
+
toolChoice?: {
|
|
291
|
+
type: string;
|
|
292
|
+
};
|
|
293
|
+
originalTools?: Array<{
|
|
294
|
+
name: string;
|
|
295
|
+
inputSchema: string;
|
|
296
|
+
}>;
|
|
297
|
+
};
|
|
298
|
+
};
|
|
299
|
+
declare const originalToolsSchema: {
|
|
300
|
+
encode: typeof encodeOriginalTools;
|
|
301
|
+
decode: typeof decodeOriginalTools;
|
|
302
|
+
};
|
|
303
|
+
declare function encodeOriginalTools(tools: LanguageModelV2FunctionTool[] | undefined): Array<{
|
|
304
|
+
name: string;
|
|
305
|
+
inputSchema: string;
|
|
306
|
+
}>;
|
|
307
|
+
declare function decodeOriginalTools(originalTools: Array<{
|
|
308
|
+
name: string;
|
|
309
|
+
inputSchema: string;
|
|
310
|
+
}> | undefined): LanguageModelV2FunctionTool[];
|
|
311
|
+
declare function extractToolNamesFromOriginalTools(originalTools: Array<{
|
|
312
|
+
name: string;
|
|
313
|
+
inputSchema: string;
|
|
314
|
+
}> | undefined): string[];
|
|
296
315
|
declare function isToolChoiceActive(params: {
|
|
297
316
|
providerOptions?: {
|
|
298
317
|
toolCallMiddleware?: {
|
|
@@ -302,12 +321,6 @@ declare function isToolChoiceActive(params: {
|
|
|
302
321
|
};
|
|
303
322
|
};
|
|
304
323
|
}): boolean;
|
|
305
|
-
declare function getFunctionTools(params: {
|
|
306
|
-
tools?: Array<LanguageModelV2FunctionTool | {
|
|
307
|
-
type: string;
|
|
308
|
-
}>;
|
|
309
|
-
providerOptions?: unknown;
|
|
310
|
-
}): LanguageModelV2FunctionTool[];
|
|
311
324
|
|
|
312
325
|
declare function isToolCallContent(content: unknown): content is LanguageModelV2ToolCall;
|
|
313
326
|
declare function isToolResultPart(content: unknown): content is LanguageModelV2ToolResultPart;
|
|
@@ -319,4 +332,4 @@ declare const gemmaToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
|
319
332
|
declare const hermesToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
320
333
|
declare const xmlToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
321
334
|
|
|
322
|
-
export { type DebugLevel, type OnErrorFn, robustJson as RJSON,
|
|
335
|
+
export { type DebugLevel, type OnErrorFn, robustJson as RJSON, type ToolCallMiddlewareProviderOptions, createDynamicIfThenElseSchema, createToolMiddleware, decodeOriginalTools, encodeOriginalTools, escapeRegExp, extractOnErrorOption, extractToolNamesFromOriginalTools, gemmaToolMiddleware, getDebugLevel, getPotentialStartIndex, hasInputProperty, hermesToolMiddleware, isToolCallContent, isToolChoiceActive, isToolResultPart, jsonMixProtocol, logParsedChunk, logParsedSummary, logRawChunk, morphXmlProtocol, originalToolsSchema, xmlToolMiddleware };
|