pub struct OpenAiHandler;Trait Implementations§
Source§impl ProtocolHandler for OpenAiHandler
impl ProtocolHandler for OpenAiHandler
Source§fn endpoint_path(&self) -> &str
fn endpoint_path(&self) -> &str
URL path for the API endpoint (appended to the base URL).
Source§fn auth_headers(&self, api_key: &str) -> Vec<(String, String)>
fn auth_headers(&self, api_key: &str) -> Vec<(String, String)>
Build HTTP headers for authentication.
Source§fn build_request_body(&self, req: &ApiRequest) -> Value
fn build_request_body(&self, req: &ApiRequest) -> Value
Build the JSON request body from unified ApiRequest.
Source§fn parse_response(&self, body: &str) -> Result<ApiResponse, InferenceError>
fn parse_response(&self, body: &str) -> Result<ApiResponse, InferenceError>
Parse a complete (non-streaming) response body into ApiResponse.
Source§fn parse_stream_event(&self, _event_type: &str, data: &str) -> Vec<StreamEvent>
fn parse_stream_event(&self, _event_type: &str, data: &str) -> Vec<StreamEvent>
Parse a single SSE line into StreamEvents (for streaming responses).
Returns multiple events when a single SSE chunk contains multiple tool calls.
Source§fn build_messages(
&self,
messages: &[Message],
prompt: &str,
context: Option<&str>,
images: Option<&[ContentBlock]>,
) -> (Vec<Value>, Option<String>)
fn build_messages( &self, messages: &[Message], prompt: &str, context: Option<&str>, images: Option<&[ContentBlock]>, ) -> (Vec<Value>, Option<String>)
Convert conversation Messages to this protocol’s message format.
Source§fn build_tools(&self, tools: &[Value]) -> Vec<Value>
fn build_tools(&self, tools: &[Value]) -> Vec<Value>
Convert tool definitions to this protocol’s format.
Source§fn protocol_name(&self) -> &'static str
fn protocol_name(&self) -> &'static str
Backend identifier used in
UnsupportedMode error messages.
Handlers override to something recognizable (e.g. “openai”,
“anthropic-messages-v1”).Source§fn supports_streaming(&self) -> bool
fn supports_streaming(&self) -> bool
Whether this protocol supports streaming.
Source§fn supports_thinking(&self) -> bool
fn supports_thinking(&self) -> bool
Whether this protocol supports extended thinking.
Source§fn supports_video(&self) -> bool
fn supports_video(&self) -> bool
Whether this protocol accepts video content blocks natively on
the generation endpoint. Defaults to
false. When a request
carries a video block and the selected protocol returns
false, RemoteBackend::execute_request rejects the call
with InferenceError::UnsupportedMode rather than silently
downgrading the video to a text placeholder.Source§fn supports_audio(&self) -> bool
fn supports_audio(&self) -> bool
Whether this protocol accepts audio content blocks natively.
Same contract as [
supports_video] — false means the remote
backend pre-check returns UnsupportedMode instead of
silently stringifying the audio reference.Auto Trait Implementations§
impl Freeze for OpenAiHandler
impl RefUnwindSafe for OpenAiHandler
impl Send for OpenAiHandler
impl Sync for OpenAiHandler
impl Unpin for OpenAiHandler
impl UnsafeUnpin for OpenAiHandler
impl UnwindSafe for OpenAiHandler
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more