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_usage ⇒ Rational?
Returns context window usage as a Rational.
-
#context_used ⇒ Integer
Returns how many tokens have been used within the context window.
- #context_window ⇒ Integer
- #cost ⇒ LLM::Cost
- #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
- #pending_functions ⇒ Array<LLM::Function>
- #pending_functions? ⇒ Boolean
- #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.
-
#token_usage ⇒ LLM::Usage
(also: #usage)
Returns usage from the mapped usage columns.
- #tracer ⇒ LLM::Tracer
-
#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_usage ⇒ Rational?
Returns context window usage as a Rational
252 253 254 |
# File 'lib/llm/sequel/plugin.rb', line 252 def context_usage ctx.context_usage end |
#context_used ⇒ Integer
Returns how many tokens have been used within the context window
245 246 247 |
# File 'lib/llm/sequel/plugin.rb', line 245 def context_used ctx.context_used end |
#context_window ⇒ Integer
237 238 239 |
# File 'lib/llm/sequel/plugin.rb', line 237 def context_window ctx.context_window end |
#image_url ⇒ LLM::Object
283 284 285 |
# File 'lib/llm/sequel/plugin.rb', line 283 def image_url(...) ctx.image_url(...) end |
#interrupt! ⇒ nil Also known as: cancel!
267 268 269 |
# File 'lib/llm/sequel/plugin.rb', line 267 def interrupt! ctx.interrupt! end |
#llm ⇒ LLM::Provider
Returns the resolved provider instance for this record.
311 312 313 314 315 316 317 |
# File 'lib/llm/sequel/plugin.rb', line 311 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
290 291 292 |
# File 'lib/llm/sequel/plugin.rb', line 290 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
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 |
#pending_functions ⇒ Array<LLM::Function>
209 210 211 |
# File 'lib/llm/sequel/plugin.rb', line 209 def pending_functions ctx.pending_functions end |
#pending_functions? ⇒ Boolean
216 217 218 |
# File 'lib/llm/sequel/plugin.rb', line 216 def pending_functions? ctx.pending_functions? end |
#prompt ⇒ LLM::Prompt Also known as: build_prompt
275 276 277 |
# File 'lib/llm/sequel/plugin.rb', line 275 def prompt(&) ctx.prompt(&) end |
#remote_file ⇒ LLM::Object
297 298 299 |
# File 'lib/llm/sequel/plugin.rb', line 297 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 |
#token_usage ⇒ LLM::Usage Also known as: usage
Returns usage from the mapped usage columns.
259 260 261 |
# File 'lib/llm/sequel/plugin.rb', line 259 def token_usage ctx.token_usage end |
#tracer ⇒ LLM::Tracer
304 305 306 |
# File 'lib/llm/sequel/plugin.rb', line 304 def tracer ctx.tracer 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 |