The all-in-one voice SDK
Project description
vocode
Build voice-based LLM apps in minutes
Vocode is an open source library that makes it easy to build voice-based LLM apps. Using Vocode, you can build real-time streaming conversations with LLMs and deploy them to phone calls, Zoom meetings, and more. You can also build personal assistants or apps like voice-based chess. Vocode provides easy abstractions and integrations so that everything you need is in a single library.
⭐️ Features
- 🗣 Spin up a conversation with your system audio
- ➡️ 📞 Set up a phone number that responds with a LLM-based agent
- 📞 ➡️ Send out phone calls from your phone number managed by an LLM-based agent
- 🧑💻 Dial into a Zoom call
- Out of the box integrations with:
- Transcription services, including:
- LLMs, including:
- Synthesis services, including:
Check out our React SDK here!
🚀 Quickstart (Self-hosted)
pip install 'vocode[io]'
import asyncio
import signal
import vocode
from vocode.streaming.streaming_conversation import StreamingConversation
from vocode.helpers import create_microphone_input_and_speaker_output
from vocode.streaming.models.transcriber import (
DeepgramTranscriberConfig,
PunctuationEndpointingConfig,
)
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.message import BaseMessage
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
# these can also be set as environment variables
vocode.setenv(
OPENAI_API_KEY="<your OpenAI key>",
DEEPGRAM_API_KEY="<your Deepgram key>",
AZURE_SPEECH_KEY="<your Azure key>",
AZURE_SPEECH_REGION="<your Azure region>",
)
async def main():
microphone_input, speaker_output = create_microphone_input_and_speaker_output(
streaming=True, use_default_devices=False
)
conversation = StreamingConversation(
output_device=speaker_output,
transcriber_config=DeepgramTranscriberConfig.from_input_device(
microphone_input, endpointing_config=PunctuationEndpointingConfig()
),
agent_config=ChatGPTAgentConfig(
initial_message=BaseMessage(text="Hello!"),
prompt_preamble="Have a pleasant conversation about life",
),
synthesizer_config=AzureSynthesizerConfig.from_output_device(speaker_output),
)
await conversation.start()
print("Conversation started, press Ctrl+C to end")
signal.signal(signal.SIGINT, lambda _0, _1: conversation.terminate())
while conversation.is_active():
chunk = microphone_input.get_audio()
if chunk:
conversation.receive_audio(chunk)
await asyncio.sleep(0)
if __name__ == "__main__":
asyncio.run(main())
☁️ Quickstart (Hosted)
First, get a free API key from our dashboard.
pip install 'vocode[io]'
import asyncio
import signal
import vocode
from vocode.streaming.hosted_streaming_conversation import HostedStreamingConversation
from vocode.streaming.streaming_conversation import StreamingConversation
from vocode.helpers import create_microphone_input_and_speaker_output
from vocode.streaming.models.transcriber import (
DeepgramTranscriberConfig,
PunctuationEndpointingConfig,
)
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.message import BaseMessage
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
vocode.api_key = "<your API key>"
if __name__ == "__main__":
microphone_input, speaker_output = create_microphone_input_and_speaker_output(
streaming=True, use_default_devices=False
)
conversation = HostedStreamingConversation(
input_device=microphone_input,
output_device=speaker_output,
transcriber_config=DeepgramTranscriberConfig.from_input_device(
microphone_input,
endpointing_config=PunctuationEndpointingConfig(),
),
agent_config=ChatGPTAgentConfig(
initial_message=BaseMessage(text="Hello!"),
prompt_preamble="Have a pleasant conversation about life",
),
synthesizer_config=AzureSynthesizerConfig.from_output_device(speaker_output),
)
signal.signal(signal.SIGINT, lambda _0, _1: conversation.deactivate())
asyncio.run(conversation.start())
📞 Phone call quickstarts
🌱 Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vocode-0.1.64.tar.gz.
File metadata
- Download URL: vocode-0.1.64.tar.gz
- Upload date:
- Size: 4.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/21.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
650d5f30b355eabfce320906a6008779191a3424ff703b97115d7e777730c820
|
|
| MD5 |
17324c759dda4dd8a4dc3489ff38aba8
|
|
| BLAKE2b-256 |
e615bc8b89cfd82f9945f0b310e12c92659c449e5dd11d6c373bbe7008db606a
|
File details
Details for the file vocode-0.1.64-py3-none-any.whl.
File metadata
- Download URL: vocode-0.1.64-py3-none-any.whl
- Upload date:
- Size: 4.7 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Darwin/21.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df4113a6f5781507ef5498071db0b8bef8056a248949ccf0ae5348804c9a0400
|
|
| MD5 |
95e7100f55ba798447215f2285f0c82f
|
|
| BLAKE2b-256 |
cc806f5fb792e83b58a69fdc5978244d2a9e8ac870d8aac0efe491bdfcaa4d03
|