pub struct OpenAiSocket { /* private fields */ }Expand description
OpenAI’s persistent Responses WebSocket transport.
Implementations§
Source§impl OpenAiSocket
impl OpenAiSocket
Sourcepub fn new(api_key: impl Into<String>, model: impl Into<String>) -> Result<Self>
pub fn new(api_key: impl Into<String>, model: impl Into<String>) -> Result<Self>
Creates the first-party Responses transport with HTTP fallback.
Sourcepub fn with_reasoning_effort(self, effort: impl Into<String>) -> Result<Self>
pub fn with_reasoning_effort(self, effort: impl Into<String>) -> Result<Self>
Selects a Responses reasoning effort.
Sourcepub fn with_web_search(self) -> Self
pub fn with_web_search(self) -> Self
Enables provider-hosted live web search.
Sourcepub fn with_cached_web_search(self) -> Self
pub fn with_cached_web_search(self) -> Self
Enables provider-hosted cached-only web search.
Trait Implementations§
Source§impl Model for OpenAiSocket
impl Model for OpenAiSocket
Source§fn supports_image_input(&self) -> bool
fn supports_image_input(&self) -> bool
Reports whether this provider accepts native image input.
Source§fn supports_realtime_voice(&self) -> bool
fn supports_realtime_voice(&self) -> bool
Reports whether this transport can negotiate a provider-owned realtime voice call.
Source§fn start_realtime_voice(
&self,
request: RealtimeVoiceRequest,
) -> BoxFuture<'_, Result<RealtimeVoiceCall>>
fn start_realtime_voice( &self, request: RealtimeVoiceRequest, ) -> BoxFuture<'_, Result<RealtimeVoiceCall>>
Negotiates voice media without exposing provider credentials to the frontend.
Source§fn prompt_cache_capability(&self) -> PromptCacheMode
fn prompt_cache_capability(&self) -> PromptCacheMode
Reports the provider’s prompt-cache mode without exposing transport details.
Source§fn tool_discovery(&self) -> ToolDiscoveryMode
fn tool_discovery(&self) -> ToolDiscoveryMode
Reports how this route makes deferred tool schemas callable.
Source§fn pricing(&self) -> Option<ModelPricing>
fn pricing(&self) -> Option<ModelPricing>
Returns current token pricing when this provider owns a known billing schedule.
Source§fn respond<'a>(
&'a self,
request: ModelRequest<'a>,
events: ModelEventSink,
) -> BoxFuture<'a, Result<ModelOutput>>
fn respond<'a>( &'a self, request: ModelRequest<'a>, events: ModelEventSink, ) -> BoxFuture<'a, Result<ModelOutput>>
Produces one streamed response. Read more
Source§fn compaction_endpoint(&self) -> bool
fn compaction_endpoint(&self) -> bool
Reports whether this provider exposes a native compaction endpoint.
Source§fn compact<'a>(
&'a self,
request: CompactRequest<'a>,
) -> BoxFuture<'a, Result<CompactOutput>>
fn compact<'a>( &'a self, request: CompactRequest<'a>, ) -> BoxFuture<'a, Result<CompactOutput>>
Calls the native history-compaction endpoint when advertised.
Auto Trait Implementations§
impl !Freeze for OpenAiSocket
impl !RefUnwindSafe for OpenAiSocket
impl !UnwindSafe for OpenAiSocket
impl Send for OpenAiSocket
impl Sync for OpenAiSocket
impl Unpin for OpenAiSocket
impl UnsafeUnpin for OpenAiSocket
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