pub struct OpenAi { /* private fields */ }Expand description
Cloneable asynchronous OpenAI client for transcription, image analysis, and image generation.
Implementations§
Source§impl OpenAi
impl OpenAi
Sourcepub fn open(api_key: impl Into<String>) -> Result<Self>
pub fn open(api_key: impl Into<String>) -> Result<Self>
Opens a client and retains the supplied OpenAI API key in memory.
Clones share the key and HTTP connection pool. Dropping the last clone discards the retained key with best-effort zeroization.
Sourcepub async fn transcribe(
&self,
request: TranscriptionRequest,
) -> Result<Transcription>
pub async fn transcribe( &self, request: TranscriptionRequest, ) -> Result<Transcription>
Transcribes one in-memory recording with gpt-4o-transcribe.
Sourcepub async fn analyze_image(
&self,
request: ImageAnalysisRequest,
) -> Result<ImageAnalysis>
pub async fn analyze_image( &self, request: ImageAnalysisRequest, ) -> Result<ImageAnalysis>
Analyzes one in-memory image with the fixed Responses API model.
Sourcepub async fn generate_image(
&self,
request: ImageGenerationRequest,
) -> Result<ImageGeneration>
pub async fn generate_image( &self, request: ImageGenerationRequest, ) -> Result<ImageGeneration>
Generates one image with the latest GPT Image model, gpt-image-2.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for OpenAi
impl !UnwindSafe for OpenAi
impl Freeze for OpenAi
impl Send for OpenAi
impl Sync for OpenAi
impl Unpin for OpenAi
impl UnsafeUnpin for OpenAi
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