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>
- #image_url ⇒ LLM::Object
- #interrupt! ⇒ nil (also: #cancel!)
- #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.
115 116 117 |
# File 'lib/llm/sequel/plugin.rb', line 115 def call(...) ctx.call(...) end |
#context_window ⇒ Integer
166 167 168 169 170 |
# File 'lib/llm/sequel/plugin.rb', line 166 def context_window ctx.context_window rescue LLM::NoSuchModelError, LLM::NoSuchRegistryError 0 end |
#functions ⇒ Array<LLM::Function>
145 146 147 |
# File 'lib/llm/sequel/plugin.rb', line 145 def functions ctx.functions end |
#image_url ⇒ LLM::Object
202 203 204 |
# File 'lib/llm/sequel/plugin.rb', line 202 def image_url(...) ctx.image_url(...) end |
#interrupt! ⇒ nil Also known as: cancel!
186 187 188 |
# File 'lib/llm/sequel/plugin.rb', line 186 def interrupt! ctx.interrupt! end |
#local_file ⇒ LLM::Object
209 210 211 |
# File 'lib/llm/sequel/plugin.rb', line 209 def local_file(...) ctx.local_file(...) end |
#messages ⇒ Array<LLM::Message>
129 130 131 |
# File 'lib/llm/sequel/plugin.rb', line 129 def ctx. end |
#mode ⇒ Symbol
122 123 124 |
# File 'lib/llm/sequel/plugin.rb', line 122 def mode ctx.mode end |
#model! ⇒ String
Note:
The bang is used because Sequel reserves ‘model` for the underlying model class on instances.
138 139 140 |
# File 'lib/llm/sequel/plugin.rb', line 138 def model! ctx.model end |
#prompt ⇒ LLM::Prompt Also known as: build_prompt
194 195 196 |
# File 'lib/llm/sequel/plugin.rb', line 194 def prompt(&) ctx.prompt(&) end |
#remote_file ⇒ LLM::Object
216 217 218 |
# File 'lib/llm/sequel/plugin.rb', line 216 def remote_file(...) ctx.remote_file(...) end |
#respond ⇒ LLM::Response
Continues the stored context through the Responses API and flushes it.
99 100 101 |
# File 'lib/llm/sequel/plugin.rb', line 99 def respond(...) ctx.respond(...).tap { flush } end |
#returns ⇒ Array<LLM::Function::Return>
152 153 154 |
# File 'lib/llm/sequel/plugin.rb', line 152 def returns ctx.returns end |
#talk ⇒ LLM::Response
Continues the stored context with new input and flushes it.
91 92 93 |
# File 'lib/llm/sequel/plugin.rb', line 91 def talk(...) ctx.talk(...).tap { flush } end |
#tracer ⇒ LLM::Tracer
223 224 225 |
# File 'lib/llm/sequel/plugin.rb', line 223 def tracer ctx.tracer end |
#usage ⇒ LLM::Object
Returns usage from the mapped usage columns.
175 176 177 178 179 180 181 |
# File 'lib/llm/sequel/plugin.rb', line 175 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.
107 108 109 |
# File 'lib/llm/sequel/plugin.rb', line 107 def wait(...) ctx.wait(...) end |