Module: LLM::Sequel::Plugin::InstanceMethods
- Defined in:
- lib/llm/sequel/plugin.rb
Constant Summary collapse
Instance Method Summary collapse
-
#call ⇒ Object
Calls into the stored context.
- #context_window ⇒ Integer
- #cost ⇒ LLM::Cost
- #functions ⇒ Array<LLM::Function>
- #image_url ⇒ LLM::Object
- #interrupt! ⇒ nil (also: #cancel!)
-
#llm ⇒ LLM::Provider
Returns the resolved provider instance for this record.
- #local_file ⇒ LLM::Object
- #messages ⇒ Array<LLM::Message>
- #mode ⇒ Symbol
- #model! ⇒ String
- #prompt ⇒ LLM::Prompt (also: #build_prompt)
- #remote_file ⇒ LLM::Object
-
#respond ⇒ LLM::Response
Continues the stored context through the Responses API and flushes it.
- #returns ⇒ Array<LLM::Function::Return>
-
#talk ⇒ LLM::Response
Continues the stored context with new input and flushes it.
- #tracer ⇒ LLM::Tracer
-
#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.
191 192 193 |
# File 'lib/llm/sequel/plugin.rb', line 191 def call(...) ctx.call(...) end |
#context_window ⇒ Integer
242 243 244 245 246 |
# File 'lib/llm/sequel/plugin.rb', line 242 def context_window ctx.context_window rescue LLM::NoSuchModelError, LLM::NoSuchRegistryError 0 end |
#functions ⇒ Array<LLM::Function>
221 222 223 |
# File 'lib/llm/sequel/plugin.rb', line 221 def functions ctx.functions end |
#image_url ⇒ LLM::Object
274 275 276 |
# File 'lib/llm/sequel/plugin.rb', line 274 def image_url(...) ctx.image_url(...) end |
#interrupt! ⇒ nil Also known as: cancel!
258 259 260 |
# File 'lib/llm/sequel/plugin.rb', line 258 def interrupt! ctx.interrupt! end |
#llm ⇒ LLM::Provider
Returns the resolved provider instance for this record.
302 303 304 305 306 307 308 |
# File 'lib/llm/sequel/plugin.rb', line 302 def llm = self.class. return @llm if @llm @llm = Utils.resolve_provider(self, , Plugin::EMPTY_HASH) @llm.tracer = Utils.resolve_option(self, [:tracer]) if [:tracer] @llm end |
#local_file ⇒ LLM::Object
281 282 283 |
# File 'lib/llm/sequel/plugin.rb', line 281 def local_file(...) ctx.local_file(...) end |
#messages ⇒ Array<LLM::Message>
205 206 207 |
# File 'lib/llm/sequel/plugin.rb', line 205 def ctx. end |
#mode ⇒ Symbol
198 199 200 |
# File 'lib/llm/sequel/plugin.rb', line 198 def mode ctx.mode end |
#model! ⇒ String
Note:
The bang is used because Sequel reserves ‘model` for the underlying model class on instances.
214 215 216 |
# File 'lib/llm/sequel/plugin.rb', line 214 def model! ctx.model end |
#prompt ⇒ LLM::Prompt Also known as: build_prompt
266 267 268 |
# File 'lib/llm/sequel/plugin.rb', line 266 def prompt(&) ctx.prompt(&) end |
#remote_file ⇒ LLM::Object
288 289 290 |
# File 'lib/llm/sequel/plugin.rb', line 288 def remote_file(...) ctx.remote_file(...) end |
#respond ⇒ LLM::Response
Continues the stored context through the Responses API and flushes it.
174 175 176 177 |
# File 'lib/llm/sequel/plugin.rb', line 174 def respond(...) = self.class. ctx.respond(...).tap { Utils.save(self, ctx, ) } end |
#returns ⇒ Array<LLM::Function::Return>
228 229 230 |
# File 'lib/llm/sequel/plugin.rb', line 228 def returns ctx.returns end |
#talk ⇒ LLM::Response
Continues the stored context with new input and flushes it.
165 166 167 168 |
# File 'lib/llm/sequel/plugin.rb', line 165 def talk(...) = self.class. ctx.talk(...).tap { Utils.save(self, ctx, ) } end |
#tracer ⇒ LLM::Tracer
295 296 297 |
# File 'lib/llm/sequel/plugin.rb', line 295 def tracer ctx.tracer end |
#usage ⇒ LLM::Object
Returns usage from the mapped usage columns.
251 252 253 |
# File 'lib/llm/sequel/plugin.rb', line 251 def usage ctx.usage || LLM::Object.from(input_tokens: 0, output_tokens: 0, total_tokens: 0) end |
#wait ⇒ Array<LLM::Function::Return>
Waits for queued tool work to finish.
183 184 185 |
# File 'lib/llm/sequel/plugin.rb', line 183 def wait(...) ctx.wait(...) end |