Generic functions that use the "hidden tool" technique to force models to return structured JSON matching a Go struct's schema, replacing the verbose "tool as structured output" pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
21 lines
799 B
Go
21 lines
799 B
Go
package llm
|
|
|
|
import "errors"
|
|
|
|
var (
|
|
// ErrNoToolsConfigured is returned when the model requests tool calls but no tools are available.
|
|
ErrNoToolsConfigured = errors.New("model requested tool calls but no tools configured")
|
|
|
|
// ErrToolNotFound is returned when a requested tool is not in the toolbox.
|
|
ErrToolNotFound = errors.New("tool not found")
|
|
|
|
// ErrNotConnected is returned when trying to use an MCP server that isn't connected.
|
|
ErrNotConnected = errors.New("MCP server not connected")
|
|
|
|
// ErrStreamClosed is returned when trying to read from a closed stream.
|
|
ErrStreamClosed = errors.New("stream closed")
|
|
|
|
// ErrNoStructuredOutput is returned when the model did not return a structured output tool call.
|
|
ErrNoStructuredOutput = errors.New("model did not return structured output")
|
|
)
|