cayu.context.counting
Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.
ContextCountingConfig
Section titled “ContextCountingConfig”from cayu.context import ContextCountingConfigRuntime controls for pre-call input token counting.
observe records provider counts and reconciles them against completed
model usage when available. It does not enforce budgets or mutate context.
Provider-backed counters may make an extra provider request, so this is
observability/debugging infrastructure rather than a default overflow guard.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
mode |
ContextCountingMode |
ContextCountingMode.OFF |
validate_mode (method)
Section titled “validate_mode (method)”ContextCountingConfig.validate_mode(value: object) -> ContextCountingModeRelease source · Runtime guarantees · Capability guides
ContextCountingMode
Section titled “ContextCountingMode”from cayu.context import ContextCountingModeBases: StrEnum.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
OFF |
class attribute |
'off' |
OBSERVE |
class attribute |
'observe' |
Release source · Runtime guarantees · Capability guides
copy_context_counting_config
Section titled “copy_context_counting_config”from cayu.context import copy_context_counting_configcopy_context_counting_config(config: ContextCountingConfig | None) -> ContextCountingConfig