Class: Pikuri::Agent::ChatTransport

Inherits:
Object
  • Object
show all
Defined in:
lib/pikuri/agent/chat_transport.rb

Overview

The trio of arguments that has to travel together to RubyLLM.chat for model resolution to come out the same on every construction: the model id, the provider hint, and the registry-bypass flag.

Bundling them is structural protection against a recurring bug class — every forwarding site (the synthesizer rescue in #run_loop, Tool::SubAgent spawning a sub-agent) used to pass the three individually, and dropping one routed the spawned chat to a different server or raised RubyLLM::ModelNotFoundError on the unknown model id. With a single value object the call site can’t silently miss a field.

Pure data carrier: no RubyLLM references here, so the seam stays in Pikuri::Agent, bin/pikuri-chat, and Tool.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model:, provider: nil, assume_model_exists: false) ⇒ ChatTransport

Returns a new instance of ChatTransport.

Parameters:

  • model (String, nil)
  • provider (Symbol, nil) (defaults to: nil)
  • assume_model_exists (Boolean) (defaults to: false)


36
37
38
# File 'lib/pikuri/agent/chat_transport.rb', line 36

def initialize(model:, provider: nil, assume_model_exists: false)
  super
end

Instance Attribute Details

#assume_model_existsBoolean (readonly)

Returns forwarded to RubyLLM.chat; true skips ruby_llm’s registry lookup and trusts the supplied model id. Requires provider.

Returns:

  • (Boolean)

    forwarded to RubyLLM.chat; true skips ruby_llm’s registry lookup and trusts the supplied model id. Requires provider.



32
33
34
35
36
37
38
39
# File 'lib/pikuri/agent/chat_transport.rb', line 32

class ChatTransport < Data.define(:model, :provider, :assume_model_exists)
  # @param model [String, nil]
  # @param provider [Symbol, nil]
  # @param assume_model_exists [Boolean]
  def initialize(model:, provider: nil, assume_model_exists: false)
    super
  end
end

#modelString? (readonly)

Returns LLM identifier; nil defers to RubyLLM.config.default_model at Pikuri::Agent construction time.

Returns:

  • (String, nil)

    LLM identifier; nil defers to RubyLLM.config.default_model at Pikuri::Agent construction time



32
33
34
35
36
37
38
39
# File 'lib/pikuri/agent/chat_transport.rb', line 32

class ChatTransport < Data.define(:model, :provider, :assume_model_exists)
  # @param model [String, nil]
  # @param provider [Symbol, nil]
  # @param assume_model_exists [Boolean]
  def initialize(model:, provider: nil, assume_model_exists: false)
    super
  end
end

#providerSymbol? (readonly)

Returns forwarded to RubyLLM.chat. Required together with assume_model_exists when pointing at a local OpenAI-compatible server (llama.cpp, gpustack, …) whose model ids are not in ruby_llm’s bundled registry.

Returns:

  • (Symbol, nil)

    forwarded to RubyLLM.chat. Required together with assume_model_exists when pointing at a local OpenAI-compatible server (llama.cpp, gpustack, …) whose model ids are not in ruby_llm’s bundled registry.



32
33
34
35
36
37
38
39
# File 'lib/pikuri/agent/chat_transport.rb', line 32

class ChatTransport < Data.define(:model, :provider, :assume_model_exists)
  # @param model [String, nil]
  # @param provider [Symbol, nil]
  # @param assume_model_exists [Boolean]
  def initialize(model:, provider: nil, assume_model_exists: false)
    super
  end
end