pub struct Config {
pub base_url: String,
pub model: String,
pub provider: String,
pub user_agent: String,
pub connect_timeout: Duration,
pub timeout: Duration,
pub max_retries: u32,
pub max_backoff: Duration,
pub pool_size: usize,
pub throttle_pause: Duration,
pub backoff_scale: f64,
}Expand description
How a Client reaches the API and how hard it tries.
Build one with Config { field: value, ..Config::default() }. Every field has a default that
suits TypeSafe’s hosted endpoint.
Fields§
§base_url: StringThe endpoint every request is POSTed to. DEFAULT_BASE_URL, or a gateway in front of
it. The URL is used as given: a token is sent to whatever host it names.
model: StringThe model name sent in every request. DEFAULT_MODEL follows TypeSafe’s latest Jev.
provider: StringWho serves the endpoint, for error messages only: TypeSafe, or the name of a gateway.
user_agent: StringThe User-Agent header. Defaults to this crate’s name and version.
connect_timeout: DurationTime allowed to open a connection.
timeout: DurationTime allowed for each of sending the request, waiting for the response and reading it.
max_retries: u32Attempts after the first for transient failures; see Error for what is transient.
max_backoff: DurationThe longest a retry’s exponential backoff grows to. The backoff starts at half a second and doubles per attempt, up to this cap, times a random factor in [0.5, 1.5).
pool_size: usizeConnections kept open, and the ceiling of the concurrency AdaptiveLimiter. Set it to
the number of threads that will call Client::ask at once.
throttle_pause: DurationHow long every thread waits after a throttled reply (HTTP 429 or 529) before the next attempt, times a random factor in [1, 2).
backoff_scale: f64Multiplies the retry backoff and any Retry-After wait. Zero makes retries immediate,
which tests want; Config::throttle_pause is separate. A negative or non-finite scale
also means no wait.