Skip to main content

ContextAgent

Defined in the specialized module.
Rust AI Agent SDK Context agent for managing conversation context

Fields

NameTypeDescription
configContextAgentConfigConfiguration
contextVec<ContextEntry>Context window
max_entriesusizeMaximum entries

Methods

new

fn new(config: ContextAgentConfig) -> Self
Create a new context agent Parameters:
NameType
configContextAgentConfig

add

fn add(&mut self, role: impl Into<String>, content: impl Into<String>) -> ()
Add an entry to context Parameters:
NameType
roleimpl Into&lt;String&gt;
contentimpl Into&lt;String&gt;

get_context

fn get_context(&self) -> Vec<&ContextEntry>
Get context as messages

clear

fn clear(&mut self) -> ()
Clear context

len

fn len(&self) -> usize
Get context length

is_empty

fn is_empty(&self) -> bool
Check if context is empty

Source

View on GitHub

praisonai/src/parity/specialized.rs at line 46