Skip to main content

ContextSegment

Defined in the context module.
Rust AI Agent SDK A segment of context with token count.

Fields

NameTypeDescription
nameStringSegment name/type
tokensusizeToken count for this segment
priorityi32Priority (higher = more important)
contentOption<String>Content of the segment

Methods

new

fn new(name: impl Into<String>, tokens: usize) -> Self
Create a new context segment Parameters:
NameType
nameimpl Into&lt;String&gt;
tokensusize

priority

fn priority(mut self, priority: i32) -> Self
Set priority Parameters:
NameType
priorityi32

content

fn content(mut self, content: impl Into<String>) -> Self
Set content Parameters:
NameType
contentimpl Into&lt;String&gt;

Source

View on GitHub

praisonai/src/context/mod.rs at line 54