Skip to main content

ContextLedger

Defined in the models module.
AI Agent Tracks token usage across context segments. Provides per-segment token counts and total usage.

Properties

int
No description available.
int
No description available.
int
No description available.
int
No description available.
int
No description available.
int
No description available.
int
No description available.
int
No description available.
int
No description available.
int
No description available.
int
No description available.

Methods

total()

Total tokens across all segments.

get_segment()

Get token count for a segment.

set_segment()

Set token count for a segment.

add_segment()

Add tokens to a segment.
  • to_dict: Convert to dictionary.
  • copy: Create a copy of this ledger.

Source

View on GitHub

praisonaiagents/context/models.py at line 26

Context Concept

Context Management

Context Strategies