pub struct AgentState {
pub input: String,
pub messages: Vec<MessageEntry>,
pub steps: Vec<StepEntry>,
pub output: Option<String>,
}Expand description
Common state with messages (agent-style)
This provides a pre-built state schema for agent-style graphs that track messages through the execution.
Fields§
§input: StringInput query
messages: Vec<MessageEntry>Chat messages history
steps: Vec<StepEntry>Intermediate steps
output: Option<String>Output result
Implementations§
Source§impl AgentState
impl AgentState
Sourcepub fn add_message(&mut self, message: MessageEntry)
pub fn add_message(&mut self, message: MessageEntry)
Add a message to history
Sourcepub fn set_output(&mut self, output: String)
pub fn set_output(&mut self, output: String)
Set output
Trait Implementations§
Source§impl Clone for AgentState
impl Clone for AgentState
Source§fn clone(&self) -> AgentState
fn clone(&self) -> AgentState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgentState
impl Debug for AgentState
Source§impl<'de> Deserialize<'de> for AgentState
impl<'de> Deserialize<'de> for AgentState
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Reducer<AgentState> for AppendMessagesReducer
impl Reducer<AgentState> for AppendMessagesReducer
Source§fn reduce(&self, current: &AgentState, update: &AgentState) -> AgentState
fn reduce(&self, current: &AgentState, update: &AgentState) -> AgentState
Reduce current state with an update
Source§impl Reducer<AgentState> for AppendStepsReducer
impl Reducer<AgentState> for AppendStepsReducer
Source§fn reduce(&self, current: &AgentState, update: &AgentState) -> AgentState
fn reduce(&self, current: &AgentState, update: &AgentState) -> AgentState
Reduce current state with an update
Source§impl Serialize for AgentState
impl Serialize for AgentState
Source§impl StateSchema for AgentState
impl StateSchema for AgentState
Auto Trait Implementations§
impl Freeze for AgentState
impl RefUnwindSafe for AgentState
impl Send for AgentState
impl Sync for AgentState
impl Unpin for AgentState
impl UnsafeUnpin for AgentState
impl UnwindSafe for AgentState
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
Mutably borrows from an owned value. Read more