Chunk
Object Hierarchy:
Description:
public class Chunk : Object, Serializable
One NDJSON line or v1 SSE payload deserialized from the wire.
Holds chat completion deltas (Ollama and OpenAI-style), create/pull progress fields, or both; unset fields remain at type defaults. Chat
accumulation uses Response.Chat.addChunk.
See also:
Response.Chat.addChunk
Content:
Properties:
- public ArrayList<Message> choices { get; set; }
v1 streaming: per-choice delta messages built from the choices array.
For chat mapping, the first choice populates message when non-
empty.
- public int64 completed { get; set; }
Bytes transferred so far for the current pull layer. Zero when the
line does not report layer progress.
- public string created_at { get; set; }
Ollama created_at string, or v1 created unix time as a string after
custom deserialize maps the created field.
- public string digest { get; set; }
Layer digest string from pull progress lines. Empty when not a pull
chunk or when the line has no digest.
- public bool done { get; set; }
True when the server marks the stream or operation finished (Ollama
done, v1 finish_reason present, create/pull complete).
- public string done_reason { get; set; }
Finish reason from v1 choices or Ollama when present. Empty while the
assistant message is still streaming.
- public int eval_count { get; set; }
Completion-side token count: Ollama eval_count or v1
usage.completion_tokens from the same usage handling.
- public int64 eval_duration { get; set; }
Ollama chat: generation duration in nanoseconds when present.
- public int64 load_duration { get; set; }
Ollama chat: model load time in nanoseconds when present.
- public Message message { get; set; }
Assistant message for this line: Ollama top-level message object, or
first v1 choice delta merged by custom deserialize.
- public string model { get; set; }
Model name from the chunk JSON (Ollama chat, v1 completions). Empty
when the line omits model (e.g. some pull progress lines).
- public int prompt_eval_count { get; set; }
Prompt-side token count: Ollama prompt_eval_count or v1
usage.prompt_tokens when a usage object is deserialized.
- public int64 prompt_eval_duration { get; set; }
Ollama chat: prompt evaluation duration in nanoseconds when present.
- public string status { get; set; }
Human-readable progress from create or pull streams (e.g. pulling
manifest, pulling layer digest). Empty for chat-only lines.
- public int64 total { get; set; }
Total bytes expected for the current pull layer. Zero when unknown or
not a pull progress line.
- public int64 total_duration { get; set; }
Ollama chat: total request time in nanoseconds from the chunk. Zero
for APIs that do not send this field.
Creation methods:
Methods:
- public override bool deserialize_property (string property_name, out Value value, ParamSpec pspec, Node property_node)
- public override Node serialize_property (string property_name, Value value, ParamSpec pspec)
Inherited Members:
All known members inherited from class GLib.Object
- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data
- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer
- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref
All known members inherited from interface Json.Serializable
- default_deserialize_property
- default_serialize_property
- deserialize_property
- find_property
- get_property
- list_properties
- serialize_property
- set_property