Class: LLM::Function::Return

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



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

def id
  @id
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



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

def name
  @name
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



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

def value
  @value
end

Instance Method Details

#error?Boolean

Returns true when the return value represents an error.

Returns:

  • (Boolean)


47
48
49
# File 'lib/llm/function.rb', line 47

def error?
  Hash === value && value[:error] == true
end

#to_hHash

Returns a Hash representation of LLM::Function::Return

Returns:

  • (Hash)


54
55
56
# File 'lib/llm/function.rb', line 54

def to_h
  {id:, name:, value:}
end

#to_jsonString

Returns:

  • (String)


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

def to_json(...)
  LLM.json.dump(to_h, ...)
end