Module: LLM::Sequel::Plugin::InstanceMethods
- Defined in:
- lib/llm/sequel/plugin.rb
Constant Summary collapse
Instance Method Summary collapse
- #context_window ⇒ Integer
- #cost ⇒ LLM::Cost
- #functions ⇒ Array<LLM::Function>
- #functions? ⇒ Boolean
- #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
#context_window ⇒ Integer
241 242 243 244 245 |
# File 'lib/llm/sequel/plugin.rb', line 241 def context_window ctx.context_window rescue LLM::NoSuchModelError, LLM::NoSuchRegistryError 0 end |
#functions ⇒ Array<LLM::Function>
213 214 215 |
# File 'lib/llm/sequel/plugin.rb', line 213 def functions ctx.functions end |
#functions? ⇒ Boolean
220 221 222 |
# File 'lib/llm/sequel/plugin.rb', line 220 def functions? ctx.functions? end |
#image_url ⇒ LLM::Object
273 274 275 |
# File 'lib/llm/sequel/plugin.rb', line 273 def image_url(...) ctx.image_url(...) end |
#interrupt! ⇒ nil Also known as: cancel!
257 258 259 |
# File 'lib/llm/sequel/plugin.rb', line 257 def interrupt! ctx.interrupt! end |
#llm ⇒ LLM::Provider
Returns the resolved provider instance for this record.
301 302 303 304 305 306 307 |
# File 'lib/llm/sequel/plugin.rb', line 301 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
280 281 282 |
# File 'lib/llm/sequel/plugin.rb', line 280 def local_file(...) ctx.local_file(...) end |
#messages ⇒ Array<LLM::Message>
197 198 199 |
# File 'lib/llm/sequel/plugin.rb', line 197 def ctx. end |
#mode ⇒ Symbol
190 191 192 |
# File 'lib/llm/sequel/plugin.rb', line 190 def mode ctx.mode end |
#model! ⇒ String
Note:
The bang is used because Sequel reserves ‘model` for the underlying model class on instances.
206 207 208 |
# File 'lib/llm/sequel/plugin.rb', line 206 def model! ctx.model end |
#prompt ⇒ LLM::Prompt Also known as: build_prompt
265 266 267 |
# File 'lib/llm/sequel/plugin.rb', line 265 def prompt(&) ctx.prompt(&) end |
#remote_file ⇒ LLM::Object
287 288 289 |
# File 'lib/llm/sequel/plugin.rb', line 287 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>
227 228 229 |
# File 'lib/llm/sequel/plugin.rb', line 227 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
294 295 296 |
# File 'lib/llm/sequel/plugin.rb', line 294 def tracer ctx.tracer end |
#usage ⇒ LLM::Object
Returns usage from the mapped usage columns.
250 251 252 |
# File 'lib/llm/sequel/plugin.rb', line 250 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 |