Class: RubynCode::LLM::Response

Inherits:
Data
  • Object
show all
Defined in:
lib/rubyn_code/llm/message_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



27
28
29
# File 'lib/rubyn_code/llm/message_builder.rb', line 27

def content
  @content
end

#idObject (readonly)

Returns the value of attribute id

Returns:

  • (Object)

    the current value of id



27
28
29
# File 'lib/rubyn_code/llm/message_builder.rb', line 27

def id
  @id
end

#stop_reasonObject (readonly)

Returns the value of attribute stop_reason

Returns:

  • (Object)

    the current value of stop_reason



27
28
29
# File 'lib/rubyn_code/llm/message_builder.rb', line 27

def stop_reason
  @stop_reason
end

#usageObject (readonly)

Returns the value of attribute usage

Returns:

  • (Object)

    the current value of usage



27
28
29
# File 'lib/rubyn_code/llm/message_builder.rb', line 27

def usage
  @usage
end

Instance Method Details

#textObject



28
29
30
# File 'lib/rubyn_code/llm/message_builder.rb', line 28

def text
  content.select { |b| b.type == 'text' }.map(&:text).join
end

#tool_callsObject



32
33
34
# File 'lib/rubyn_code/llm/message_builder.rb', line 32

def tool_calls
  content.select { |b| b.type == 'tool_use' }
end

#tool_use?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/rubyn_code/llm/message_builder.rb', line 36

def tool_use?
  stop_reason == 'tool_use'
end