Module: LLM::Sequel::Plugin::InstanceMethods
- Defined in:
- lib/llm/sequel/plugin.rb
Instance Method Summary collapse
-
#call ⇒ Object
Calls into the stored context.
- #context_window ⇒ Integer
- #cost ⇒ LLM::Cost
- #functions ⇒ Array<LLM::Function>
- #messages ⇒ Array<LLM::Message>
- #model! ⇒ String
-
#respond ⇒ LLM::Response
Continues the stored context through the Responses API and flushes it.
-
#talk ⇒ LLM::Response
Continues the stored context with new input and flushes it.
-
#usage ⇒ LLM::Object
Returns usage from the mapped usage columns.
-
#wait ⇒ Array<LLM::Function::Return>
Waits for queued tool work to finish.
Instance Method Details
#call ⇒ Object
Calls into the stored context.
110 111 112 |
# File 'lib/llm/sequel/plugin.rb', line 110 def call(...) ctx.call(...) end |
#context_window ⇒ Integer
147 148 149 150 151 |
# File 'lib/llm/sequel/plugin.rb', line 147 def context_window ctx.context_window rescue LLM::NoSuchModelError, LLM::NoSuchRegistryError 0 end |
#functions ⇒ Array<LLM::Function>
133 134 135 |
# File 'lib/llm/sequel/plugin.rb', line 133 def functions ctx.functions end |
#messages ⇒ Array<LLM::Message>
117 118 119 |
# File 'lib/llm/sequel/plugin.rb', line 117 def ctx. end |
#model! ⇒ String
Note:
The bang is used because Sequel reserves ‘model` for the underlying model class on instances.
126 127 128 |
# File 'lib/llm/sequel/plugin.rb', line 126 def model! ctx.model end |
#respond ⇒ LLM::Response
Continues the stored context through the Responses API and flushes it.
94 95 96 |
# File 'lib/llm/sequel/plugin.rb', line 94 def respond(...) ctx.respond(...).tap { flush } end |
#talk ⇒ LLM::Response
Continues the stored context with new input and flushes it.
86 87 88 |
# File 'lib/llm/sequel/plugin.rb', line 86 def talk(...) ctx.talk(...).tap { flush } end |
#usage ⇒ LLM::Object
Returns usage from the mapped usage columns.
156 157 158 159 160 161 162 |
# File 'lib/llm/sequel/plugin.rb', line 156 def usage LLM::Object.from( input_tokens: self[columns[:input_tokens]] || 0, output_tokens: self[columns[:output_tokens]] || 0, total_tokens: self[columns[:total_tokens]] || 0 ) end |
#wait ⇒ Array<LLM::Function::Return>
Waits for queued tool work to finish.
102 103 104 |
# File 'lib/llm/sequel/plugin.rb', line 102 def wait(...) ctx.wait(...) end |