pub struct EndpointAdapter { /* private fields */ }Expand description
A protocol-dispatching adapter for explicitly configured endpoints.
The caller selects the protocol, path, and auth through EndpointSpec.
The adapter never infers them from a base URL.
Implementations§
Source§impl EndpointAdapter
impl EndpointAdapter
Sourcepub fn new(model: impl Into<String>, endpoint: EndpointSpec) -> Self
pub fn new(model: impl Into<String>, endpoint: EndpointSpec) -> Self
Create an adapter for the given model and endpoint specification.
The EndpointSpec selects the wire protocol (OpenAI Chat,
OpenAI Responses, Anthropic Messages, or Gemini generateContent),
the request path, and the auth style.
Sourcepub fn api_key(self, api_key: impl Into<String>) -> Self
pub fn api_key(self, api_key: impl Into<String>) -> Self
Set an explicit API key, taking precedence over the environment.
Sourcepub fn api_key_from_env(self, env_name: impl Into<String>) -> Self
pub fn api_key_from_env(self, env_name: impl Into<String>) -> Self
Read the API key from the given environment variable at request time.
Sourcepub fn retry_policy(self, retry_policy: RetryPolicy) -> Self
pub fn retry_policy(self, retry_policy: RetryPolicy) -> Self
Override the retry policy used for failed requests.
Sourcepub fn transport(self, transport: TransportConfig) -> Self
pub fn transport(self, transport: TransportConfig) -> Self
Configure transport-level settings (timeouts, proxies, audit hooks).
Sourcepub fn model_profile(self, profile: ModelProfile) -> Self
pub fn model_profile(self, profile: ModelProfile) -> Self
Add a model-level profile. The first matching profile wins.
Sourcepub fn model_profiles(
self,
profiles: impl IntoIterator<Item = ModelProfile>,
) -> Self
pub fn model_profiles( self, profiles: impl IntoIterator<Item = ModelProfile>, ) -> Self
Add multiple model-level profiles. The first matching profile wins.
Sourcepub fn endpoint(&self) -> &EndpointSpec
pub fn endpoint(&self) -> &EndpointSpec
The endpoint specification this adapter dispatches to.
Trait Implementations§
Source§impl ModelAdapter for EndpointAdapter
impl ModelAdapter for EndpointAdapter
Source§fn provider_name(&self) -> &'static str
fn provider_name(&self) -> &'static str
"anthropic-messages".Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
"claude-sonnet-4".Source§fn complete_with<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ChatRequest,
options: &'life2 RequestOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete_with<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ChatRequest,
options: &'life2 RequestOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
RequestOptions. Read moreSource§fn stream_with<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ChatRequest,
options: &'life2 RequestOptions,
) -> Pin<Box<dyn Future<Output = Result<ModelStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stream_with<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 ChatRequest,
options: &'life2 RequestOptions,
) -> Pin<Box<dyn Future<Output = Result<ModelStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
RequestOptions. Read more