ractogateway.cache._models
Shared data models for caching subsystem.
- class ractogateway.cache._models.CacheConfig(**data)[source]
Bases:
BaseModelConfiguration for cache instances.
- Parameters:
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- max_size: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ractogateway.cache._models.CacheEntry(**data)[source]
Bases:
BaseModelA single cached LLM response.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- response: LLMResponse
- created_at: float
- hit_count: int
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ractogateway.cache._models.CacheStats(**data)[source]
Bases:
BaseModelSnapshot of cache performance counters.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- hits: int
- misses: int
- size: int
- property total: int
Total requests seen by the cache.
- property hit_rate: float
Fraction of requests that were cache hits (0.0-1.0).
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ractogateway.cache._models.SemanticCacheConfig(**data)[source]
Bases:
BaseModelConfiguration for the semantic similarity cache.
- Parameters:
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- threshold: float
- max_size: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class ractogateway.cache._models.SemanticCacheEntry(**data)[source]
Bases:
BaseModelOne entry in the semantic cache, pairing an embedding with a response.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- response: LLMResponse
- created_at: float
- hit_count: int
- model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].