Expand description
Shared utilities for LLM request/response processing
This module provides common functions used across multiple providers to eliminate duplicate code and reduce allocations.
Functionsยง
- estimate_
token_ count - Count the number of tokens in
textusing tiktoken BPE. - parse_
stream_ event_ openai_ format - Parse stream event from OpenAI-compatible format
- truncate_
to_ token_ limit - Truncate
textto at mostmax_tokenstokens.