Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sending files over using evi #132

Open
lithafnium opened this issue May 27, 2024 · 1 comment
Open

sending files over using evi #132

lithafnium opened this issue May 27, 2024 · 1 comment

Comments

@lithafnium
Copy link

Hey there! Trying to use the EVI API right now to interface with the voice assistant. Is it possible to interact with the assistant by sending over audio files instead of the microphone? I saw an example in test_service_hume_voice_client_chat.py, but copying it over seems to hang when awaiting for messages in the socket.

The code I'm trying out is this:

async def main():
    client = HumeVoiceClient(HUME_API_KEY)
    async with client.connect() as socket:
        await socket.update_session_settings(sample_rate=16_000, num_channels=1)

        await socket.send_file(Path("./speech.wav"))

        async for message_str in socket:
            message = json.loads(message_str)
            print(message)

asyncio.run(main())
@Simon-Stone
Copy link

If I am not mistaken, the async for loop waits for the next message_str forever. Try to include something like this:

async for message_str in socket:
    message = json.loads(message_str)
    print(message)
    if message["type"] in ["error", "assistant_end"]:
        return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants