pub struct ClientBuilder { /* private fields */ }Expand description
Builder for Client. Explicit settings win over environment variables; empty or
whitespace-only environment values are ignored.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn api_key(self, key: impl Into<String>) -> Self
pub fn api_key(self, key: impl Into<String>) -> Self
API key (else TYPESAFE_API_KEY). Surrounding whitespace is trimmed; an empty key, or one
with whitespace, control or non-ASCII characters inside it, is rejected by build.
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
API root (else TYPESAFE_BASE_URL, else https://api.typesafe.ai).
Sourcepub fn model(self, model: impl Into<String>) -> Self
pub fn model(self, model: impl Into<String>) -> Self
Default model (else TYPESAFE_DEFAULT_MODEL, else jev-latest).
Sourcepub fn retry(self, policy: RetryPolicy) -> Self
pub fn retry(self, policy: RetryPolicy) -> Self
Default retry policy.
Sourcepub fn header(self, name: HeaderName, value: HeaderValue) -> Self
pub fn header(self, name: HeaderName, value: HeaderValue) -> Self
Extra header sent with every request. Authentication and SDK identification headers cannot be overridden.
Sourcepub fn record(self, dir: impl Into<PathBuf>) -> Self
pub fn record(self, dir: impl Into<PathBuf>) -> Self
Write each successful System One response to <dir>/<key>.json (else TYPESAFE_RECORD).
The directory is created if needed. See cassette.
Sourcepub fn replay(self, dir: impl Into<PathBuf>) -> Self
pub fn replay(self, dir: impl Into<PathBuf>) -> Self
Answer System One calls from <dir>/<key>.json instead of the network (else
TYPESAFE_REPLAY); no API key is needed. A request that was never recorded fails with
Error::ReplayMiss. See cassette.
Sourcepub fn http_client(self, client: Client) -> Self
pub fn http_client(self, client: Client) -> Self
Use your own reqwest::Client (proxies, TLS, connection pools…). Requires the
reqwest-client feature.