Class: AIA::RubyLLMAdapter

Inherits:
Object
  • Object
show all
Includes:
Adapter::ChatExecution, Adapter::ErrorHandler, Adapter::ModalityHandlers, Adapter::MultiModelChat
Defined in:
lib/aia/ruby_llm_adapter.rb

Constant Summary collapse

MultiModelResponse =

Re-export for backward compatibility (tests reference AIA::RubyLLMAdapter::MultiModelResponse)

Adapter::MultiModelChat::MultiModelResponse

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Adapter::ErrorHandler

#handle_tool_crash, #repair_incomplete_tool_calls

Methods included from Adapter::ModalityHandlers

#speak, #transcribe

Methods included from Adapter::MultiModelChat

#build_consensus_prompt, #format_individual_responses, #format_model_display_name, #format_multi_model_results, #format_multi_model_with_metrics, #generate_consensus_response, #multi_model_chat, #prepend_model_role, #prepend_role_to_conversation, #should_use_consensus_mode?

Methods included from Adapter::ChatExecution

#chat, #clear_context, #create_isolated_context_for_model, #extract_model_and_provider, #setup_chats_with_tools, #single_model_chat, #validate_lms_model!

Constructor Details

#initializeRubyLLMAdapter

Returns a new instance of RubyLLMAdapter.



36
37
38
39
40
41
42
43
44
45
# File 'lib/aia/ruby_llm_adapter.rb', line 36

def initialize
  @model_specs = extract_models_config  # Full specs with role info
  @models = extract_model_names(@model_specs)  # Just model names for backward compat
  @chats = {}
  @contexts = {} # Store isolated contexts for each model

  Adapter::ProviderConfigurator.configure
  Adapter::ModelRegistry.new.refresh
  setup_chats_with_tools
end

Instance Attribute Details

#chatsObject (readonly)

Returns the value of attribute chats.



28
29
30
# File 'lib/aia/ruby_llm_adapter.rb', line 28

def chats
  @chats
end

#model_specsObject (readonly)

Returns the value of attribute model_specs.



28
29
30
# File 'lib/aia/ruby_llm_adapter.rb', line 28

def model_specs
  @model_specs
end

#toolsObject (readonly)

Returns the value of attribute tools.



28
29
30
# File 'lib/aia/ruby_llm_adapter.rb', line 28

def tools
  @tools
end

Instance Method Details

#modelObject

Delegates to the first chat instance’s model object. Used by single-model callers to inspect the active model.



32
33
34
# File 'lib/aia/ruby_llm_adapter.rb', line 32

def model
  @chats.values.first&.model
end