pub struct AgentExecutionContext {
pub cached_token_count: usize,
}Expand description
Agent 运行时上下文 — 不可持久化的执行期缓存。
Fields§
§cached_token_count: usize消息历史的估算 Token 数(与 messages 同步更新)
Implementations§
Source§impl AgentExecutionContext
impl AgentExecutionContext
Sourcepub fn add_tokens(&mut self, tokens: usize)
pub fn add_tokens(&mut self, tokens: usize)
新增 token 时累加缓存。
Sourcepub fn reset_after_compact(&mut self, messages: &[Message])
pub fn reset_after_compact(&mut self, messages: &[Message])
compact 后重新计算缓存。
Trait Implementations§
Source§impl Clone for AgentExecutionContext
impl Clone for AgentExecutionContext
Source§fn clone(&self) -> AgentExecutionContext
fn clone(&self) -> AgentExecutionContext
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 moreAuto Trait Implementations§
impl Freeze for AgentExecutionContext
impl RefUnwindSafe for AgentExecutionContext
impl Send for AgentExecutionContext
impl Sync for AgentExecutionContext
impl Unpin for AgentExecutionContext
impl UnsafeUnpin for AgentExecutionContext
impl UnwindSafe for AgentExecutionContext
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