Module: OllamaChat::Tools

Defined in:
lib/ollama_chat/tools.rb

Overview

A module that provides tool registration and management for OllamaChat.

The Tools module serves as a registry for available tools that can be invoked during chat conversations. It maintains a collection of registered tools and provides methods for registering new tools and accessing the complete set of available tools for use in chat interactions.

Defined Under Namespace

Classes: CVE, DirectoryStructure, EndOfLife, FileContext, Location, Weather

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.registeredHash

The registered attribute reader

Returns:

  • (Hash)

    the registered tools hash containing all available tools



12
13
14
# File 'lib/ollama_chat/tools.rb', line 12

def registered
  @registered
end

Class Method Details

.register(tool) ⇒ Class

The register method adds a tool to the registry.

Parameters:

  • tool (Object)

    the tool to be registered

Returns:

  • (Class)

    the class itself



19
20
21
22
23
# File 'lib/ollama_chat/tools.rb', line 19

def register(tool)
  tool = tool.new if tool.is_a?(Class)
  registered[tool.name] = tool
  self
end