🤖 Build voice-based LLM agents. Modular + open source. https://vocode.dev
Find a file
2023-03-28 10:29:00 -07:00
examples open source 2023-03-28 10:29:00 -07:00
vocode open source 2023-03-28 10:29:00 -07:00
.gitignore open source 2023-03-28 10:29:00 -07:00
LICENSE Create LICENSE 2023-03-28 10:24:05 -07:00
poetry.lock bump all packages and set up rime 2023-03-22 12:33:02 -07:00
pyproject.toml revert back 2023-03-26 00:28:52 -07:00
README.md readme 2023-03-20 23:28:31 -07:00
requirements.txt open source 2023-03-28 10:29:00 -07:00

vocode Python SDK

pip install vocode
import asyncio
import signal
import vocode

vocode.api_key = "YOUR_API_KEY"

from vocode.conversation import Conversation
from vocode.helpers import create_microphone_input_and_speaker_output
from vocode.models.transcriber import DeepgramTranscriberConfig
from vocode.models.agent import ChatGPTAgentConfig
from vocode.models.synthesizer import AzureSynthesizerConfig

if __name__ == "__main__":
    microphone_input, speaker_output = create_microphone_input_and_speaker_output(
        use_default_devices=True
    )

    conversation = Conversation(
        input_device=microphone_input,
        output_device=speaker_output,
        transcriber_config=DeepgramTranscriberConfig.from_input_device(microphone_input),
        agent_config=ChatGPTAgentConfig(
          initial_message=BaseMessage(text="Hello!"),
          prompt_preamble="The AI is having a pleasant conversation about life."
        ),
        synthesizer_config=AzureSynthesizerConfig.from_output_device(speaker_output)
    )
    # This allows you to stop the conversation with a KeyboardInterrupt
    signal.signal(signal.SIGINT, lambda _0, _1: conversation.deactivate())
    asyncio.run(conversation.start())