Module: LLM::Sequel::Plugin::InstanceMethods
- Defined in:
- lib/llm/sequel/plugin.rb
Constant Summary collapse
Instance Method Summary collapse
-
#ask ⇒ LLM::Response
Continues the stored context with new input and flushes it.
- #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
- #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
#ask ⇒ LLM::Response
Continues the stored context with new input and flushes it.
170 171 172 173 |
# File 'lib/llm/sequel/plugin.rb', line 170 def ask(...) = self.class. ctx.ask(...).tap { Utils.save!(self, ctx, ) } end |
#context_window ⇒ Integer
237 238 239 240 241 |
# File 'lib/llm/sequel/plugin.rb', line 237 def context_window ctx.context_window rescue LLM::NoSuchModelError, LLM::NoSuchRegistryError 0 end |
#functions ⇒ Array<LLM::Function>
209 210 211 |
# File 'lib/llm/sequel/plugin.rb', line 209 def functions ctx.functions end |
#functions? ⇒ Boolean
216 217 218 |
# File 'lib/llm/sequel/plugin.rb', line 216 def functions? ctx.functions? end |
#image_url ⇒ LLM::Object
269 270 271 |
# File 'lib/llm/sequel/plugin.rb', line 269 def image_url(...) ctx.image_url(...) end |
#interrupt! ⇒ nil Also known as: cancel!
253 254 255 |
# File 'lib/llm/sequel/plugin.rb', line 253 def interrupt! ctx.interrupt! end |
#llm ⇒ LLM::Provider
Returns the resolved provider instance for this record.
297 298 299 300 301 302 303 |
# File 'lib/llm/sequel/plugin.rb', line 297 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
276 277 278 |
# File 'lib/llm/sequel/plugin.rb', line 276 def local_file(...) ctx.local_file(...) end |
#messages ⇒ Array<LLM::Message>
193 194 195 |
# File 'lib/llm/sequel/plugin.rb', line 193 def ctx. end |
#mode ⇒ Symbol
186 187 188 |
# File 'lib/llm/sequel/plugin.rb', line 186 def mode ctx.mode end |
#model! ⇒ String
Note:
The bang is used because Sequel reserves ‘model` for the underlying model class on instances.
202 203 204 |
# File 'lib/llm/sequel/plugin.rb', line 202 def model! ctx.model end |
#prompt ⇒ LLM::Prompt Also known as: build_prompt
261 262 263 |
# File 'lib/llm/sequel/plugin.rb', line 261 def prompt(&) ctx.prompt(&) end |
#remote_file ⇒ LLM::Object
283 284 285 |
# File 'lib/llm/sequel/plugin.rb', line 283 def remote_file(...) ctx.remote_file(...) end |
#returns ⇒ Array<LLM::Function::Return>
223 224 225 |
# File 'lib/llm/sequel/plugin.rb', line 223 def returns ctx.returns end |
#talk ⇒ LLM::Response
Continues the stored context with new input and flushes it.
161 162 163 164 |
# File 'lib/llm/sequel/plugin.rb', line 161 def talk(...) = self.class. ctx.talk(...).tap { Utils.save!(self, ctx, ) } end |
#tracer ⇒ LLM::Tracer
290 291 292 |
# File 'lib/llm/sequel/plugin.rb', line 290 def tracer ctx.tracer end |
#usage ⇒ LLM::Object
Returns usage from the mapped usage columns.
246 247 248 |
# File 'lib/llm/sequel/plugin.rb', line 246 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.
179 180 181 |
# File 'lib/llm/sequel/plugin.rb', line 179 def wait(...) ctx.wait(...) end |