Module: RubyLLM::Skills::AgentExtensions::ClassMethods
- Defined in:
- lib/ruby_llm/skills/agent_extensions.rb
Class Method Summary collapse
Instance Method Summary collapse
- #inherited(subclass) ⇒ Object
-
#skills(*sources, only: nil, &block) ⇒ Hash
Declare skill sources for this agent class.
Class Method Details
.extended(base) ⇒ Object
22 23 24 25 |
# File 'lib/ruby_llm/skills/agent_extensions.rb', line 22 def self.extended(base) base.instance_variable_set(:@skill_sources, nil) base.instance_variable_set(:@skill_only, nil) end |
Instance Method Details
#inherited(subclass) ⇒ Object
27 28 29 30 31 |
# File 'lib/ruby_llm/skills/agent_extensions.rb', line 27 def inherited(subclass) super subclass.instance_variable_set(:@skill_sources, @skill_sources.is_a?(Proc) ? @skill_sources : @skill_sources&.dup) subclass.instance_variable_set(:@skill_only, @skill_only&.dup) end |
#skills(*sources, only: nil, &block) ⇒ Hash
Declare skill sources for this agent class.
Called with no arguments, returns the current configuration. Called with sources or a block, sets the configuration.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ruby_llm/skills/agent_extensions.rb', line 41 def skills(*sources, only: nil, &block) if sources.empty? && only.nil? && !block_given? return { sources: @skill_sources.is_a?(Proc) ? @skill_sources : @skill_sources&.dup, only: @skill_only&.dup } end @skill_sources = block_given? ? block : normalize_skill_sources(sources) @skill_only = only&.dup end |