ChatClientOptions
Options & Configuration · AiDotNet.Configuration
Everything a chat client needs around it: defaults, retry policy, timeouts, filters, and recording.
For Beginners
These are the settings that surround your AI model: how many times to retry when the network hiccups, how long to wait before giving up on one call, any extra filters you want on every call, and whether to save the answers so you can replay them later. Sensible defaults are already set — three retries with growing waits — so you usually only touch this when you want recording or a hard timeout.
How It Works
A raw IChatClient is a transport. Making it usable in a long unattended run means wrapping it
in a retry policy, a time limit, whatever filters the application needs, and — for anything that has to be
reproducible — a recorder. These options describe that wrapping once, in one place, and
ChatClientPipelineFactory assembles it, so the same behaviour applies whether the underlying
client is a cloud connector, a local engine, or a bridge to another library.
Retry settings live here rather than on a connector base class, which is what makes them apply to every backend rather than only the HTTP ones, and settable by the caller rather than only by a subclass. The reference OpenEvolve implementation hard-codes three retries with a constant five-second delay for its OpenAI path and additionally hands the same retry count to the provider SDK, so a configured three can become sixteen HTTP attempts; exactly one retry layer is applied here.
RecordingMode is the setting that decides whether an experiment can be repeated.
Record once against a live provider, commit the file named by
RecordingPath, and every later run under Replay reproduces
the same answers offline, at no cost, forever.
Constructors
| Constructor | Summary |
|---|---|
ChatClientOptions() |
Properties
| Property | Summary |
|---|---|
ChatClientRecordingMode RecordingMode { get; set; } |
Gets or sets whether calls are live, recorded, or replayed. |
ChatOptions DefaultChatOptions { get; set; } |
Gets or sets settings applied to every call beneath the caller’s own per-call settings. |
IChatInteractionStore InteractionStore { get; set; } |
Gets or sets the store recorded answers are written to and replayed from. |
IList<IChatMiddleware> Middleware { get; set; } |
Gets or sets the filters applied to every call, outermost first. |
TimeSpan RetryBaseDelay { get; set; } |
Gets or sets the wait before the first retry, which doubles for each subsequent retry. |
TimeSpan RetryMaxDelay { get; set; } |
Gets or sets the ceiling on any single retry wait. |
TimeSpan? CallTimeout { get; set; } |
Gets or sets the time limit for one attempt, or null for no per-attempt limit. |
bool EnableTelemetry { get; set; } |
Gets or sets whether an OpenTelemetry span and counters are emitted for each call. |
double RetryJitterFactor { get; set; } |
Gets or sets the fraction of each retry wait that is randomized, from 0 to 1. |
int MaxRetries { get; set; } |
Gets or sets the number of retries after the first attempt; 0 disables retrying. |
string RecordingPath { get; set; } |
Gets or sets the file a default interaction store reads and writes. |
string ReplayModelId { get; set; } |
Gets or sets the model id recordings are looked up under, or null to use the wrapped client’s. |
ulong RetryJitterSeed { get; set; } |
Gets or sets the seed for the retry jitter stream, so a run’s waits are reproducible. |
Methods
| Method | Summary |
|---|---|
ChatClientOptions Clone() |
Creates an independent copy so a running pipeline is unaffected by later mutation. |
IChatInteractionStore ResolveInteractionStore() |
Gets the interaction store to use, creating a file-backed one from the path when needed. |
void Validate() |
Validates the retry policy, the timeout, the filter list, and the recording configuration. |