pub struct HttpTimeouts {
pub connect: Duration,
pub idle: Duration,
}Expand description
Connect and idle timeouts for a model client’s HTTP transport.
| Bound | Covers |
|---|---|
connect | establishing the connection, TLS included |
idle | each wait for data: the response headers, then every gap between body chunks of a streamed or complete response |
A request that gets no response headers within idle, a stream that stops sending data
for idle, and a complete response whose body stalls for idle all fail with
ErrorCategory::Timeout instead of holding the run, as does a connection not established
within connect; a long stream that keeps sending data is never cut off. The defaults are
30 seconds to connect and 10 minutes idle, the request timeout of the official OpenAI and
Anthropic SDKs, which leaves room for reasoning models that think for minutes before
their first token. The OpenAI-compatible, OpenAI Responses, Azure OpenAI, Azure AI, Groq,
DeepSeek, OpenRouter, Ollama, and Bedrock clients apply them by default and take others
through with_timeouts; the Gemini API-key client applies them by default and takes
others through GeminiModel::new_with_base_url_and_timeouts. Bedrock applies them as the SDK’s connect and read timeouts plus
a bound on each stream event; an SDK client passed to BedrockClient::from_client keeps
its own connect and read timeouts until with_timeouts replaces them.
§Example
use std::time::Duration;
use adk_model::HttpTimeouts;
// Fail a stream that sends nothing for two minutes; pass to a client's `with_timeouts`.
let timeouts = HttpTimeouts::new(Duration::from_secs(10), Duration::from_secs(120));
assert_eq!(timeouts.idle, Duration::from_secs(120));
assert_eq!(HttpTimeouts::default(), HttpTimeouts::new(Duration::from_secs(30), Duration::from_secs(600)));Fields§
§connect: DurationBound on establishing a connection.
idle: DurationBound on each wait for response data, headers included.
Implementations§
Trait Implementations§
Source§impl Clone for HttpTimeouts
impl Clone for HttpTimeouts
impl Copy for HttpTimeouts
Source§impl Debug for HttpTimeouts
impl Debug for HttpTimeouts
Source§impl Default for HttpTimeouts
impl Default for HttpTimeouts
impl Eq for HttpTimeouts
Source§impl PartialEq for HttpTimeouts
impl PartialEq for HttpTimeouts
impl StructuralPartialEq for HttpTimeouts
Auto Trait Implementations§
impl Forget for HttpTimeouts
impl Freeze for HttpTimeouts
impl Move for HttpTimeouts
impl RefUnwindSafe for HttpTimeouts
impl Send for HttpTimeouts
impl Sync for HttpTimeouts
impl Unpin for HttpTimeouts
impl UnsafeUnpin for HttpTimeouts
impl UnwindSafe for HttpTimeouts
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request