set file correctly in request

This commit is contained in:
Christopher Moyer 2024-12-18 20:44:58 -05:00
parent 3889c80509
commit 86fba439ef

View file

@ -120,17 +120,12 @@ async fn transcribe_call(file_path: &Path) -> Result<CreateTranscriptionResponse
let client = async_openai::Client::new(); let client = async_openai::Client::new();
let audio_input = AudioInput {
source: InputSource::Path {
path: file_path.to_path_buf(),
}
};
let request = CreateTranscriptionRequestArgs::default() let request = CreateTranscriptionRequestArgs::default()
.prompt("This is a public safety radio transmission. The speakers could be any of the following communicating between each other: dispatcher, law enforcement officer, fire fighter, or emergency medical services") .prompt("This is a public safety radio transmission. The speakers could be any of the following communicating between each other: dispatcher, law enforcement officer, fire fighter, or emergency medical services")
.language("en") .language("en")
.response_format(AudioResponseFormat::Text) .response_format(AudioResponseFormat::Text)
.model("whisper-1") .model("whisper-1")
.file(audio_input) .file(file_path)
.build()?; .build()?;
client.audio().transcribe(request).await client.audio().transcribe(request).await