ExLLM.Testing.TestResponseInterceptor (ex_llm v0.8.1)
View SourceAutomatically intercept and cache responses during tests.
This module hooks into the HTTPClient request/response cycle to provide automatic cache key generation, rich metadata capture, and streaming response reassembly for the test caching system.
Summary
Functions
Build comprehensive metadata for cached responses.
Generate cache key from request parameters and test context.
Generate a unique signature for the request to differentiate similar requests.
Handle streaming response caching.
Intercept a request and check for cached response.
Record cache hit for statistics.
Record cache miss for statistics.
Save response after successful request.
Check if request should be intercepted for caching.
Types
Functions
Build comprehensive metadata for cached responses.
Generate cache key from request parameters and test context.
Generate a unique signature for the request to differentiate similar requests.
Handle streaming response caching.
@spec intercept_request(String.t(), map(), list(), keyword()) :: intercept_result()
Intercept a request and check for cached response.
Record cache hit for statistics.
Record cache miss for statistics.
Save response after successful request.
@spec should_intercept_request?() :: boolean()
Check if request should be intercepted for caching.