Class: Rubino::LLM::Request
- Inherits:
-
Object
- Object
- Rubino::LLM::Request
- Defined in:
- lib/rubino/llm/request.rb
Overview
The single value object the conversation loop hands the LLM boundary on each model call. Pure data — it carries everything a provider needs to issue one request, so the loop never threads positional args through the adapter. Mirrors the reference per-call request shape feeding the normalize_response seam: build a request, call the boundary, read back a normalized response.
Fields:
messages : [{role:, content:, tool_calls?, tool_call_id?}] — api copy
tools : [tool schema] — may be [] (e.g. max-iter toolless summary)
temperature : Float | nil — nil ⇒ provider default; forced to 1 w/ thinking
max_tokens : Integer | nil — bumped on thinking + truncation continuation
thinking : {enabled:, effort:|budget:} | nil — rendered to wire later
prefill : String | nil — assistant-turn seed for prefill-to-continue
image_paths : [path] — native attachments, first call of a turn only
stream : Bool — loop decides (interactive turn ⇒ false)
Instance Attribute Summary collapse
-
#image_paths ⇒ Object
readonly
Returns the value of attribute image_paths.
-
#max_tokens ⇒ Object
readonly
Returns the value of attribute max_tokens.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#prefill ⇒ Object
readonly
Returns the value of attribute prefill.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
-
#temperature ⇒ Object
readonly
Returns the value of attribute temperature.
-
#thinking ⇒ Object
readonly
Returns the value of attribute thinking.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Instance Method Summary collapse
-
#initialize(messages:, tools: nil, temperature: nil, max_tokens: nil, thinking: nil, prefill: nil, image_paths: nil, stream: false) ⇒ Request
constructor
A new instance of Request.
-
#stream? ⇒ Boolean
True when the loop asked the boundary to stream this call.
- #to_h ⇒ Object
Constructor Details
#initialize(messages:, tools: nil, temperature: nil, max_tokens: nil, thinking: nil, prefill: nil, image_paths: nil, stream: false) ⇒ Request
Returns a new instance of Request.
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubino/llm/request.rb', line 25 def initialize(messages:, tools: nil, temperature: nil, max_tokens: nil, thinking: nil, prefill: nil, image_paths: nil, stream: false) @messages = || [] @tools = tools || [] @temperature = temperature @max_tokens = max_tokens @thinking = thinking @prefill = prefill @image_paths = image_paths || [] @stream = stream ? true : false end |
Instance Attribute Details
#image_paths ⇒ Object (readonly)
Returns the value of attribute image_paths.
22 23 24 |
# File 'lib/rubino/llm/request.rb', line 22 def image_paths @image_paths end |
#max_tokens ⇒ Object (readonly)
Returns the value of attribute max_tokens.
22 23 24 |
# File 'lib/rubino/llm/request.rb', line 22 def max_tokens @max_tokens end |
#messages ⇒ Object (readonly)
Returns the value of attribute messages.
22 23 24 |
# File 'lib/rubino/llm/request.rb', line 22 def @messages end |
#prefill ⇒ Object (readonly)
Returns the value of attribute prefill.
22 23 24 |
# File 'lib/rubino/llm/request.rb', line 22 def prefill @prefill end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
22 23 24 |
# File 'lib/rubino/llm/request.rb', line 22 def stream @stream end |
#temperature ⇒ Object (readonly)
Returns the value of attribute temperature.
22 23 24 |
# File 'lib/rubino/llm/request.rb', line 22 def temperature @temperature end |
#thinking ⇒ Object (readonly)
Returns the value of attribute thinking.
22 23 24 |
# File 'lib/rubino/llm/request.rb', line 22 def thinking @thinking end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools.
22 23 24 |
# File 'lib/rubino/llm/request.rb', line 22 def tools @tools end |
Instance Method Details
#stream? ⇒ Boolean
True when the loop asked the boundary to stream this call.
38 39 40 |
# File 'lib/rubino/llm/request.rb', line 38 def stream? @stream end |
#to_h ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/rubino/llm/request.rb', line 42 def to_h { messages: @messages, tools: @tools, temperature: @temperature, max_tokens: @max_tokens, thinking: @thinking, prefill: @prefill, image_paths: @image_paths, stream: @stream } end |