using System;
using System.Threading.Tasks;
using OpenAI_API; // Make sure to include this namespace

public class OpenAiService
{
    private readonly OpenAIAPI api;

    public OpenAiService(string apiKey)
    {
        api = new OpenAIAPI(apiKey);
    }
    public OpenAI_API.Chat.Conversation CreateConversation()
    {
        return api.Chat.CreateConversation();
    }

    public async Task<string> TranslateAudioAsync(string audioFilePath)
    {
        try
        {
            string result = await api.Translations.GetTextAsync(audioFilePath);
            return result;
        }
        catch (Exception ex)
        {
            Console.WriteLine("Error during translation: " + ex.Message);
            return null;
        }
    }
}