Async::OllamaSourceAsyncOllamaChat

class Chat

Represents a chat response from the Ollama API, including message content, model, and timing information.

Definitions

def message

Signature

returns Hash | nil

The message content, or nil if not present.

Implementation

def message
	self.value[:message]
end

def response

Signature

returns String | nil

The content of the message, or nil if not present.

Implementation

def response
	if message = self.message
		message[:content]
	end
end

def error

Signature

returns String | nil

The error message, or nil if not present.

Implementation

def error
	self.value[:error]
end

def tool_calls

Signature

returns Array(Hash) | nil

The tool calls, or nil if not present.

Implementation

def tool_calls
	if message = self.message
		message[:tool_calls]
	end
end

def model

Signature

returns String

The model name used to generate this response.

Implementation

def model
	self.value[:model]
end

def total_duration

Implementation

def total_duration
	self.value[:total_duration]
end

def load_duration

Implementation

def load_duration
	self.value[:load_duration]
end

def prompt_eval_count

Implementation

def prompt_eval_count
	self.value[:prompt_eval_count]
end

def prompt_eval_duration

Implementation

def prompt_eval_duration
	self.value[:prompt_eval_duration]
end

def eval_count

Implementation

def eval_count
	self.value[:eval_count]
end

def eval_duration

Implementation

def eval_duration
	self.value[:eval_duration]
end

def token_count

Implementation

def token_count
	count = 0
	
	if prompt_eval_count = self.prompt_eval_count
		count += prompt_eval_count
	end
	
	if eval_count = self.eval_count
		count += eval_count
	end
	
	return count
end