pub struct AnthropicFoundryClient { /* private fields */ }Expand description
An Anthropic Messages API transport for Claude models hosted on Azure AI
Foundry (POST {base_url}{path}).
See the module docs for how this relates to
AnthropicClient and for the caveats around the
default path/anthropic_version.
Implementations§
Source§impl AnthropicFoundryClient
impl AnthropicFoundryClient
Sourcepub fn with_token_credential(
base_url: impl Into<String>,
model: impl Into<String>,
credential: Arc<dyn TokenCredential>,
) -> Self
pub fn with_token_credential( base_url: impl Into<String>, model: impl Into<String>, credential: Arc<dyn TokenCredential>, ) -> Self
Create a client authenticating via a TokenCredential (Microsoft
Entra ID) against a Foundry Anthropic deployment’s base_url.
Sourcepub fn with_scope(self, scope: impl Into<String>) -> Self
pub fn with_scope(self, scope: impl Into<String>) -> Self
Override the Entra ID scope requested for the bearer token (default
DEFAULT_SCOPE).
Sourcepub fn with_path(self, path: impl Into<String>) -> Self
pub fn with_path(self, path: impl Into<String>) -> Self
Override the path suffix appended to base_url (default
DEFAULT_PATH). See the module docs for why this may need
adjusting per deployment.
Sourcepub fn with_anthropic_version(
self,
anthropic_version: impl Into<String>,
) -> Self
pub fn with_anthropic_version( self, anthropic_version: impl Into<String>, ) -> Self
Override the anthropic_version sent in the request body (default
ANTHROPIC_FOUNDRY_VERSION). See the module docs for why
this may need adjusting per deployment.
Sourcepub fn with_max_tokens(self, max_tokens: u32) -> Self
pub fn with_max_tokens(self, max_tokens: u32) -> Self
Override the default max_tokens sent when ChatOptions::max_tokens
is unset (the Anthropic Messages API requires this field).
Trait Implementations§
Source§impl ChatClient for AnthropicFoundryClient
impl ChatClient for AnthropicFoundryClient
Source§fn get_streaming_response<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
options: ChatOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_streaming_response<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
options: ChatOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get a streaming response.
Whether (and how) a given Foundry Anthropic deployment streams is one
more thing this crate can’t assume stably across deployments (see the
module docs), so this calls the same non-streaming endpoint
ChatClient::get_response does and adapts the complete
ChatResponse into a single ChatResponseUpdate — the same
tactic crate::bedrock::AnthropicBedrockClient::get_streaming_response
and crate::vertex::AnthropicVertexClient::get_streaming_response
use. Callers driving this client through
ChatResponse::from_updates
still get a correct aggregated result; they just don’t see partial
text arrive incrementally.
Source§fn get_response<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
options: ChatOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_response<'life0, 'async_trait>(
&'life0 self,
messages: Vec<Message>,
options: ChatOptions,
) -> Pin<Box<dyn Future<Output = Result<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl Clone for AnthropicFoundryClient
impl Clone for AnthropicFoundryClient
Source§fn clone(&self) -> AnthropicFoundryClient
fn clone(&self) -> AnthropicFoundryClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more