MCPcopy
hub / github.com/vocodedev/vocode-core

github.com/vocodedev/vocode-core @v0.1.114a2 sqlite

repository ↗ · DeepWiki ↗ · release v0.1.114a2 ↗
1,441 symbols 6,183 edges 214 files 83 documented · 6%
README

Hero

Twitter GitHub Repo stars pypi Downloads

Community | Docs | Dashboard

  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

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

pip install vocode
import asyncio
import signal

from pydantic_settings import BaseSettings, SettingsConfigDict

from vocode.helpers import create_streaming_microphone_input_and_speaker_output
from vocode.logging import configure_pretty_logging
from vocode.streaming.agent.chat_gpt_agent import ChatGPTAgent
from vocode.streaming.models.agent import ChatGPTAgentConfig
from vocode.streaming.models.message import BaseMessage
from vocode.streaming.models.synthesizer import AzureSynthesizerConfig
from vocode.streaming.models.transcriber import (
    DeepgramTranscriberConfig,
    PunctuationEndpointingConfig,
)
from vocode.streaming.streaming_conversation import StreamingConversation
from vocode.streaming.synthesizer.azure_synthesizer import AzureSynthesizer
from vocode.streaming.transcriber.deepgram_transcriber import DeepgramTranscriber

configure_pretty_logging()


class Settings(BaseSettings):
    """
    Settings for the streaming conversation quickstart.
    These parameters can be configured with environment variables.
    """

    openai_api_key: str = "ENTER_YOUR_OPENAI_API_KEY_HERE"
    azure_speech_key: str = "ENTER_YOUR_AZURE_KEY_HERE"
    deepgram_api_key: str = "ENTER_YOUR_DEEPGRAM_API_KEY_HERE"

    azure_speech_region: str = "eastus"

    # This means a .env file can be used to overload these settings
    # ex: "OPENAI_API_KEY=my_key" will set openai_api_key over the default above
    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding="utf-8",
        extra="ignore",
    )


settings = Settings()


async def main():
    (
        microphone_input,
        speaker_output,
    ) = create_streaming_microphone_input_and_speaker_output(
        use_default_devices=False,
    )

    conversation = StreamingConversation(
        output_device=speaker_output,
        transcriber=DeepgramTranscriber(
            DeepgramTranscriberConfig.from_input_device(
                microphone_input,
                endpointing_config=PunctuationEndpointingConfig(),
                api_key=settings.deepgram_api_key,
            ),
        ),
        agent=ChatGPTAgent(
            ChatGPTAgentConfig(
                openai_api_key=settings.openai_api_key,
                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),
            azure_speech_key=settings.azure_speech_key,
            azure_speech_region=settings.azure_speech_region,
        ),
    )
    await conversation.start()
    print("Conversation started, press Ctrl+C to end")
    signal.signal(signal.SIGINT, lambda _0, _1: asyncio.create_task(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

docs.vocode.dev

Core symbols most depended-on inside this repo

set
called by 49
vocode/__init__.py
consume_nonblocking
called by 49
vocode/streaming/utils/worker.py
getenv
called by 34
vocode/__init__.py
start
called by 25
vocode/streaming/utils/worker.py
sentry_create_span
called by 21
vocode/utils/sentry_utils.py
create_conversation_id
called by 19
vocode/streaming/utils/__init__.py
attach_conversation_state_manager
called by 15
vocode/streaming/agent/base_agent.py
get_session
called by 12
vocode/streaming/utils/async_requester.py

Shape

Method 827
Class 397
Function 211
Route 6

Languages

Python100%

Modules by API surface

vocode/streaming/streaming_conversation.py52 symbols
vocode/streaming/utils/state_manager.py44 symbols
vocode/streaming/synthesizer/base_synthesizer.py40 symbols
vocode/streaming/utils/worker.py39 symbols
vocode/streaming/agent/base_agent.py38 symbols
vocode/streaming/transcriber/deepgram_transcriber.py29 symbols
vocode/streaming/models/transcript.py28 symbols
vocode/streaming/models/synthesizer.py26 symbols
vocode/streaming/synthesizer/eleven_labs_websocket_synthesizer.py25 symbols
vocode/utils/sentry_utils.py24 symbols
vocode/streaming/models/agent.py24 symbols
vocode/streaming/transcriber/base_transcriber.py21 symbols

For agents

$ claude mcp add vocode-core \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact