@ai-sdk-tool/parser 2.1.4 → 2.1.5
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 +147 -317
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -19
- package/dist/index.d.ts +28 -19
- package/dist/index.js +133 -318
- 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,33 @@ declare function extractOnErrorOption(providerOptions?: unknown): {
|
|
|
293
281
|
onError?: OnErrorFn;
|
|
294
282
|
} | undefined;
|
|
295
283
|
|
|
284
|
+
type ToolCallMiddlewareProviderOptions = {
|
|
285
|
+
toolCallMiddleware?: {
|
|
286
|
+
toolChoice?: {
|
|
287
|
+
type: string;
|
|
288
|
+
};
|
|
289
|
+
originalTools?: Array<{
|
|
290
|
+
name: string;
|
|
291
|
+
inputSchema: string;
|
|
292
|
+
}>;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
declare const originalToolsSchema: {
|
|
296
|
+
encode: typeof encodeOriginalTools;
|
|
297
|
+
decode: typeof decodeOriginalTools;
|
|
298
|
+
};
|
|
299
|
+
declare function encodeOriginalTools(tools: LanguageModelV2FunctionTool[] | undefined): Array<{
|
|
300
|
+
name: string;
|
|
301
|
+
inputSchema: string;
|
|
302
|
+
}>;
|
|
303
|
+
declare function decodeOriginalTools(originalTools: Array<{
|
|
304
|
+
name: string;
|
|
305
|
+
inputSchema: string;
|
|
306
|
+
}> | undefined): LanguageModelV2FunctionTool[];
|
|
307
|
+
declare function extractToolNamesFromOriginalTools(originalTools: Array<{
|
|
308
|
+
name: string;
|
|
309
|
+
inputSchema: string;
|
|
310
|
+
}> | undefined): string[];
|
|
296
311
|
declare function isToolChoiceActive(params: {
|
|
297
312
|
providerOptions?: {
|
|
298
313
|
toolCallMiddleware?: {
|
|
@@ -302,12 +317,6 @@ declare function isToolChoiceActive(params: {
|
|
|
302
317
|
};
|
|
303
318
|
};
|
|
304
319
|
}): boolean;
|
|
305
|
-
declare function getFunctionTools(params: {
|
|
306
|
-
tools?: Array<LanguageModelV2FunctionTool | {
|
|
307
|
-
type: string;
|
|
308
|
-
}>;
|
|
309
|
-
providerOptions?: unknown;
|
|
310
|
-
}): LanguageModelV2FunctionTool[];
|
|
311
320
|
|
|
312
321
|
declare function isToolCallContent(content: unknown): content is LanguageModelV2ToolCall;
|
|
313
322
|
declare function isToolResultPart(content: unknown): content is LanguageModelV2ToolResultPart;
|
|
@@ -319,4 +328,4 @@ declare const gemmaToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
|
319
328
|
declare const hermesToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
320
329
|
declare const xmlToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
321
330
|
|
|
322
|
-
export { type DebugLevel, type OnErrorFn, robustJson as RJSON,
|
|
331
|
+
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,33 @@ declare function extractOnErrorOption(providerOptions?: unknown): {
|
|
|
293
281
|
onError?: OnErrorFn;
|
|
294
282
|
} | undefined;
|
|
295
283
|
|
|
284
|
+
type ToolCallMiddlewareProviderOptions = {
|
|
285
|
+
toolCallMiddleware?: {
|
|
286
|
+
toolChoice?: {
|
|
287
|
+
type: string;
|
|
288
|
+
};
|
|
289
|
+
originalTools?: Array<{
|
|
290
|
+
name: string;
|
|
291
|
+
inputSchema: string;
|
|
292
|
+
}>;
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
declare const originalToolsSchema: {
|
|
296
|
+
encode: typeof encodeOriginalTools;
|
|
297
|
+
decode: typeof decodeOriginalTools;
|
|
298
|
+
};
|
|
299
|
+
declare function encodeOriginalTools(tools: LanguageModelV2FunctionTool[] | undefined): Array<{
|
|
300
|
+
name: string;
|
|
301
|
+
inputSchema: string;
|
|
302
|
+
}>;
|
|
303
|
+
declare function decodeOriginalTools(originalTools: Array<{
|
|
304
|
+
name: string;
|
|
305
|
+
inputSchema: string;
|
|
306
|
+
}> | undefined): LanguageModelV2FunctionTool[];
|
|
307
|
+
declare function extractToolNamesFromOriginalTools(originalTools: Array<{
|
|
308
|
+
name: string;
|
|
309
|
+
inputSchema: string;
|
|
310
|
+
}> | undefined): string[];
|
|
296
311
|
declare function isToolChoiceActive(params: {
|
|
297
312
|
providerOptions?: {
|
|
298
313
|
toolCallMiddleware?: {
|
|
@@ -302,12 +317,6 @@ declare function isToolChoiceActive(params: {
|
|
|
302
317
|
};
|
|
303
318
|
};
|
|
304
319
|
}): boolean;
|
|
305
|
-
declare function getFunctionTools(params: {
|
|
306
|
-
tools?: Array<LanguageModelV2FunctionTool | {
|
|
307
|
-
type: string;
|
|
308
|
-
}>;
|
|
309
|
-
providerOptions?: unknown;
|
|
310
|
-
}): LanguageModelV2FunctionTool[];
|
|
311
320
|
|
|
312
321
|
declare function isToolCallContent(content: unknown): content is LanguageModelV2ToolCall;
|
|
313
322
|
declare function isToolResultPart(content: unknown): content is LanguageModelV2ToolResultPart;
|
|
@@ -319,4 +328,4 @@ declare const gemmaToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
|
319
328
|
declare const hermesToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
320
329
|
declare const xmlToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
321
330
|
|
|
322
|
-
export { type DebugLevel, type OnErrorFn, robustJson as RJSON,
|
|
331
|
+
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 };
|