Context Segment • Rust AI Agent SDK
ContextSegment: A segment of context with token count.
ContextSegment
Defined in the context module.
Rust AI Agent SDK
A segment of context with token count.
Fields
| Name | Type | Description |
|---|---|---|
name | String | Segment name/type |
tokens | usize | Token count for this segment |
priority | i32 | Priority (higher = more important) |
content | Option<String> | Content of the segment |
Methods
new
fn new(name: impl Into<String>, tokens: usize) -> SelfCreate a new context segment
Parameters:
| Name | Type |
|---|---|
name | impl Into<String> |
tokens | usize |
priority
fn priority(mut self, priority: i32) -> SelfSet priority
Parameters:
| Name | Type |
|---|---|
priority | i32 |
content
fn content(mut self, content: impl Into<String>) -> SelfSet content
Parameters:
| Name | Type |
|---|---|
content | impl Into<String> |
Source
View on GitHubpraisonai/src/context/mod.rs at line 54