This release is a pre-release and may not be stable for production use.
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.
We're actively looking for community maintainers, so please reach out if interested!
⭐️ 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
- 🤖 Use an outbound call to a real phone number in a Langchain agent
- Out of the box integrations with:
- Transcription services, including:
- LLMs, including:
- Synthesis services, including:
Check out our React SDK here!
🫂 Contribution and Roadmap
We're an open source project and are extremely open to contributors adding new features, integrations, and documentation! Please don't hesitate to reach out and get started building with us.
For more information on contributing, see our Contribution Guide.
And check out our Roadmap.
We'd love to talk to you on Discord about new ideas and contributing!
🚀 Quickstart (Self-hosted)
pip install 'vocode'
import asyncio
import logging
import signal
from vocode.streaming.streaming_conversation import StreamingConversation
from vocode.helpers import create_streaming_microphone_input_and_speaker_output
from vocode.streaming.transcriber import *
from vocode.streaming.agent import *
from vocode.streaming.synthesizer import *
from vocode.streaming.models.transcriber import *
from vocode.streaming.models.agent import *
from vocode.streaming.models.synthesizer import *
from vocode.streaming.models.message import BaseMessage
import vocode
# 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>",
)
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
async def main():
(
microphone_input,
speaker_output,
) = create_streaming_microphone_input_and_speaker_output(
use_default_devices=False,
logger=logger,
)
conversation = StreamingConversation(
output_device=speaker_output,
transcriber=DeepgramTranscriber(
DeepgramTranscriberConfig.from_input_device(
microphone_input,
endpointing_config=PunctuationEndpointingConfig(),
)
),
agent=ChatGPTAgent(
ChatGPTAgentConfig(
initial_message=BaseMessage(text="What up"),
prompt_preamble="""The AI is having a pleasant conversation about life""",
)
),
synthesizer=AzureSynthesizer(
AzureSynthesizerConfig.from_output_device(speaker_output)
),
logger=logger,
)
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 = await microphone_input.get_audio()
conversation.receive_audio(chunk)
if __name__ == "__main__":
asyncio.run(main())
📞 Phone call quickstarts
🌱 Documentation
Recording audio input (human speech):
...
await conversation.start()
from vocode.streaming.pubsub.base_pubsub import AudioFileWriterSubscriber
subscriber = AudioFileWriterSubscriber(
"AudioFileWriterSubscriber", sampling_rate=44100 # 8000 for Twilio
)
from vocode import pubsub
pubsub.subscribe(subscriber=subscriber, topic="human_audio_streams")
audio_sub_task = asyncio.create_task(subscriber._run_loop())
signal.signal(signal.SIGINT, lambda _0, _1: conversation.terminate())
signal.signal(signal.SIGINT, lambda _0, _1: subscriber.terminate())
signal.signal(signal.SIGINT, lambda _0, _1: audio_sub_task.cancel())
Metadata
Release files for milocode 0.1.111a2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| milocode-0.1.111a2.tar.gz | 5.2 kB | Without provenance | Details for milocode-0.1.111a2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| milocode-0.1.111a2-py3-none-any.whl | Python 3 | none | any | Details for milocode-0.1.111a2-py3-none-any.whl |
Total release size: 10.3 kB
Release files / milocode-0.1.111a2.tar.gz
| Download URL | milocode-0.1.111a2.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e43271b8d909f50afae15607e1e78cbdd5cb391dd3db5cd012e68d289c11f6e8
|
|
BLAKE2b-256 checksum How to use checksums |
fd5cf56abe42922e0a5dfc967d868a5d7c1148a49c3d8237d2702bb560db764e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Release files / milocode-0.1.111a2-py3-none-any.whl
| Download URL | milocode-0.1.111a2-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e20fb9007e6786c28a1bdd897aa0540fc3a0b5f7bd61cbcfed6977d33da7d172
|
|
BLAKE2b-256 checksum How to use checksums |
d4d2a50e090641eb590fa0a57e0a135cb4f50b77b14ba27fb9b79e054864f1f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.2
|
Security for milocode 0.1.111a2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.