pub struct AnthropicProvider { /* private fields */ }Expand description
The live Anthropic Messages Provider (non-streaming).
Implementations§
Source§impl AnthropicProvider
impl AnthropicProvider
Sourcepub fn new(config: ModelConfig) -> Result<AnthropicProvider, ProviderError>
pub fn new(config: ModelConfig) -> Result<AnthropicProvider, ProviderError>
Build a provider from a resolved ModelConfig.
§Errors
ProviderError::Transport when the HTTP client cannot be constructed.
Sourcepub fn from_env() -> Result<AnthropicProvider, ProviderError>
pub fn from_env() -> Result<AnthropicProvider, ProviderError>
Build from the environment (LOCODE_API_KEY / LOCODE_BASE_URL /
LOCODE_MODEL).
§Errors
ProviderError::Auth when the key is missing;
ProviderError::Transport when the HTTP client cannot be constructed.
Sourcepub fn with_retry_policy(self, retry: RetryPolicy) -> AnthropicProvider
pub fn with_retry_policy(self, retry: RetryPolicy) -> AnthropicProvider
Override the transport retry policy.
Sourcepub fn with_auth_refresh(
self,
refresh: Arc<dyn AuthRefresh>,
) -> AnthropicProvider
pub fn with_auth_refresh( self, refresh: Arc<dyn AuthRefresh>, ) -> AnthropicProvider
Install a credential refresher for the 401 refresh-once path.
Sourcepub fn config(&self) -> &ModelConfig
pub fn config(&self) -> &ModelConfig
The active config (read-only view).
Trait Implementations§
Source§impl Provider for AnthropicProvider
impl Provider for AnthropicProvider
Source§fn api_schema(&self) -> &str
fn api_schema(&self) -> &str
Source§fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ConversationRequest,
) -> Pin<Box<dyn Future<Output = Result<Completion, ProviderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
AnthropicProvider: 'async_trait,
fn complete<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 ConversationRequest,
) -> Pin<Box<dyn Future<Output = Result<Completion, ProviderError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
AnthropicProvider: 'async_trait,
Sample one completion for
request. Read moreAuto Trait Implementations§
impl !Freeze for AnthropicProvider
impl !RefUnwindSafe for AnthropicProvider
impl !UnwindSafe for AnthropicProvider
impl Send for AnthropicProvider
impl Sync for AnthropicProvider
impl Unpin for AnthropicProvider
impl UnsafeUnpin for AnthropicProvider
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
Mutably borrows from an owned value. Read more