Module: LLM::ActiveRecord::ActsAsAgent::InstanceMethods

Defined in:
lib/llm/active_record/acts_as_agent.rb

Instance Method Summary collapse

Instance Method Details

#llm ⇒ LLM::Provider

Returns the resolved provider instance for this record.

Returns:



112
113
114
115
116
117
118
# File 'lib/llm/active_record/acts_as_agent.rb', line 112

def llm
  options = self.class.llm_plugin_options
  return @llm if @llm
  @llm = Utils.resolve_provider(self, options, EMPTY_HASH)
  @llm.tracer = Utils.resolve_option(self, options[:tracer]) if options[:tracer]
  @llm
end

#console(**params) Also known as: repl

Note:

This method does not persist to the database, but it can inspect and alter runtime state in a way that is temporary.

This method returns an undefined value.

Parameters:

  • name (String) —

    The agent's name. Defaults to LLM::Agent#name.

  • path (String) —

    The path to a file where runtime state is read from, and written to

  • tools (Array<LLM::Tool>) —

    Extra tools to attach for the console session

  • tracer (Boolean) —

    When true, the tracer is kept alive during the console session. Default is false.



127
128
129
# File 'lib/llm/active_record/acts_as_agent.rb', line 127

def console(**params)
  __context__.console(**params)
end