Types API¶
pydantic_ai_summarization.types
¶
Type definitions for summarization-pydantic-ai.
TokenCounter = Callable[[Sequence[ModelMessage]], int]
module-attribute
¶
ContextSize = ContextFraction | ContextTokens | ContextMessages
module-attribute
¶
Union type for all context size specifications.
Can be:
- ("fraction", float) - fraction of max_input_tokens (requires max_input_tokens)
- ("tokens", int) - absolute token count
- ("messages", int) - message count
Examples:
ContextFraction = tuple[Literal['fraction'], float]
module-attribute
¶
Context size specified as a fraction of max_input_tokens.
Example: ("fraction", 0.8) means 80% of max_input_tokens.
ContextTokens = tuple[Literal['tokens'], int]
module-attribute
¶
Context size specified as an absolute token count.
Example: ("tokens", 100000) means 100,000 tokens.
ContextMessages = tuple[Literal['messages'], int]
module-attribute
¶
Context size specified as a message count.
Example: ("messages", 50) means 50 messages.