airflow.providers.common.ai.durable.caching_model

Caching model wrapper for durable execution.

Attributes

log

Classes

CachingModel

Wraps a model to cache responses in ObjectStorage for durable execution.

Module Contents

airflow.providers.common.ai.durable.caching_model.log[source]
class airflow.providers.common.ai.durable.caching_model.CachingModel(wrapped, *, storage, counter)[source]

Bases: pydantic_ai.models.wrapper.WrapperModel

Wraps a model to cache responses in ObjectStorage for durable execution.

On each request() call, checks if a cached response exists for the current step index. If so, returns the cached response without calling the underlying model. Otherwise, calls the model and caches the response.

storage: airflow.providers.common.ai.durable.storage.DurableStorage[source]
counter: airflow.providers.common.ai.durable.step_counter.DurableStepCounter[source]
async request(messages, model_settings, model_request_parameters)[source]

Make a request to the model.

This is ultimately called by pydantic_ai._agent_graph.ModelRequestNode._make_request(…).

Was this entry helpful?