Class: Llmshim::ResponseMessage

Inherits:
Struct
  • Object
show all
Defined in:
lib/llmshim/types.rb

Overview

The assistant message inside a ChatResponse.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#contentObject

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



44
45
46
# File 'lib/llmshim/types.rb', line 44

def content
  @content
end

#roleObject

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



44
45
46
# File 'lib/llmshim/types.rb', line 44

def role
  @role
end

#tool_callsObject

Returns the value of attribute tool_calls

Returns:

  • (Object)

    the current value of tool_calls



44
45
46
# File 'lib/llmshim/types.rb', line 44

def tool_calls
  @tool_calls
end

Class Method Details

.from_hash(hash) ⇒ Object



45
46
47
48
# File 'lib/llmshim/types.rb', line 45

def self.from_hash(hash)
  calls = (hash["tool_calls"] || []).map { |c| ToolCall.from_hash(c) }
  new(role: hash["role"], content: hash["content"], tool_calls: calls)
end