Skip to main content

Cartesia TTS integration for Vision Agents

Project description

Cartesia

Cartesia is a service that provides Speech-to-Text (STT) and Text-to-Speech (TTS) capabilities. It's designed for real-time voice applications, making it ideal for voice AI agents, transcription pipelines, and conversational interfaces.

The Cartesia plugin for the Stream Python AI SDK allows you to add TTS functionality to your project.

Installation

Install the Stream Cartesia plugin with

uv add "vision-agents[cartesia]"
# or directly
uv add vision-agents-plugins-cartesia

Examples

Read on for some key details and check out our Cartesia examples to see working code samples:

  • in tts.py we see a simple bot greeting users upon joining a call
  • in narrator-example.py we see a well-prompted combination of a STT -> LLM -> TTS flow that leverages the powers of Cartesia's Sonic 3 model to narrate a creative story from the user's input

Initialisation

The Cartesia plugin for Stream exists in the form of the TTS class:

from vision_agents.plugins import cartesia

tts = cartesia.TTS()
To initialise without passing in the API key, make sure the `CARTESIA_API_KEY` is available as an environment variable. You can do this either by defining it in a `.env` file or exporting it directly in your terminal.

Parameters

These are the parameters available in the CartesiaTTS plugin for you to customise:

Name Type Default Description
api_key str or None None Your Cartesia API key. If not provided, the plugin will look for the CARTESIA_API_KEY environment variable.
model_id str "sonic-3" ID of the Cartesia STT or TTS model to use. Defaults to the recently released Sonic-3
voice_id str or None "f9836c6e-a0bd-460e-9d3c-f7299fa60f94" ID of the voice to use for TTS responses.
sample_rate int 16000 Sample rate (in Hz) used for audio processing.

Functionality

Send text to convert to speech

The send_iter() method sends the text passed in for the service to synthesize and yields TTSOutputChunks containing the produced PCM audio.

async for chunk in tts.send_iter("Demo text you want AI voice to say"):
    pass

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vision_agents_plugins_cartesia-0.6.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file vision_agents_plugins_cartesia-0.6.3.tar.gz.

File metadata

  • Download URL: vision_agents_plugins_cartesia-0.6.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vision_agents_plugins_cartesia-0.6.3.tar.gz
Algorithm Hash digest
SHA256 cce216e9572bab65c2b9e14afc50800c8183bb6924fa983463519cb13e2ff19c
MD5 2293a2346e4990802ea3688a9e7d3e71
BLAKE2b-256 1476bdfdc3709fbddac2169cc04337f2727ca62880d614e4427efc256cdc1ee5

See more details on using hashes here.

File details

Details for the file vision_agents_plugins_cartesia-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: vision_agents_plugins_cartesia-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for vision_agents_plugins_cartesia-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c86b21c0d97e7ecd750e1dc57bc171000281cdb88f5cf22dd38f8175bec71344
MD5 b55e4996da486e0d5fe46ef2d0909b1f
BLAKE2b-256 3cf5c710eac70b88711cc6b5c46a0ef8eefa64c16fa011c8625dd488ecada939

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page