Documentation
¶
Overview ¶
Package toolcfg checks a request's tools and tool choice against the rules the model providers enforce, so an adapter refuses a setup the provider would answer with a 400 before sending it, with an agent.ErrConfig that says what is wrong.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( OpenAIName = regexp.MustCompile(`^[a-zA-Z0-9_-]{1,64}$`) AnthropicName = regexp.MustCompile(`^[a-zA-Z0-9_-]{1,64}$`) GeminiName = regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_.:-]{0,63}$`) )
OpenAIName and AnthropicName are the tool-name patterns OpenAI and Anthropic document. GeminiName is Gemini's: it also allows dots and colons, but must start with a letter or an underscore.
Functions ¶
func Check ¶
Check validates req for provider, whose tool names must match name. Every tool name must match and be unique; a tool choice must have a known mode, and "required" or "tool" needs declared tools, "tool" naming one of them. send reports whether the adapter should send req.ToolChoice at all: "auto" or "none" with no tools declared is already met, and the providers reject a tool choice with no tools, so it is left out.
Types ¶
This section is empty.