@ai-sdk-tool/parser 2.1.6 → 2.1.7

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.cjs CHANGED
@@ -28,8 +28,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
30
  // src/index.ts
31
- var index_exports = {};
32
- __export(index_exports, {
31
+ var src_exports = {};
32
+ __export(src_exports, {
33
33
  RJSON: () => robust_json_exports,
34
34
  createDynamicIfThenElseSchema: () => createDynamicIfThenElseSchema,
35
35
  createToolMiddleware: () => createToolMiddleware,
@@ -51,10 +51,10 @@ __export(index_exports, {
51
51
  logParsedSummary: () => logParsedSummary,
52
52
  logRawChunk: () => logRawChunk,
53
53
  morphXmlProtocol: () => morphXmlProtocol,
54
- originalToolsSchema: () => originalToolsSchema,
55
- xmlToolMiddleware: () => xmlToolMiddleware
54
+ morphXmlToolMiddleware: () => morphXmlToolMiddleware,
55
+ originalToolsSchema: () => originalToolsSchema
56
56
  });
57
- module.exports = __toCommonJS(index_exports);
57
+ module.exports = __toCommonJS(src_exports);
58
58
 
59
59
  // src/protocols/dummy-protocol.ts
60
60
  var import_provider_utils = require("@ai-sdk/provider-utils");
@@ -2068,21 +2068,26 @@ For each function call return a json object with function name and arguments wit
2068
2068
  </tool_call>`;
2069
2069
  }
2070
2070
  });
2071
- var xmlToolMiddleware = createToolMiddleware({
2071
+ var morphXmlToolMiddleware = createToolMiddleware({
2072
2072
  protocol: morphXmlProtocol,
2073
2073
  toolSystemPromptTemplate(tools) {
2074
2074
  return `You are a function calling AI model.
2075
- You are provided with function signatures within <tools></tools> XML tags.
2076
- You may call one or more functions to assist with the user query.
2077
- Don't make assumptions about what values to plug into functions.
2078
- Here are the available tools: <tools>${tools}</tools>
2079
- For a function call, return exactly one XML element whose tag name matches the tool's name, and nothing else.
2080
- When an argument is an array, write each item inside a single element on one line separated by commas (or provide a JSON-like list). When an argument is an object, provide a JSON-like value.
2081
- Examples:
2075
+
2076
+ Available functions are listed inside <tools></tools>.
2077
+ <tools>${tools}</tools>
2078
+
2079
+ # Rules
2080
+ - Use exactly one XML element whose tag name is the function name.
2081
+ - Put each parameter as a child element.
2082
+ - Values must follow the schema exactly (numbers, arrays, objects, enums \u2192 copy as-is).
2083
+ - Do not add or remove functions or parameters.
2084
+ - Each required parameter must appear once.
2085
+ - Output nothing before or after the function call.
2086
+
2087
+ # Example
2082
2088
  <get_weather>
2083
- <location>
2084
- San Francisco
2085
- </location>
2089
+ <location>New York</location>
2090
+ <unit>celsius</unit>
2086
2091
  </get_weather>`;
2087
2092
  }
2088
2093
  });
@@ -2109,7 +2114,7 @@ San Francisco
2109
2114
  logParsedSummary,
2110
2115
  logRawChunk,
2111
2116
  morphXmlProtocol,
2112
- originalToolsSchema,
2113
- xmlToolMiddleware
2117
+ morphXmlToolMiddleware,
2118
+ originalToolsSchema
2114
2119
  });
2115
2120
  //# sourceMappingURL=index.cjs.map