import asyncio
import os
from app.core.providers.stt.general import GeneralSTTProvider  # Update if your file name is different

async def main():
    # Set your LiteLLM-compatible API key (e.g., for Gemini, OpenAI, etc.)
    api_key = "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"

    # Provide a valid audio file path
    audio_file_path = "integration_tests/test_data/test-audio.wav"  # Replace with your test file

    try:
        # Read the audio file as bytes
        with open(audio_file_path, "rb") as f:
            audio_data = f.read()

        # Initialize the STT provider
        stt_provider = GeneralSTTProvider(api_key=api_key, model_name="openai/gpt-4o-transcribe")

        # Call the transcribe method
        transcript = await stt_provider.transcribe_audio(audio_data)
        print("Transcript:", transcript)

    except FileNotFoundError:
        print(f"Audio file not found: {audio_file_path}")
    except Exception as e:
        print("Error during transcription:", e)

if __name__ == "__main__":
    asyncio.run(main())
