Module: ActiveAgent

Extended by:
ActiveSupport::Autoload
Defined in:
lib/active_agent/base.rb,
lib/active_agent.rb,
lib/active_agent/preview.rb,
lib/active_agent/railtie.rb,
lib/active_agent/service.rb,
lib/active_agent/version.rb,
lib/active_agent/callbacks.rb,
lib/active_agent/operation.rb,
lib/active_agent/rescuable.rb,
lib/active_agent/deprecator.rb,
lib/active_agent/generation.rb,
lib/active_agent/action_prompt.rb,
lib/active_agent/parameterized.rb,
lib/active_agent/prompt_helper.rb,
lib/active_agent/generation_job.rb,
lib/active_agent/queued_generation.rb,
lib/active_agent/generation_methods.rb,
lib/active_agent/generation_provider.rb,
lib/active_agent/action_prompt/prompt.rb,
lib/active_agent/action_prompt/message.rb,
lib/active_agent/action_prompt/collector.rb,
lib/active_agent/generation_provider/base.rb,
lib/active_agent/inline_preview_interceptor.rb,
lib/generators/active_agent/agent_generator.rb,
lib/active_agent/generation_provider/response.rb,
lib/active_agent/generation_provider/open_ai_provider.rb

Overview

lib/active_agent/generation_provider/base.rb

Defined Under Namespace

Modules: ActionPrompt, Callbacks, GenerationMethods, GenerationProvider, Generators, Parameterized, Previews, PromptHelper, QueuedGeneration, Rescuable Classes: Base, Generation, GenerationJob, InlinePreviewInterceptor, Operation, Preview, Railtie, Service

Constant Summary collapse

VERSION =
"0.1.1"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



35
36
37
# File 'lib/active_agent.rb', line 35

def config
  @config
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (ActiveAgent)

    the object that the method was called on



45
46
47
# File 'lib/active_agent.rb', line 45

def configure
  yield self
end

.deprecatorObject

:nodoc:



4
5
6
# File 'lib/active_agent/deprecator.rb', line 4

def self.deprecator # :nodoc:
  @deprecator ||= ActiveSupport::Deprecation.new
end

.eager_load!Object



37
38
39
40
41
42
43
# File 'lib/active_agent.rb', line 37

def eager_load!
  super

  Base.descendants.each do |agent|
    agent.eager_load! unless agent.abstract?
  end
end

.load_configuration(file) ⇒ Object



49
50
51
52
53
# File 'lib/active_agent.rb', line 49

def load_configuration(file)
  config_file = YAML.load_file(file, aliases: true)
  env = ENV["RAILS_ENV"] || ENV["ENV"] || "development"
  @config = config_file[env] || config_file
end