Class: Nanobot::Providers::LLMProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/nanobot/providers/base.rb

Overview

Base class for LLM providers

Direct Known Subclasses

RubyLLMProvider

Instance Method Summary collapse

Instance Method Details

#chat(messages:, tools: nil, model: nil, max_tokens: 4096, temperature: 0.7) ⇒ LLMResponse

Chat with the LLM

Parameters:

  • messages (Array<Hash>) —

    array of message hashes with :role and :content

  • tools (Array<Hash>) (defaults to: nil) —

    array of tool definitions in OpenAI format

  • model (String) (defaults to: nil) —

    model identifier

  • max_tokens (Integer) (defaults to: 4096) —

    maximum tokens to generate

  • temperature (Float) (defaults to: 0.7) —

    sampling temperature

Returns:

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/nanobot/providers/base.rb', line 32

def chat(messages:, tools: nil, model: nil, max_tokens: 4096, temperature: 0.7)
  raise NotImplementedError, "#{self.class} must implement #chat"
end

#default_model ⇒ String

Get the default model for this provider

Returns:

  • (String)

Raises:

  • (NotImplementedError)


38
39
40
# File 'lib/nanobot/providers/base.rb', line 38

def default_model
  raise NotImplementedError, "#{self.class} must implement #default_model"
end