class Ollama::Message

)
images: [image]
content: ‘Look at this image’,
role: ‘user’,
message = Ollama::Message.new(
image = Ollama::Image.for_filename(‘path/to/image.jpg’)
@example Creating a message with additional attributes
)
content: ‘Hello, world!’
role: ‘user’,
message = Ollama::Message.new(
@example Creating a basic message
content, associated images, and tool calls.
the role of the sender, the content of the message, optional thinking
This class encapsulates the essential components of a message, including
Represents a message object used in communication with the Ollama API.
Ollama::Message

def initialize(role:, content:, thinking: nil, images: nil, tool_calls: nil, **)

Parameters:
  • tool_calls (Hash, Array, nil) -- optional tool calls made in the message
  • images (Ollama::Image, Array, nil) -- optional image objects associated with the message
  • thinking (String, nil) -- optional thinking content for the message
  • content (String) -- the textual content of the message
  • role (String) -- the role of the message sender, such as 'user' or 'assistant'
def initialize(role:, content:, thinking: nil, images: nil, tool_calls: nil, **)
  @role, @content, @thinking, @images, @tool_calls =
    role, content, thinking, (Array(images) if images),
    (Array(tool_calls) if tool_calls)
end