pub trait ProviderAdapter:
Send
+ Sync
+ Debug {
Show 14 methods
// Required methods
fn config(&self) -> &ProviderConfig;
fn name(&self) -> &'static str;
fn build_url<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 str,
stream: bool,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn transform_request<'life0, 'async_trait>(
&'life0 self,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn transform_response(&self, response: Value) -> Result<ApiResponse>;
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
http: &'life1 Client,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = Result<ApiResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn send_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
http: &'life1 Client,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided methods
fn model(&self, model_type: ModelType) -> &str { ... }
fn prepare_request<'life0, 'async_trait>(
&'life0 self,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = CreateMessageRequest> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn apply_auth_headers<'life0, 'async_trait>(
&'life0 self,
req: RequestBuilder,
) -> Pin<Box<dyn Future<Output = RequestBuilder> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn supports_credential_refresh(&self) -> bool { ... }
fn ensure_fresh_credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn refresh_credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn count_tokens<'life0, 'life1, 'async_trait>(
&'life0 self,
_http: &'life1 Client,
_request: CountTokensRequest,
) -> Pin<Box<dyn Future<Output = Result<CountTokensResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Required Methods§
fn config(&self) -> &ProviderConfig
fn name(&self) -> &'static str
fn build_url<'life0, 'life1, 'async_trait>(
&'life0 self,
model: &'life1 str,
stream: bool,
) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn transform_request<'life0, 'async_trait>(
&'life0 self,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transform_response(&self, response: Value) -> Result<ApiResponse>
fn send<'life0, 'life1, 'async_trait>(
&'life0 self,
http: &'life1 Client,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = Result<ApiResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn send_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
http: &'life1 Client,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Provided Methods§
fn model(&self, model_type: ModelType) -> &str
fn prepare_request<'life0, 'async_trait>(
&'life0 self,
request: CreateMessageRequest,
) -> Pin<Box<dyn Future<Output = CreateMessageRequest> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn apply_auth_headers<'life0, 'async_trait>(
&'life0 self,
req: RequestBuilder,
) -> Pin<Box<dyn Future<Output = RequestBuilder> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn supports_credential_refresh(&self) -> bool
fn ensure_fresh_credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn refresh_credentials<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn count_tokens<'life0, 'life1, 'async_trait>(
&'life0 self,
_http: &'life1 Client,
_request: CountTokensRequest,
) -> Pin<Box<dyn Future<Output = Result<CountTokensResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Implementors§
impl ProviderAdapter for AnthropicAdapter
impl ProviderAdapter for BedrockAdapter
Available on crate feature
aws only.impl ProviderAdapter for FoundryAdapter
Available on crate feature
azure only.impl ProviderAdapter for VertexAdapter
Available on crate feature
gcp only.