Skip to main content

Conversation

Struct Conversation 

Source
pub struct Conversation { /* private fields */ }
Expand description

The run’s conversation history, owned by the executor and folded forward turn by turn. Frozen-prefix bytes never live here — the conversation is the volatile half of the request.

Implementations§

Source§

impl Conversation

Source

pub fn new() -> Conversation

Source

pub fn push_task_lines( &mut self, task: &str, goal: &str, opening: Opening, from: &str, )

The dispatch lines: deterministic from run_started’s recorded inputs, hence rebuildable.

The job file’s text is the run segment of the frozen prefix, so the assigned opening names it rather than repeating it: the run segment is not cached, and a pasted task written here again would be paid for twice on every turn.

Source

pub fn push_steer(&mut self, speaker: &Speaker, text: &str)

Steer joins the tail of the open user message, or opens one. A steer that arrives after that message was sent is held until the next tool results, and rides after them.

The one place a steer is rendered: the User’s as user: <text>, a resident’s inside one <letter> its body cannot close (crates/runtime/spec/Conversation.lean §8-47-2).

Source

pub fn push_reminder(&mut self, reminder: &ContextReminder)

The context reminder takes the same door as a steer, so it lands where a steer lands: at the end of the tool results the model reads next.

Source

pub fn push_inherited(&mut self, messages: &[ChatMessage])

What a branch starts from: the messages the mother exchanged, in the order she exchanged them.

Verbatim, and that is not laziness. The list being pushed was folded through this same type, one turn at a time, so it already satisfies the invariant below; re-deciding here whether its last message may join the next would be a second answer to a rule this module owns. The caller pushes the new run’s own lines afterwards, and those do join.

Source

pub fn push_assistant(&mut self, content: Vec<ContentBlock>)

Source

pub fn push_tool_results(&mut self, results: Vec<ContentBlock>)

Tool results join the last user message, or open the next one, and the text held since the last assembly follows them.

Results never wait in held: a reply with no content pushes no assistant message, so the last user message may already be sent, and holding the results there would hold them at every turn. The message they extend is open again, so a steer before the next assembly joins it after them.

Source

pub fn mark_sent(&mut self)

Everything in messages() is now on the wire: later user text joins none of it.

Source

pub fn messages(&self) -> &[ChatMessage]

Trait Implementations§

Source§

impl Clone for Conversation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Conversation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Conversation

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.