openai / openai-dotnet

The official .NET library for the OpenAI API
https://www.nuget.org/packages/OpenAI/AbsoluteLatest
MIT License
734 stars 64 forks source link

Can't get the Audio Transcription to work in Unity C# #102

Open chiddyBenno opened 4 days ago

chiddyBenno commented 4 days ago

Hello dear openai-dotnet Community. Im currently working on a OpenAI integration in my VR-Unity Project. I was previously working with Azure SST & TTS and want to change it all to the OpenAI-API.

Even trying out the simple Example: `public async Task Example02_SimpleTranscriptionAsync() { AudioClient client = new("whisper-1", Environment.GetEnvironmentVariable("OPENAI_API_KEY"));

    string audioFilePath = Path.Combine("Assets", "audio_houseplant_care.mp3");

    AudioTranscription transcription = await client.TranscribeAudioAsync(audioFilePath);

    Console.WriteLine($"{transcription.Text}");
}`

it will give me this error:

Error: boundary UnityEngine.Debug:Log (object) SpeechToTextManager/d14:MoveNext () (at Assets/02-KiChatGPT/SpeechToTextManager.cs:70) System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start<SpeechToTextManager/d__14> (SpeechToTextManager/d14&) SpeechToTextManager:Example02_SimpleTranscriptionAsync () SpeechToTextManager:StartSpeechToText () (at Assets/02-KiChatGPT/SpeechToTextManager.cs:47) NewOpenAIController:Start () (at Assets/02-KiChatGPT/NewOpenAIController.cs:57)

I would be very grateful if somebody could help me with it. Greetings, Benjamin