LlmCall.ToolSpec (llm_call v0.4.0)

Copy Markdown View Source

A tool the model may call.

parameters is a JSON Schema object, not a JSON string, and must already be in the selected codec's dialect. The Gemini codec validates its OpenAPI subset and returns a :validation error for constructs it cannot send, such as a lowercase type, additionalProperties, $ref/$defs, prefixItems, oneOf, const, allOf or not. kind: :builtin is for provider-defined tools such as web search or code interpreter, whose native definition lives in provider_options.

strict is optional and codec-specific. OpenAI's requirement that a strict schema be closed cannot be checked from the rendered map, so a mismatch remains a provider error; Gemini rejects strict because it has no per-tool flag.

Summary

Types

kind()

@type kind() :: :function | :builtin

t()

@type t() :: %LlmCall.ToolSpec{
  description: String.t() | nil,
  kind: kind(),
  name: String.t() | nil,
  parameters: map() | nil,
  provider_options: map(),
  strict: boolean() | nil
}