pub struct AzureOpenAiAdapter { /* private fields */ }Expand description
Adapter for Azure OpenAI Service.
Azure OpenAI uses deployment-based URLs instead of passing the model name
in the request body. The adapter constructs the correct URL and adds the
required api-version query parameter.
Implementations§
Source§impl AzureOpenAiAdapter
impl AzureOpenAiAdapter
Sourcepub fn new(base_url: impl Into<String>, deployment: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>, deployment: impl Into<String>) -> Self
Create a new Azure OpenAI adapter.
§Arguments
base_url- Azure resource URL (e.g.,https://myresource.openai.azure.com)deployment- Deployment name (e.g.,gpt-4o)
Sourcepub fn with_api_version(self, version: impl Into<String>) -> Self
pub fn with_api_version(self, version: impl Into<String>) -> Self
Set a custom API version.
Trait Implementations§
Source§impl Clone for AzureOpenAiAdapter
impl Clone for AzureOpenAiAdapter
Source§fn clone(&self) -> AzureOpenAiAdapter
fn clone(&self) -> AzureOpenAiAdapter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AzureOpenAiAdapter
impl Debug for AzureOpenAiAdapter
Source§impl ProviderAdapter for AzureOpenAiAdapter
impl ProviderAdapter for AzureOpenAiAdapter
Source§fn provider_name(&self) -> &str
fn provider_name(&self) -> &str
Provider identifier (e.g., “openai”, “anthropic”).
Source§fn convert_request(&self, payload: Value) -> Value
fn convert_request(&self, payload: Value) -> Value
Convert an internal Chat Completions payload to provider-specific format. Read more
Source§fn convert_response(&self, response: Value) -> Value
fn convert_response(&self, response: Value) -> Value
Convert a provider-specific response back to Chat Completions format. Read more
Source§fn extra_headers(&self) -> Vec<(String, String)>
fn extra_headers(&self) -> Vec<(String, String)>
Get required headers for this provider (e.g., api-version, anthropic-version).
Source§fn supports_streaming(&self) -> bool
fn supports_streaming(&self) -> bool
Whether this adapter supports streaming responses.
Source§fn enable_streaming(&self, _payload: &mut Value)
fn enable_streaming(&self, _payload: &mut Value)
Add streaming parameters to the request payload. Read more
Source§fn streaming_url(&self, base_url: &str) -> Option<String>
fn streaming_url(&self, base_url: &str) -> Option<String>
Get the streaming API URL, if different from the regular API URL. Read more
Source§fn parse_stream_event(
&self,
_event_type: &str,
_data: &Value,
) -> Option<StreamEvent>
fn parse_stream_event( &self, _event_type: &str, _data: &Value, ) -> Option<StreamEvent>
Parse a single SSE event into a stream event. Read more
Auto Trait Implementations§
impl Freeze for AzureOpenAiAdapter
impl RefUnwindSafe for AzureOpenAiAdapter
impl Send for AzureOpenAiAdapter
impl Sync for AzureOpenAiAdapter
impl Unpin for AzureOpenAiAdapter
impl UnsafeUnpin for AzureOpenAiAdapter
impl UnwindSafe for AzureOpenAiAdapter
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