Class: LLM::Function::Ractor::Task
- Inherits:
-
Object
- Object
- LLM::Function::Ractor::Task
- Defined in:
- lib/llm/function/ractor/task.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #initialize(runner_class, id, name, arguments, tracer: nil, span: nil) ⇒ LLM::Function::Ractor::Task constructor
- #interrupt! ⇒ nil (also: #cancel!)
- #spawn ⇒ LLM::Function::Ractor::Task
- #wait ⇒ LLM::Function::Return (also: #value)
Constructor Details
#initialize(runner_class, id, name, arguments, tracer: nil, span: nil) ⇒ LLM::Function::Ractor::Task
21 22 23 24 25 26 27 28 |
# File 'lib/llm/function/ractor/task.rb', line 21 def initialize(runner_class, id, name, arguments, tracer: nil, span: nil) @runner_class = runner_class @id = id @name = name @arguments = arguments @tracer = tracer @span = span end |
Instance Attribute Details
#mailbox ⇒ LLM::Function::Ractor::Mailbox (readonly)
11 12 13 |
# File 'lib/llm/function/ractor/task.rb', line 11 def mailbox @mailbox end |
Instance Method Details
#alive? ⇒ Boolean
39 40 41 |
# File 'lib/llm/function/ractor/task.rb', line 39 def alive? mailbox.alive? end |
#interrupt! ⇒ nil Also known as: cancel!
45 46 47 |
# File 'lib/llm/function/ractor/task.rb', line 45 def interrupt! nil end |
#spawn ⇒ LLM::Function::Ractor::Task
32 33 34 35 |
# File 'lib/llm/function/ractor/task.rb', line 32 def spawn @mailbox = Ractor::Mailbox.new(build_task) self end |
#wait ⇒ LLM::Function::Return Also known as: value
52 53 54 55 56 57 |
# File 'lib/llm/function/ractor/task.rb', line 52 def wait id, name, value = mailbox.wait result = Return.new(id, name, value) @tracer&.on_tool_finish(result:, span: @span) result end |