@ai-sdk-tool/parser 2.1.1 → 2.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/dist/index.cjs +796 -561
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -14
- package/dist/index.d.ts +15 -14
- package/dist/index.js +796 -557
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -102,13 +102,17 @@ interface ToolCallProtocol {
|
|
|
102
102
|
onError?: (message: string, metadata?: Record<string, unknown>) => void;
|
|
103
103
|
};
|
|
104
104
|
}): TransformStream<LanguageModelV2StreamPart, LanguageModelV2StreamPart>;
|
|
105
|
+
/**
|
|
106
|
+
* Optionally returns the exact substrings that would be parsed as tool-calls
|
|
107
|
+
* from the provided text for this protocol.
|
|
108
|
+
* Used for debug logging in parse mode.
|
|
109
|
+
*/
|
|
110
|
+
extractToolCallSegments?: ({ text, tools, }: {
|
|
111
|
+
text: string;
|
|
112
|
+
tools: LanguageModelV2FunctionTool[];
|
|
113
|
+
}) => string[];
|
|
105
114
|
}
|
|
106
115
|
|
|
107
|
-
declare function createToolMiddleware({ protocol, toolSystemPromptTemplate, }: {
|
|
108
|
-
protocol: ToolCallProtocol | (() => ToolCallProtocol);
|
|
109
|
-
toolSystemPromptTemplate: (tools: string) => string;
|
|
110
|
-
}): LanguageModelV2Middleware;
|
|
111
|
-
|
|
112
116
|
type JsonMixOptions = {
|
|
113
117
|
toolCallStart?: string;
|
|
114
118
|
toolCallEnd?: string;
|
|
@@ -117,18 +121,15 @@ type JsonMixOptions = {
|
|
|
117
121
|
};
|
|
118
122
|
declare const jsonMixProtocol: ({ toolCallStart, toolCallEnd, toolResponseStart, toolResponseEnd, }?: JsonMixOptions) => ToolCallProtocol;
|
|
119
123
|
|
|
120
|
-
declare const
|
|
124
|
+
declare const morphXmlProtocol: () => ToolCallProtocol;
|
|
121
125
|
|
|
122
|
-
declare function
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
name?: string;
|
|
127
|
-
inputSchema?: unknown;
|
|
128
|
-
}>): LanguageModelV2Content;
|
|
126
|
+
declare function createToolMiddleware({ protocol, toolSystemPromptTemplate, }: {
|
|
127
|
+
protocol: ToolCallProtocol | (() => ToolCallProtocol);
|
|
128
|
+
toolSystemPromptTemplate: (tools: string) => string;
|
|
129
|
+
}): LanguageModelV2Middleware;
|
|
129
130
|
|
|
130
131
|
declare const gemmaToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
131
132
|
declare const hermesToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
132
133
|
declare const xmlToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
133
134
|
|
|
134
|
-
export {
|
|
135
|
+
export { createToolMiddleware, gemmaToolMiddleware, hermesToolMiddleware, jsonMixProtocol, morphXmlProtocol, xmlToolMiddleware };
|
package/dist/index.d.ts
CHANGED
|
@@ -102,13 +102,17 @@ interface ToolCallProtocol {
|
|
|
102
102
|
onError?: (message: string, metadata?: Record<string, unknown>) => void;
|
|
103
103
|
};
|
|
104
104
|
}): TransformStream<LanguageModelV2StreamPart, LanguageModelV2StreamPart>;
|
|
105
|
+
/**
|
|
106
|
+
* Optionally returns the exact substrings that would be parsed as tool-calls
|
|
107
|
+
* from the provided text for this protocol.
|
|
108
|
+
* Used for debug logging in parse mode.
|
|
109
|
+
*/
|
|
110
|
+
extractToolCallSegments?: ({ text, tools, }: {
|
|
111
|
+
text: string;
|
|
112
|
+
tools: LanguageModelV2FunctionTool[];
|
|
113
|
+
}) => string[];
|
|
105
114
|
}
|
|
106
115
|
|
|
107
|
-
declare function createToolMiddleware({ protocol, toolSystemPromptTemplate, }: {
|
|
108
|
-
protocol: ToolCallProtocol | (() => ToolCallProtocol);
|
|
109
|
-
toolSystemPromptTemplate: (tools: string) => string;
|
|
110
|
-
}): LanguageModelV2Middleware;
|
|
111
|
-
|
|
112
116
|
type JsonMixOptions = {
|
|
113
117
|
toolCallStart?: string;
|
|
114
118
|
toolCallEnd?: string;
|
|
@@ -117,18 +121,15 @@ type JsonMixOptions = {
|
|
|
117
121
|
};
|
|
118
122
|
declare const jsonMixProtocol: ({ toolCallStart, toolCallEnd, toolResponseStart, toolResponseEnd, }?: JsonMixOptions) => ToolCallProtocol;
|
|
119
123
|
|
|
120
|
-
declare const
|
|
124
|
+
declare const morphXmlProtocol: () => ToolCallProtocol;
|
|
121
125
|
|
|
122
|
-
declare function
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
name?: string;
|
|
127
|
-
inputSchema?: unknown;
|
|
128
|
-
}>): LanguageModelV2Content;
|
|
126
|
+
declare function createToolMiddleware({ protocol, toolSystemPromptTemplate, }: {
|
|
127
|
+
protocol: ToolCallProtocol | (() => ToolCallProtocol);
|
|
128
|
+
toolSystemPromptTemplate: (tools: string) => string;
|
|
129
|
+
}): LanguageModelV2Middleware;
|
|
129
130
|
|
|
130
131
|
declare const gemmaToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
131
132
|
declare const hermesToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
132
133
|
declare const xmlToolMiddleware: _ai_sdk_provider.LanguageModelV2Middleware;
|
|
133
134
|
|
|
134
|
-
export {
|
|
135
|
+
export { createToolMiddleware, gemmaToolMiddleware, hermesToolMiddleware, jsonMixProtocol, morphXmlProtocol, xmlToolMiddleware };
|