Interceptors#

Interceptors provide fine-grained control over request and response processing during model evaluation through a configurable pipeline architecture.

Overview#

The adapter system processes model API calls through a configurable pipeline of interceptors. Each interceptor can inspect, modify, or augment requests and responses as they flow through the evaluation process.

        graph LR
    A[Evaluation Request] --> B[Adapter System]
    B --> C[Interceptor Pipeline]
    C --> D[Model API]
    D --> E[Response Pipeline]
    E --> F[Processed Response]
    
    subgraph "Request Processing"
        C --> G[System Message]
        G --> H[Payload Modifier]
        H --> I[Request Logging]
        I --> J[Caching Check]
        J --> K[Endpoint Call]
    end
    
    subgraph "Response Processing"
        E --> L[Response Logging]
        L --> M[Reasoning Extraction]
        M --> N[Progress Tracking]
        N --> O[Cache Storage]
    end
    
    style B fill:#f3e5f5
    style C fill:#e1f5fe
    style E fill:#e8f5e8
    

Request Interceptors#

System Messages

Modify system messages in requests.

System Messages
Payload Modification

Add, remove, or modify request parameters.

Payload Modification
Request Logging

Logs requests for debugging, analysis, and audit purposes.

Request Logging Interceptor

Request-Response Interceptors#

Caching

Cache requests and responses to improve performance and reduce API calls.

Caching
Endpoint

Communicates with the model endpoint.

Endpoint Interceptor

Response#

Response Logging

Logs responses for debugging, analysis, and audit purposes.

Response Logging Interceptor
Progress Tracking

Track evaluation progress and status updates.

Progress Tracking
Raising on Client Errors

Allows to fail fast on non-retryable client errors

Raise Client Error Interceptor
Reasoning

Handle reasoning tokens and track reasoning metrics.

Reasoning
Response Statistics

Collects statistics from API responses for metrics collection and analysis.

Response Stats Interceptor

Process Post-Evaluation Results#

Post-Evaluation Hooks

Run additional processing, reporting, or cleanup after evaluations complete.

Post-Evaluation Hooks