-
Notifications
You must be signed in to change notification settings - Fork 15.1k
feature: Support custom tool parsers #2917
Description
AI SDK provides a capability to allow custom tool parsers documented - https://ai-sdk.dev/docs/ai-sdk-core/middleware#custom-tool-call-parser
Can this be implemented? Maybe atleast the @ai-sdk-tool/parser package. It offers three middlewares OOB
gemmaToolMiddleware: JSON tool calls inside markdown fences. Best for Gemma-like models.
morphXmlToolMiddleware: Plain XML tool calls. Good fit for GLM/GLM-like models.
hermesToolMiddleware: JSON payload wrapped in <tool_call> XML tags. Hermes/Llama-style prompts.
This will allow Opencode to be compatible with a lot of locally hosted models.
It can be an option to set a middleware as part of custom providers configuration for a model. Initially could be just one of these 3 above, maybe down the line a way of providing our own like plugins / custom tools.