Struct Conversation
pub struct Conversation {Show 57 fields
pub messages: Vec<Message>,
pub shortenings: Vec<u32>,
pub loaded_servers: Vec<String>,
pub loaded: Vec<Loaded>,
pub loaders: Vec<Loader>,
pub removed_tools: Vec<String>,
pub carried_tools: Vec<String>,
pub tools_appended: Vec<u32>,
pub turns: u32,
pub tool_calls: u32,
pub usage: Usage,
pub usage_totals: UsageTotals,
pub sandbox_usage: SandboxUsage,
pub kept_outputs: Arc<BTreeMap<String, String>>,
pub images: Arc<BTreeMap<String, StateImage>>,
pub pending_images: Vec<InboundImage>,
pub sent_images: BTreeSet<String>,
pub journaled_image_bytes: usize,
pub pending_calls: Vec<ToolCall>,
pub ordered_calls: Vec<String>,
pub pending_wait: Option<PendingWait>,
pub model_wait: Option<ModelWait>,
pub deferred: Vec<Message>,
pub artifacts: Vec<ArtifactRef>,
pub announced: Option<String>,
pub announced_final: bool,
pub end_continuations: u32,
pub approval: Option<Approval>,
pub plan: Option<Plan>,
pub thinking_cuts: u32,
pub output_cut: bool,
pub limit: Option<LimitHit>,
pub repeats: Option<Repeats>,
pub source_notes: Vec<ToolNote>,
pub continued_from: Option<RunId>,
pub omitted_turns: u32,
pub context: Map<String, Value>,
pub root_run: Option<RunId>,
pub model_run: Option<RunId>,
pub prompt_statement: Option<PromptStatement>,
pub root_step: Option<String>,
pub session: Option<SessionHeader>,
pub rounds_started: Vec<String>,
pub read_ids: Vec<String>,
pub start_decided: bool,
pub last_prompt: Option<PromptSize>,
pub summary: Option<String>,
pub compactions: Vec<Compaction>,
pub model_switch: Option<ModelSwitch>,
pub overflow_turn: Option<u32>,
pub overflow_message: Option<String>,
pub compact_next: Option<CompactionReason>,
pub compact_failed: Option<u32>,
pub pinned_calls: Vec<String>,
pub reported_rounds: Vec<RunId>,
pub sessions_open: bool,
pub chain_started: Option<Timestamp>,
/* private fields */
}Expand description
The state of an LlmAgent run: the persisted history
plus the bookkeeping the loop needs to resume from any commit.
It is the run’s durable record: Runtime::state(run) deserializes into
it. Runtime::view(run).state is its head (ADR 0055), the same shape
with messages empty. Every field has a serde default, so state written by
an older version still loads.
Fields§
§messages: Vec<Message>The history, oldest first. Nothing is removed from it while the run goes on, but old tool
outputs are shortened in it once the history goes over
Limits::max_history_tokens: down to three quarters of the budget, oldest
first, each keeping its head and a marker (TRUNCATION_MARKER_PREFIX),
the turn recorded in shortenings. So the history is what the model
is sent (a request is this, then at most the closing turn), and each request starts with the
one before; the journal still holds the original outputs of the steps that ran the tools.
A run that continues another starts from a bounded copy of the earlier history instead
(Conversation::continued: old tool outputs shortened, and as a last resort old turns left
out).
shortenings: Vec<u32>The turns (the value of turns when the model was asked) at whose request the
history was shortened (messages): the only requests of a run that do not
start with the one before. Absent from state written before it existed, and not written
while empty, so a run that never shortens writes the bytes it always did.
loaded_servers: Vec<String>The legacy field of the MCP servers a run loaded: before ADR 0066 a server whose when
the task did not match was loaded by a call to use_server, and its name was kept here. The
live set is loaded; this field is read only to seed it.
Decoded, never written since ADR 0066: use_server folded into the group loaders, and
the loaded set is loaded. State written before it still reads; any turn
that finds loaded empty seeds it from here, and a continuation carries the
field so its first turn can.
loaded: Vec<Loaded>The groups and tools the run has loaded during itself, in the order it loaded them: one
entry per loader, with the tools the load made available and the group’s one-line note. The
loop applies the whole list a loader returns (ToolOutput::loaded)
in the same commit as its result, so a resumed run builds the same request, byte for byte
(ADR 0066, decision 5). A load appends its tools after every other tool of the request, never
inserts one, and the turns where the array grew are tools_appended.
A run that continues this one carries the list. Absent from state written before it existed,
and not written while empty.
loaders: Vec<Loader>The loaders the agent still offered on the run’s first turn, recomputed there so a dev
reload’s new catalogue replaces a stale one: what a compaction’s marker says is still there
to load, without asking the live sources. A loader the run loaded is taken out of the
marker’s “available” lines (loaded). Absent from state written before it
existed, and not written while empty.
removed_tools: Vec<String>The loaded tools the run no longer holds: a member its group shrank out of, or a task-loaded member the access tier hid (that one is permanent for the run, because it would otherwise appear later at its registration position). An explicit load’s tier-hidden member is not here: the tier is per message, and its loader appends it again. The turn transition journals the difference, so a replay decides the same; a compaction leaves them out of its recap, and a call to one is refused. Absent from state written before it existed, and not written while empty.
carried_tools: Vec<String>The loaded tools the last request carried, so a load records a growth once: the first request that carries its tools, not every request after. Not carried by a continuation (its first request has no request before it). Absent from state written before it existed, and not written while empty.
tools_appended: Vec<u32>The turns (the value of turns when the model was asked) at whose request the
tools array grew by a group the run loaded (loaded): the
only requests whose head (system and tools) is not the one before, beside
shortenings and compactions, and the only ones
where it may grow (by a suffix). A run that never loads a server records none. Absent from
state written before it existed, and not written while empty.
turns: u32Model calls made so far.
tool_calls: u32Tool calls requested by the model so far.
usage: UsageToken usage summed over this run’s own model calls (not its children’s: see
usage_totals).
usage_totals: UsageTotalsThe tokens of every model call of the task, one entry per provider and model: this run’s own
calls and, once each child run has answered, the children’s (theirs, and their own children’s).
What the A2A server writes on the task as the usage/v1 totals when it ends or waits. Absent
from state written before it existed, and not written while empty; a run that continues
another starts with none (a new task).
sandbox_usage: SandboxUsageThe time the commands of the task ran in a sandbox (a run pod), one entry per shape of sandbox,
and the environment they ran in: what the tools reported (ToolCtx::report_sandbox)
in the calls of this run and, once each child run has answered, the children’s. What the A2A
server writes on the task as the sandbox member of the usage/v1 totals when it ends or waits
(ADR 0043). Absent from state written before it existed, and not written while empty; a run
that continues another starts with none (a new task).
kept_outputs: Arc<BTreeMap<String, String>>The long outputs this run keeps in its own state, by output id, for
read_output: what a tool handed back in
ToolOutput::kept when its agent has no
KeptStore (an agent that is only a folder). At most
MAX_RUN_KEPT_BYTES in all. Absent from state written before it
existed, and not written while empty; a run that continues another starts with none (its
history names outputs of the run before, which are not kept for it).
Shared behind an Arc (the calls of a turn read it without a copy; a write makes the one
copy when something still holds the old). One write of the state can cost up to
MAX_RUN_KEPT_BYTES (4 MiB) beside the history, and the step
of the call that kept a text journals it once more (in its result).
images: Arc<BTreeMap<String, StateImage>>The bytes of the images this run’s history names, by SHA-256, when the agent has no
ImageStore (an agent that is only a folder): base64, and counted
with kept_outputs against MAX_RUN_KEPT_BYTES,
so the worst-case state is what it was. An agent with a store has none here: the state holds
references only. A run that continues another carries the ones its carried history still
names. Absent from state written before it existed, and not written while empty.
pending_images: Vec<InboundImage>The images of the message that started the run, until the first step admits them (the start
of a run is synchronous and cannot keep a file). At most
MAX_INBOUND_IMAGES and
MAX_INBOUND_IMAGE_BYTES, once, in one state. Absent from
state written before it existed, and not written while empty.
sent_images: BTreeSet<String>The SHA-256 of the images that a model request carried and the provider took: the ones the history names and that a refusal of a later request is therefore not blamed on. Absent from state written before it existed, and not written while empty.
journaled_image_bytes: usizeThe bytes of images that the tool steps of this run journaled, for an agent with no image
store. Never freed: what was journaled stays journaled. Bounded by
MAX_RUN_JOURNALED_IMAGE_BYTES. Absent from state
written before it existed, and not written while 0.
pending_calls: Vec<ToolCall>Calls of the last assistant message that have no result yet, in order.
Only non-empty while a step is in flight or the run is parked on
pending_wait.
ordered_calls: Vec<String>The ids of the calls in pending_calls whose model set
after_previous: true: each starts when every call before it has finished. The argument itself
is taken out of the pending call (ADR 0049).
pending_wait: Option<PendingWait>Set while the run is parked waiting for the user’s answer or for a child
run. Before child runs existed this field was pending_question and held
only a question; state stored under that name still loads.
model_wait: Option<ModelWait>Set while the run is parked on the model (ADR 0067 decision 4): the model call the endpoint
refused (or could not reach) is made again when the run wakes, from the conversation as it
was before it. Beside pending_wait, not one of its kinds: it is tied
to no tool call. Cleared by the next call that is answered. In the head, so a front reads
it at /model_wait. Not carried to a later task; absent from state written before it
existed, and not written while None.
A wait this build cannot read (a kind of park a later build added) reads as None, and the
rest of the state still loads.
Breaking: a new public field of a struct that is not #[non_exhaustive]: a
Conversation built with a struct literal outside the workspace needs it (or
..Default::default()).
deferred: Vec<Message>User messages that arrived while tool results were still owed. They are appended once the last owed result is in (a user message between an assistant tool call and its result would break the protocol).
artifacts: Vec<ArtifactRef>Artifacts produced so far, summarised in the final output.
announced: Option<String>The words a tool announced as the run’s answer (ToolOutput::announcing):
the last announcement of the turn in progress, which is the text of the run’s output when it
finishes. A new message that reaches the run ends the turn and clears it. Absent from state
written before it existed, and not written while it is None.
announced_final: boolThe announcement is also the end of the turn
(ToolOutput::final_answer): when the calls owed are
answered the run finishes with announced and calls no model. Cleared
with it. Absent from state written before it existed, and not written while false.
end_continuations: u32How many times a run.ending hook has kept this run going (ADR 0050, decision 10), against
the deployment’s cap. Absent from state written before it existed, and not written at 0.
approval: Option<Approval>The call a hook asked a person to approve, while the run waits for the answer or has it and
has not yet run the call (ADR 0050, slice H8). Absent from state written before it existed,
and not written while None.
plan: Option<Plan>The plan of the conversation (Plan): written by a tool with
ToolOutput::with_plan, applied only from a result that is not
an error, and carried into a run that continues this one. It is never put in the system
prompt, and no earlier message is rewritten with it. Absent from state written before it
existed, and not written while it is None.
thinking_cuts: u32Turns in a row that stopped at the output limit with reasoning only (no words, no call): the
loop continues them and fails the run past MAX_THINKING_CUTS.
Absent from state written before it existed, and not written while 0.
output_cut: boolThe latest model turn stopped at the output limit (FinishReason::Length): a call of it whose
arguments are not JSON is most likely cut off, and its error says so. Absent from state
written before it existed, and not written while false.
limit: Option<LimitHit>The limit this run hit, once it has: the next model call is the closing turn (no tool may be
called), and once that has answered the run finishes with the answer marked limited. Absent
from state written before it existed, and not written while None; a run that continues
another starts without it.
repeats: Option<Repeats>The last call that ran and how often in a row it gave the same answer (doom_loop).
Absent from state written before it existed, and not written while None; a call that waits
(a question, a child run) and a run that continues another leave it None.
source_notes: Vec<ToolNote>What the tool sources said about the tools they offered on the latest model turn
(ToolNote): which calls the system behind a source reports as steps itself
(the agent reports none) and how long a call may run. It is the notes of that turn’s
listing only, replaced at every model call, because the calls to make are the ones that turn
asked for; recorded with the model’s answer, so a replay, another worker and a restart read the
same notes without listing again. Absent from state written before it existed (every call then
has a step of the agent’s own, as it had), and not written while empty.
continued_from: Option<RunId>The run whose conversation this one carries on, for a run started with
Runtime::start_with_id_continuing (see Conversation::continued); None for a run that
began from nothing. Only for whoever reads the durable state: the loop never looks at it.
Absent from state written before it existed, and not written while it is None.
omitted_turns: u32How many turns of earlier conversation were left out to keep a continued run’s carried
history within MAX_CARRIED_BYTES, summed over every continuation in the chain. While it
is not zero the second text part of the first user message is a marker that says so
(it starts with OMITTED_MARKER_PREFIX); this count, and not the text, is what says the
part is a marker. Absent from state written before it existed, and not written while it is
zero.
context: Map<String, Value>What the caller has said about itself, key by key: the objects under "context" of the
inbound payloads the run has read (the start message and every later one), merged in the
order they arrived. A key a message sets replaces the one before; a key set to null
deletes it. Tools read it with ToolCtx::context.
The A2A server fills it from the extensions a message carries (the screen’s UI catalog,
the endpoint for the thread’s tools): see adam-a2a-runtime. It is part of the durable
state, so it survives a restart and a change of worker, and a run that continues another
starts with the context of the run before (Conversation::continued).
It is bounded: a message whose context would take the total over MAX_CONTEXT_BYTES
has its context dropped, with a warning. An entry that is an object with an expiresAt
(RFC 3339) is removed once that time has passed, the next time the run steps
(drop_expired_context): a credential does not outlive its
expiry in the store. Absent from state written before it existed, and not written while it
is empty.
root_run: Option<RunId>The run this one works for, when it is a child run: the top of its parent chain, put in its
first message by the tool that started it (ToolCtx::start_child).
None for a run that is nobody’s child. Tools read it as
ToolCtx::root_run_id. Part of the durable state, so it
survives a restart and a change of worker; a run that continues another does not inherit it.
Absent from state written before it existed, and not written while it is None.
model_run: Option<RunId>The run this run’s model calls name (ModelRequest::run,
ADR 0067), when the run that started it said one: the run its parent’s calls name, put in
its first message by in-process code only. None for a run nobody started that way; its
calls then name its session’s root, else root_run, else itself. Absent
from state written before it existed, and not written while it is None; a run that
continues another does not inherit it.
prompt_statement: Option<PromptStatement>The prompt statement and the person’s envelope every model call of this run carries
(ModelRequest::prompt_statement, ADR 0077):
set by the message the run starts with, replaced by a later message of the task that
brings new ones and kept by one that brings none. A child run and a session’s round start
with their parent’s. Not in context, so no tool reads it; its Debug
holds no value. Part of the durable state, so a restart or another worker sends the same; a
run that continues another (a later task) does not inherit it. Absent from state written
before it existed, and not written while it is None.
root_step: Option<String>The step of the root_run this child run works under: the root’s call of a
subagent tool (tool:<call id>), put in the child’s first message by the tool that started it
and handed down to the child’s own children. The report of each of this run’s model calls
names it, so the task’s client counts a subagent’s tokens apart. None for a run that is
nobody’s child. Absent from state written before it existed, and not written while it is
None; a run that continues another does not inherit it.
session: Option<SessionHeader>What this round says about its session, when it is a round of one (ADR 0045): the header the
parent’s subagent_start put in the round’s first message, carried into every later round.
The truth about a session is its latest round’s header. Absent from state written before
it existed, and not written while it is None.
rounds_started: Vec<String>The call ids of the subagent_start and subagent_send calls of this task whose round’s
tokens are not yet in usage_totals (ADR 0045): the round of a call
is child_run_id(run, call id), so a replay names the same ones. A round is counted once,
when the report of it is read or, at the latest, when the run ends, in a journaled step
usage:<call id>, and then leaves this list: a report read twice, or never, counts once.
A call that started no round (a refusal, a steer) names a run that does not exist and leaves
the list uncounted. Not carried to a later task, which counts afresh. Absent from state
written before it existed, and not written while empty.
read_ids: Vec<String>The ids (Inbound::id, an A2A messageId) of the messages the run has read after its first,
and of the resumes it has read (the forwarded resume’s id, ADR 0067 decision 5), the last
MAX_READ_IDS of them, oldest first: a message that arrives again with one of them (the
same one sent twice, as the orchestration layer does after a lost lease) is not read a second
time, whether it is still in the inbox or was read transitions ago, and a copy of a resume is
no wake. The window is shared by both: a burst of resumes can evict an old message id, which
fails open (the old message, delivered again, is read once more, never lost), and an evicted
resume id makes the copy a kept resume, so it costs one extra call (and its step). Part of
the durable state, so another worker and
a restart keep it. Absent from state written before it existed, and not written while empty;
a run that continues another starts with none.
start_decided: boolWhether the message the run started with has been decided by the message.received hooks
(ADR 0050, slice H1b). It is set in the state the decision is taken in, so the decision is
made once even when the transition that made it fails or parks before a model call. Absent
from state written before it existed (a run in flight reads false), and not written while
false: a run with no hook set never writes it.
last_prompt: Option<PromptSize>How big the last model call’s prompt was, as the provider reported it, and how many messages
the history held then: the estimate that says when the run is compacted starts from it. None
until a call reported its prompt, and again after a compaction or a shortening changed the
history. Absent from state written before it existed, and not written while None.
summary: Option<String>The body of the marker of a compacted history (its summary and the lines code wrote after it),
which a run that continues this one carries into the marker of its own first message. Absent
from state written before it existed, and not written while None.
compactions: Vec<Compaction>The compactions of this run, oldest first (at most MAX_COMPACTIONS): the requests that
start a new prefix, beside shortenings. A run that continues another
has one more in front, carried: what the runs before it
compacted, folded into one. Absent from state written before it existed, and not written
while empty.
model_switch: Option<ModelSwitch>The one switch the run made from its model to the agent’s fallback, after the endpoint refused
the model as locked (ModelSwitch). Once set, every call of the run names the fallback and
a second ModelLocked fails the run. Absent from state written before it existed, and not
written while None.
overflow_turn: Option<u32>The turn whose prompt the provider rejected as too long, once: a second rejection of the same
turn fails the run. Absent from state written before it existed, and not written while None.
overflow_message: Option<String>What the provider said of the rejection in overflow_turn, until the
compaction it caused has recorded it (Compaction::rejected).
compact_next: Option<CompactionReason>A compaction the next transition makes before anything else (set when a prompt was rejected as
too long). Absent from state written before it existed, and not written while None.
compact_failed: Option<u32>The turn at which a summary could not be made: the run is only shortened for
a few turns, and tries again after. Absent from state written before it existed, and not
written while None.
pinned_calls: Vec<String>The ids of the calls whose results a tool pinned (ToolOutput::pinned),
while their results are in the history. Absent from state written before it existed, and not
written while empty.
reported_rounds: Vec<RunId>The rounds of sessions whose report the model has been given (ADR 0045, slice 3), in the
order it was, the last MAX_REPORTED_ROUNDS: by a read of its own or by the loop, which
tells the model of a round that ended while it worked. A round in it is not reported
again. Carried by continued, so a later task of the conversation
does not repeat a report. Absent from state written before it existed, and not written
while empty.
sessions_open: boolWhether a round of a session of this conversation may still end and be reported: the last
listing saw a session that is not closed, or a call has started or sent to one since. While
it is set the loop lists the sessions before every model call; while it is not, only before
the first of a run. Not carried to a later task. Absent from state written before it
existed, and not written while false.
chain_started: Option<Timestamp>When the chain of tasks this run belongs to began, by the runtime’s clock, set at the run’s
first model call and carried by continued: a person’s round that
ended before it is not told to a run that does not continue the task that was told of it
(nothing records that it was). Absent from state written before it existed, and not written
while None.
Implementations§
§impl Conversation
impl Conversation
pub fn new(text: impl Into<String>) -> Conversation
pub fn new(text: impl Into<String>) -> Conversation
A conversation that starts with one user message.
pub fn task(&self) -> Option<&str>
pub fn task(&self) -> Option<&str>
The task the run was started with: the words of the first part of its first message.
It is the same text at every step of the run and in a run that continues it: a compaction
keeps it first (the second part is the marker, the third the person’s later words), and a
continued run carries its first message. None when the first message has no words (a
round that only closes a session, or an image with no text); Some("") when the person sent
an empty one.
pub fn split(&self) -> (Conversation, Vec<Value>)
pub fn split(&self) -> (Conversation, Vec<Value>)
The head and the transcript rows of this state: what
Agent::split declares.
The head is this conversation with messages emptied; the rows are the
messages as JSON, oldest first. Everything else — the shortenings, the counters, the
usage, the pending wait, the artifacts — stays in the head, because none of it grows with
the transcript. join puts the messages back, and the round trip re-encodes
to the same bytes.
pub fn join(
head: Conversation,
rows: Vec<Value>,
) -> Result<Conversation, AgentError>
pub fn join( head: Conversation, rows: Vec<Value>, ) -> Result<Conversation, AgentError>
head with rows as its messages: the inverse of split.
The messages are replaced, never appended: the head a commit writes has none, and a row that does not decode fails the join rather than producing a state that differs from the one it was split from.
pub fn merge_context(&mut self, update: &Map<String, Value>) -> bool
pub fn merge_context(&mut self, update: &Map<String, Value>) -> bool
Merge the update of one inbound message into context: a key it sets
replaces the one before, a key set to null is deleted.
Returns false when the merged context would be larger than MAX_CONTEXT_BYTES (a warning
says so: the message is still read for its text). Then only the update’s
PROTECTED_CONTEXT_KEYS are merged and the PER_MESSAGE_CONTEXT_KEYS are deleted;
nothing else changes: a limit the person set is never lost to a large context, and an
earlier message’s offer is never taken for this one’s. The protected keys do not count
toward the limit.
pub fn drop_expired_context(&mut self, now: Timestamp) -> usize
pub fn drop_expired_context(&mut self, now: Timestamp) -> usize
Remove the context entries that have expired at now: an object with an
expiresAt that is an RFC 3339 time not after now. An entry with no expiresAt, or one
that does not parse, stays. Returns how many were removed; the agent calls it at the start
of every step.
pub fn shows_child_sessions(&self) -> bool
pub fn shows_child_sessions(&self) -> bool
Whether the client that started or last wrote to this run shows child sessions
(CHILD_SESSIONS_CONTEXT_KEY): true when its request activated child-sessions/v1. A
session this run starts is then one the person sees, so a round of it may ask them (ADR 0045
decision 9); the session tools write it into the session’s header.
pub fn may_ask_person(&self, conversation_id: Option<&str>) -> bool
pub fn may_ask_person(&self, conversation_id: Option<&str>) -> bool
Whether a tool of this run may ask the person (ToolError::NeedsInput, ADR 0045
decision 9): a root run always; a round of a session only when the session is kept open and
a client shows it (SessionHeader::visible); and no
other child run at all, because nobody would answer it and it would wait for ever. A round
of a session that carries no header (one an embedder made with
Runtime::start_child_continuing) is no root either: nobody sees it.
The agent refuses the question in words instead of parking when this is false.
pub fn is_omission_marker(&self, message: usize, part: usize) -> bool
pub fn is_omission_marker(&self, message: usize, part: usize) -> bool
Whether text part part of message message is the marker that says turns were left out
(omitted_turns): the second part of the first message, while turns
have been omitted. Anything else that merely starts like the marker is not one, so a rule
that reads what the user said can skip exactly the marker and nothing the user wrote.
pub fn continued(&self, text: impl Into<String>, from: RunId) -> Conversation
pub fn continued(&self, text: impl Into<String>, from: RunId) -> Conversation
The conversation of a new run that carries on this one (the run from) with one more
user message: what LlmAgent and LlmStarter
start a run with when the runtime says it continues another.
- Carried: the history, oldest first, and the user messages that were still waiting
behind an owed tool result (
deferred), in the order they arrived, thentextas the newest user message. - Answered: the tool calls of a last assistant message that never got their results
(the run that made them ended mid-turn: it was cancelled, or failed, or was parked on a
question, and a model provider rejects a call without a result) each get an error result,
STOPPED_BY_THE_PERSON, after the results that did arrive. The model keeps what it asked for and is told which calls did not finish. The wait the run was parked on goes:pending_waitandpending_callsare always empty here, so a continued run never answers a question or a child run of the run before. - Reset, per task:
turns,tool_callsandusage(theLimitsare per run, and this is a new run) andartifacts(the final output lists what this run produced). - Recorded:
continued_from, and inomitted_turnshow many turns have been left out, in this and earlier continuations. - Carried with the summary:
pinned_calls, and thecompactionsfolded into one record (carried), so a compaction of the new run writes the same code-made lines again.MAX_COMPACTIONScounts each run’s own: a long conversation is compacted for as long as it lasts. - Bounded: by
MAX_CARRIED_BYTES: the tool outputs of the turns older than the newest are shortened first, whole old turns are dropped after that, and the newest turn’s outputs are shortened last; the first user message is never dropped, and the marker that says turns were left out is always the second text part of the first message. - Alternating: user messages that would end up next to each other (the marker and the message after it, the new one after a history that ends with a user message, the ones that were waiting) become one message with several text parts, so that the roles alternate as chat templates that insist on it need.
pub fn kept_bytes(&self) -> usize
pub fn kept_bytes(&self) -> usize
The bytes the run keeps in its own state: its kept outputs and its images (what
MAX_RUN_KEPT_BYTES bounds).
pub fn image_count(&self) -> usize
pub fn image_count(&self) -> usize
The images the history holds: the image parts of its messages, the ones still waiting
behind an owed tool result, and the images of its tool results. What the model is sent each
request, and what MODEL_IMAGE_MAX_COUNT bounds.
Trait Implementations§
§impl Clone for Conversation
impl Clone for Conversation
§fn clone(&self) -> Conversation
fn clone(&self) -> Conversation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for Conversation
impl Debug for Conversation
§impl Default for Conversation
impl Default for Conversation
§fn default() -> Conversation
fn default() -> Conversation
§impl<'de> Deserialize<'de> for Conversation
impl<'de> Deserialize<'de> for Conversation
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Conversation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Conversation, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl PartialEq for Conversation
impl PartialEq for Conversation
§impl Serialize for Conversation
impl Serialize for Conversation
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Conversation
Auto Trait Implementations§
impl Freeze for Conversation
impl RefUnwindSafe for Conversation
impl Send for Conversation
impl Sync for Conversation
impl Unpin for Conversation
impl UnsafeUnpin for Conversation
impl UnwindSafe for Conversation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].