Class: LLM::Function::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/llm/function/task.rb

Overview

This class is the superclass that all concurrency strategies must subclass in order to implement their own Task class. It provides a common interface that is the same across all concurrency strategies.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fn, options = {}) ⇒ Task

Returns a new instance of Task.

Parameters:

  • fn (LLM::Function)
  • options (Hash) (defaults to: {})

    An optional set of options that are specific to a given concurrency strategy.

Options Hash (options):

  • :guarded (LLM::Function::Return, nil)

    A blocked return produced by the function's guard. When set, the task yields it without running the tool.



22
23
24
25
# File 'lib/llm/function/task.rb', line 22

def initialize(fn, options = {})
  @function = fn
  @guarded = options[:guarded]
end

Instance Attribute Details

#functionLLM::Function (readonly)

Returns:



12
13
14
# File 'lib/llm/function/task.rb', line 12

def function
  @function
end

Instance Method Details

#alive?Boolean

This method is abstract.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/llm/function/task.rb', line 37

def alive?
  raise NotImplementedError
end

#group_classClass

This method is abstract.

Returns:

  • (Class)

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/llm/function/task.rb', line 60

def group_class
  raise NotImplementedError
end

#interrupt!nil Also known as: cancel!

This method is abstract.

Returns:

  • (nil)

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/llm/function/task.rb', line 44

def interrupt!
  raise NotImplementedError
end

#spawnnil

This method is abstract.

Returns:

  • (nil)

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/llm/function/task.rb', line 30

def spawn
  raise NotImplementedError
end

#waitLLM::Function::Return Also known as: value

This method is abstract.

Returns:

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/llm/function/task.rb', line 52

def wait
  raise NotImplementedError
end