Module: LLM::Sequel::Agent
- Defined in:
- lib/llm/sequel/agent.rb
Overview
Sequel plugin for persisting LLM::Agent state.
This wrapper reuses the same record-backed runtime surface as Plugin, but builds an LLM::Agent instead of an LLM::Context. Agent defaults such as model, tools, schema, instructions, and concurrency are configured on the model class and forwarded to an internal agent subclass.
Defined Under Namespace
Modules: ClassMethods, InstanceMethods
Constant Summary collapse
- EMPTY_HASH =
LLM::Sequel::Plugin::EMPTY_HASH
- DEFAULTS =
LLM::Sequel::Plugin::DEFAULTS
- Utils =
LLM::Sequel::Plugin::Utils
Class Method Summary collapse
Class Method Details
.apply(model) ⇒ Object
18 19 20 21 22 |
# File 'lib/llm/sequel/agent.rb', line 18 def self.apply(model, **) model.extend ClassMethods model.include LLM::Sequel::Plugin::InstanceMethods model.include InstanceMethods end |
.configure(model, options = EMPTY_HASH, &block) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/llm/sequel/agent.rb', line 24 def self.configure(model, = EMPTY_HASH, &block) = DEFAULTS.merge() model.db.extension :pg_json if %i[json jsonb].include?([:format]) model.instance_variable_set(:@llm_agent_options, .freeze) model.instance_exec(&block) if block end |