Class: Ollama::ChatResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/ollama/chat_response.rb

Overview

Wraps a normalized chat response in a Ruby surface that supports traditional attribute access and state checks.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content: nil, thinking: nil, role: "assistant", tool_calls: [], images: [], done: true, model: nil) ⇒ ChatResponse

rubocop:disable Metrics/ParameterLists



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ollama/chat_response.rb', line 10

def initialize(
  content: nil,
  thinking: nil,
  role: "assistant",
  tool_calls: [],
  images: [],
  done: true,
  model: nil
)
  # rubocop:enable Metrics/ParameterLists
  @content = content
  @thinking = thinking
  @role = role
  @tool_calls = Array(tool_calls)
  @images = Array(images)
  @done = done
  @model = model
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



7
8
9
# File 'lib/ollama/chat_response.rb', line 7

def content
  @content
end

#doneObject (readonly)

Returns the value of attribute done.



7
8
9
# File 'lib/ollama/chat_response.rb', line 7

def done
  @done
end

#imagesObject (readonly)

Returns the value of attribute images.



7
8
9
# File 'lib/ollama/chat_response.rb', line 7

def images
  @images
end

#modelObject (readonly)

Returns the value of attribute model.



7
8
9
# File 'lib/ollama/chat_response.rb', line 7

def model
  @model
end

#roleObject (readonly)

Returns the value of attribute role.



7
8
9
# File 'lib/ollama/chat_response.rb', line 7

def role
  @role
end

#thinkingObject (readonly)

Returns the value of attribute thinking.



7
8
9
# File 'lib/ollama/chat_response.rb', line 7

def thinking
  @thinking
end

#tool_callsObject (readonly)

Returns the value of attribute tool_calls.



7
8
9
# File 'lib/ollama/chat_response.rb', line 7

def tool_calls
  @tool_calls
end

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/ollama/chat_response.rb', line 29

def done?
  done
end