Код ошибки: 400 – {'error': {'message': "Нераспознанный формат файла.
Поддерживаемые форматы: ['flac', 'm4a', 'mp3', 'mp4', 'mpeg', 'mpga',
'oga', 'ogg', 'wav', 'webm']", 'type': 'invalid_request_error',
'param': Нет, 'code ': Нет}}
Вот код моих функций:
Код: Выделить всё
async def transcribe_voice_message(file_path):
"""OpenAI Speech To Text request"""
client = AsyncOpenAI(api_key=openai_api_key)
try:
async with aiofiles.open(file_path, 'rb') as f:
file_content = await f.read()
transcription = await client.audio.transcriptions.create(
model="whisper-1", file=file_content
)
except Exception as e:
logger.error(
f"Open API error: {e}"
)
return transcription.text
Подробнее здесь: https://stackoverflow.com/questions/788 ... e-ogg-file
Мобильная версия