pub struct TranscriptionRequest { /* private fields */ }
Expand description
request that provides transcription for given audio file parameter details at https://platform.openai.com/docs/api-reference/audio/create
§Usage example
use std::path::PathBuf;
use openai_req::audio::{Iso639_1, TranscriptionRequest};
use openai_req::FormRequest;
let req = TranscriptionRequest::new(PathBuf::from("tests/Linus-linux.mp3"))
.language(Iso639_1::En);
let res = req.run(&client).await?;
Implementations§
Source§impl TranscriptionRequest
impl TranscriptionRequest
Sourcepub fn new(file: PathBuf) -> Self
pub fn new(file: PathBuf) -> Self
Minimal constructor is enough to run a request, you can get a transcription by only providing file name. But quality will be significantly better if you at least specify source language
pub fn with_model(file: PathBuf, model: String) -> Self
pub fn file(self, file: PathBuf) -> Self
pub fn model(self, model: String) -> Self
pub fn prompt(self, prompt: String) -> Self
pub fn response_format(self, response_format: ResponseFormat) -> Self
pub fn temperature(self, temperature: f64) -> Self
pub fn language(self, language: Iso639_1) -> Self
Trait Implementations§
Source§impl Clone for TranscriptionRequest
impl Clone for TranscriptionRequest
Source§fn clone(&self) -> TranscriptionRequest
fn clone(&self) -> TranscriptionRequest
Returns a copy 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 TranscriptionRequest
impl Debug for TranscriptionRequest
Source§impl<'de> Deserialize<'de> for TranscriptionRequest
impl<'de> Deserialize<'de> for TranscriptionRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FormRequest<AudioResponse> for TranscriptionRequest
impl FormRequest<AudioResponse> for TranscriptionRequest
const ENDPOINT: &'static str = "/audio/transcriptions"
fn run<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 OpenAiClient,
) -> Pin<Box<dyn Future<Output = Result<AudioResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
client: &'life1 Client,
final_url: String,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Auto Trait Implementations§
impl Freeze for TranscriptionRequest
impl RefUnwindSafe for TranscriptionRequest
impl Send for TranscriptionRequest
impl Sync for TranscriptionRequest
impl Unpin for TranscriptionRequest
impl UnwindSafe for TranscriptionRequest
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