Class ReplayProvider

Assembly: redb.Route.Llm.dll

Deterministic backed by a JSON fixture on disk.
In the provider replays previously recorded
responses keyed by a stable hash of the request — no network IO. In
it calls an inner provider and persists
every response. mixes the two, falling
through to the inner provider for cache misses and appending the result.

Designed for integration tests, eval-harness fixtures and offline demos —
keeps reference runs deterministic and free of API spend while still being
upgradable by re-recording against a real provider.

public sealed class ReplayProvider : ILlmProvider

Inheritance

Object→ReplayProvider

Implements

Properties

EntryCount

Number of entries currently held in the in-memory fixture.

public int EntryCount { get; }

ModelId

Model identifier this provider was configured with.

public string ModelId { get; }

ProviderId

Provider identifier ("anthropic", "openai", "stub", ...).

public string ProviderId { get; }

Methods

CompleteAsync(LlmRequest, CancellationToken)

Performs a single non-streaming completion call.

public Task<LlmResponse> CompleteAsync(LlmRequest request, CancellationToken ct = default)

Flush()

Manually persists the in-memory fixture to disk. Called automatically on append.

public void Flush()

StreamAsync(LlmRequest, CancellationToken)

Performs a streaming completion. Yields the pieces as they arrive (visible text as

public IAsyncEnumerable<LlmStreamChunk> StreamAsync(LlmRequest request, CancellationToken ct = default)

Constructors

ReplayProvider(string, ReplayMode, ILlmProvider?, string, string)

Creates a replay provider bound to a fixture file.