llama-index tools typecast integration
Project description
Typecast.ai Tool
This tool allows Agents to use Typecast.ai text-to-speech to create audio files from text with emotion control. To see more and get started, visit https://typecast.ai/
Usage
This tool has a more extensive example usage documented in a Jupyter notebook here
from llama_index.tools.typecast import TypecastToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
speech_tool = TypecastToolSpec(api_key="your-key")
agent = FunctionAgent(
tools=speech_tool.to_tool_list(),
llm=OpenAI(model="gpt-4o-mini"),
)
print(
await agent.run(
'Create speech from the text "Hello world!" with a happy emotion and output the file to "speech.wav"'
)
)
text_to_speech: Convert text to speech with emotion, pitch, tempo control, and reproducible results
get_voices: List all available Typecast voices
get_voice: Get details of a specific voice by ID
This tool is designed to be used as a Tool in an Agent.
Features
- Multiple Voice Models: Support for various AI voice models (ssfm-v21, ssfm-v30)
- Multi-language Support: 27+ languages including English, Korean, Spanish, Japanese, Chinese, and more
- Emotion Control: Adjust emotional expression (happy, sad, angry, normal, whisper, etc.) with intensity control
- Audio Customization: Control volume, pitch, tempo, and output format (WAV/MP3)
- Reproducible Results: Use seed parameter for consistent audio generation
- Voice Discovery: List and search available voices by model, gender, age, or use case (V2 API)
Advanced Usage
Using Seed for Reproducible Results
from llama_index.tools.typecast import TypecastToolSpec
speech_tool = TypecastToolSpec(api_key="your-key")
# Generate the same audio multiple times with the same seed
result = speech_tool.text_to_speech(
text="Hello world!",
voice_id="tc_62a8975e695ad26f7fb514d1",
output_path="speech.wav",
seed=42, # Same seed = same audio
)
Getting Voice Details (V2 API)
# Get specific voice information
voice = speech_tool.get_voice("tc_62a8975e695ad26f7fb514d1")
print(f"Voice: {voice['voice_name']}")
print(f"Gender: {voice['gender']}, Age: {voice['age']}")
print(f"Use cases: {voice['use_cases']}")
# Models now include emotions per model version
for model in voice["models"]:
print(f"Model {model['version']}: emotions = {model['emotions']}")
Filtering Voices (V2 API)
# Filter by model, gender, age, and use case
voices = speech_tool.get_voices(
model="ssfm-v30", gender="female", age="young_adult", use_case="Audiobook"
)
for voice in voices:
print(f"{voice['voice_name']} ({voice['voice_id']})")
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 llama_index_tools_typecast-0.1.0.tar.gz.
File metadata
- Download URL: llama_index_tools_typecast-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c2e4d6e8a4754fb947ed30d386b139ff756479e3b8b0aed948eb7accd12cde16
|
|
| MD5 |
beb36738d04d307480d8471250996aed
|
|
| BLAKE2b-256 |
c0274d5397f7d5b8d69b2854b41b8c80a4ad61c9cae75eff7cbac2189224743c
|
File details
Details for the file llama_index_tools_typecast-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llama_index_tools_typecast-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cfc4e492d2e215cee05d1d638c4e3a417146df3f91a637f4d014c443f397ab3
|
|
| MD5 |
06679933c9ff8973702f110f28cd9c35
|
|
| BLAKE2b-256 |
ea982df8b36cbe0ac688fc595dd509fc68c3e7a63a4fc01add0967117d892a8e
|