pub struct TranslationRequest { /* private fields */ }Expand description
request that provides translation to english 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::TranslationRequest;
use openai_req::FormRequest;
let req = TranslationRequest::new(PathBuf::from("tests/Linus-linux.mp3"));
let res = req.run(&client).await?;Implementations§
Source§impl TranslationRequest
impl TranslationRequest
pub fn new(file: PathBuf) -> Self
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
Trait Implementations§
Source§impl Clone for TranslationRequest
impl Clone for TranslationRequest
Source§fn clone(&self) -> TranslationRequest
fn clone(&self) -> TranslationRequest
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TranslationRequest
impl Debug for TranslationRequest
Source§impl<'de> Deserialize<'de> for TranslationRequest
impl<'de> Deserialize<'de> for TranslationRequest
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 TranslationRequest
impl FormRequest<AudioResponse> for TranslationRequest
const ENDPOINT: &'static str = "/audio/translations"
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 TranslationRequest
impl RefUnwindSafe for TranslationRequest
impl Send for TranslationRequest
impl Sync for TranslationRequest
impl Unpin for TranslationRequest
impl UnsafeUnpin for TranslationRequest
impl UnwindSafe for TranslationRequest
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