You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add community XML tools and reorganize parsers (#85)
* Add community XML tools and reorganize parsers
* Update middleware references from `xmlToolMiddleware` to `morphXmlToolMiddleware` across documentation and examples for consistency and clarity.
* Update packages/parser/src/community/index.ts
Co-authored-by: Copilot <[email protected]>
* Fix typo in middleware reference from `sijawaraConsiseXmlToolMiddleware` to `sijawaraConciseXmlToolMiddleware` in example and community index files for consistency.
* fix: update morphXmlProtocol to enhance HTML tag handling
- Disabled self-closing tag behavior for HTML elements in the morphXmlProtocol, ensuring they are treated as regular tags.
- This change improves the parsing accuracy of XML tool calls by accommodating standard HTML tag structures.
* chore: attribute co-author
Co-authored-by: sijawara <[email protected]>
---------
Co-authored-by: Copilot <[email protected]>
Co-authored-by: sijawara <[email protected]>
-**Middleware switch**: parser examples show how to swap between `xmlToolMiddleware` and `gemmaToolMiddleware` via commented lines. Choose a provider/model your account can access.
41
+
-**Middleware switch**: parser examples show how to swap between `morphXmlToolMiddleware` and `gemmaToolMiddleware` via commented lines. Choose a provider/model your account can access.
42
42
-**Providers**: OpenRouter base URL is `https://openrouter.ai/api/v1`. Friendli serverless base URL is `https://api.friendli.ai/serverless/v1`.
43
43
-**Streaming vs non‑streaming**: `00-stream-tool-call.ts` uses streaming (`streamText`), while `00-tool-call.ts` is non‑streaming (`generateText`).
Copy file name to clipboardExpand all lines: docs/guides/tool-calling.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Use the middleware to enable tool calls on models without native `tools` support
6
6
7
7
-`gemmaToolMiddleware` — JSON-mix in markdown fences (```tool_call)
8
8
-`hermesToolMiddleware` — JSON-mix with XML wrappers (<tool_call>)
9
-
-`xmlToolMiddleware` — Morph-XML protocol (native XML elements per tool name)
9
+
-`morphXmlToolMiddleware` — Morph-XML protocol (native XML elements per tool name)
10
10
11
11
## Generate mode
12
12
@@ -112,7 +112,7 @@ Set env variables:
112
112
-`hermesToolMiddleware` (JSON-mix with `<tool_call>`):
113
113
- System prompt describes `<tools>` block and requires returning JSON inside `<tool_call> ... </tool_call>` tags.
114
114
- Tool responses are formatted with `<tool_response>` tags.
115
-
-`xmlToolMiddleware` (Morph-XML):
115
+
-`morphXmlToolMiddleware` (Morph-XML):
116
116
- Tool call must be an XML element named after the tool (e.g., `<get_weather>...</get_weather>`).
117
117
- Arguments are parsed by RXML (Robust XML) via `RXML.parse` and then coerced via JSON Schema. On parse/coercion issues, the protocol falls back to emitting the original text and reports via `options.onError`.
118
118
- To improve coercion accuracy, pass `originalToolSchemas` under `providerOptions.toolCallMiddleware`.
0 commit comments