class Ollama::Tool

)
)
)
required: %w[location]
properties: { location: property },
type: ‘object’,
parameters: Ollama::Tool::Function::Parameters.new(
description: ‘Get the current weather for a location’,
name: ‘get_current_weather’,
function: Ollama::Tool::Function.new(
type: ‘function’,
tool = Ollama::Tool.new(
@example Creating a tool with a function definition
description, parameters, and required fields.
of tool and the associated function definition, which specifies the tool’s name,
passed to models to enable function calling capabilities. It includes the type
This class encapsulates the structure required for defining tools that can be
Represents a tool definition used in interactions with the Ollama API.

def initialize(type:, function:)

Parameters:
  • function (Ollama::Tool::Function) -- the function definition
  • type (String) -- the type of tool being created
def initialize(type:, function:)
  @type, @function = type, function.to_hash
end