pub struct Conversation {Show 18 fields
pub _id: u64,
pub user: Principal,
pub thread: Option<Xid>,
pub messages: Vec<Json>,
pub resources: Vec<Resource>,
pub artifacts: Vec<Resource>,
pub status: ConversationStatus,
pub failed_reason: Option<String>,
pub usage: Usage,
pub steering_messages: Option<Vec<String>>,
pub follow_up_messages: Option<Vec<String>>,
pub child: Option<u64>,
pub ancestors: Option<Vec<u64>>,
pub label: Option<String>,
pub extra: Option<Json>,
pub period: u64,
pub created_at: u64,
pub updated_at: u64,
}Expand description
Conversation record stored in the memory database.
Schema version: 4
Fields§
§_id: u64Unique collection identifier assigned by AndaDB.
user: PrincipalPrincipal that owns the conversation.
thread: Option<Xid>Optional thread identifier used to group related conversation turns.
messages: Vec<Json>Serialized chat messages accumulated for the conversation.
resources: Vec<Resource>The request resources used by the agent to process the conversation.
artifacts: Vec<Resource>A collection of artifacts generated by the agent during the execution of the task.
status: ConversationStatusCurrent lifecycle state of the conversation.
failed_reason: Option<String>Failure reason recorded when the conversation did not complete.
usage: UsageThe LLM usage statistics for the conversation.
steering_messages: Option<Vec<String>>Messages queued to interrupt the agent mid-run.
They are delivered after the current tool execution and skip remaining pending tools.
follow_up_messages: Option<Vec<String>>Follow-up messages queued for the agent’s next safe user turn.
They are delivered with the current pending tool-call results when they finish, or at the next idle boundary when no tools are pending. Steering still takes priority.
child: Option<u64>The child conversation ID, if this conversation has been continued. Should not be updated after set.
ancestors: Option<Vec<u64>>The ancestor conversation IDs, ordered from root to parent. Should not be updated after creation.
label: Option<String>An optional label for the conversation, which can be used for categorization or retrieval.
extra: Option<Json>Extra information for future extensions.
This field is not indexed and should not be used for filtering or searching.
period: u64The period when the conversation was created, in hours (timestamp / 3600 / 1000). It is used to index the conversation for faster retrieval by time.
created_at: u64The timestamp when the conversation was created, in milliseconds.
updated_at: u64The timestamp when the conversation was updated, in milliseconds.
Implementations§
Source§impl Conversation
impl Conversation
Sourcepub fn schema() -> Result<Schema, SchemaError>
pub fn schema() -> Result<Schema, SchemaError>
Returns the AndaDB Schema derived from this struct’s serialized fields.
The _id primary-key column is injected automatically by the schema builder.
Generated by #[derive(AndaDBSchema)].
Source§impl Conversation
impl Conversation
Sourcepub fn append_messages(&mut self, message: Vec<Message>)
pub fn append_messages(&mut self, message: Vec<Message>)
Appends messages to the serialized chat history.
Sourcepub fn to_changes(&self) -> Result<BTreeMap<String, Fv>, BoxError>
pub fn to_changes(&self) -> Result<BTreeMap<String, Fv>, BoxError>
Converts mutable conversation fields into AndaDB update values.
Sourcepub fn to_delta(
&self,
messages_offset: usize,
artifacts_offset: usize,
) -> ConversationDelta
pub fn to_delta( &self, messages_offset: usize, artifacts_offset: usize, ) -> ConversationDelta
Builds an incremental delta from borrowed conversation data.
Sourcepub fn into_delta(
self,
messages_offset: usize,
artifacts_offset: usize,
) -> ConversationDelta
pub fn into_delta( self, messages_offset: usize, artifacts_offset: usize, ) -> ConversationDelta
Builds an incremental delta while consuming the conversation.
Trait Implementations§
Source§impl Clone for Conversation
impl Clone for Conversation
Source§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 moreSource§impl Debug for Conversation
impl Debug for Conversation
Source§impl Default for Conversation
impl Default for Conversation
Source§impl<'de> Deserialize<'de> for Conversation
impl<'de> Deserialize<'de> for Conversation
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a> From<&'a Conversation> for ConversationRef<'a>
impl<'a> From<&'a Conversation> for ConversationRef<'a>
Source§fn from(conversation: &'a Conversation) -> Self
fn from(conversation: &'a Conversation) -> Self
Source§impl From<&Conversation> for ConversationState
impl From<&Conversation> for ConversationState
Source§fn from(conversation: &Conversation) -> Self
fn from(conversation: &Conversation) -> Self
Source§impl From<Conversation> for Document
impl From<Conversation> for Document
Source§fn from(conversation: Conversation) -> Self
fn from(conversation: Conversation) -> Self
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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