youssef
12/31/2023, 2:11 PMprivate fun transcribeVideo(filePath: String){
launch {
try {
val transcriptionRequest = TranscriptionRequest(
audio = createFileSource(filePath),
model = ModelId("whisper-1"),
)
OpenaiClient.openaiClient.transcription(
transcriptionRequest
).text.also { println("qcqs $it") }
} catch (e: Exception){
eventsFlow.emit(HomeEvent.ExceptionHandler(e))
}
}
}
i got my openai Instance here
object OpenaiClient {
val openaiClient = OpenAI(
token = "sk-QXtYdssiI0JErQsdhT3BlbkFJYapzP50lfLFAijnqcqPrA",
logging = LoggingConfig(LogLevel.All),
)
}
and i dont seem to understnad why its not working even though that the logging level is set to ALL
it just prints an error saying null i just dont know what to do at this point. also it keep bring up this error:
*{*"error": *{*"message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
Screenshot 2023-12-31 at 2.21.56 PM.pngAyfri
12/31/2023, 2:20 PMyoussef
12/31/2023, 2:49 PM