Skip to content

API Reference parrot_tools.gvoice

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.gvoice

View source

Google Text-to-Speech Tool migrated to use AbstractTool framework with async support.

Alias AbstractTool

Re-exported from parrot_tools.abstract.AbstractTool.

Class GoogleTTSArgs

Arguments schema for GoogleTTSTool.

Fields:

Field Type Default Description
text str The text content (plaintext or Markdown) to convert to speech
voice_model Optional[str] Specific Google voice model name (e.g., 'en-US-Neural2-F'). If None, selects based on language and gender
voice_gender Literal['MALE', 'FEMALE'] Voice gender preference when voice_model is not specified
language_code str BCP-47 language code (e.g., 'en-US', 'es-ES', 'fr-FR')
output_format Literal['OGG_OPUS', 'MP3', 'LINEAR16', 'MULAW', 'ALAW', 'PCM'] Audio output format
file_prefix str Prefix for the output filename (timestamp and extension added automatically)
speaking_rate float Speaking rate (0.25 to 4.0, where 1.0 is normal speed)
pitch float Voice pitch (-20.0 to 20.0 semitones, where 0.0 is normal)
use_ssml bool Whether to convert Markdown/text to SSML for better speech synthesis

Method GoogleTTSArgs.validate_text

validate_text(v)

Parameter Type Default Description
v

Method GoogleTTSArgs.validate_language_code

validate_language_code(v)

Parameter Type Default Description
v

Class GoogleVoiceTool

Tool for generating speech audio from text using Google Cloud Text-to-Speech.

This tool converts text content (including Markdown) into high-quality speech audio using Google's neural voice models. It supports multiple languages, voice customization, and various audio output formats.

Features:

  • Automatic Markdown to SSML conversion for natural speech
  • Multiple voice models and languages
  • Configurable speech parameters (rate, pitch)
  • Various audio output formats (OGG, MP3, WAV, etc.)
  • Async processing for better performance
  • Comprehensive error handling and logging
Parameter Type Default Description
credentials_path Optional[str] None Path to Google Cloud service account JSON file
default_voice_model str 'en-US-Neural2-F' Default voice model to use
default_language str 'en-US' Default language code
default_format str 'OGG_OPUS' Default audio output format
use_long_audio_synthesis bool False Whether to use long audio synthesis for texts >5000 chars
**kwargs {} Additional arguments for AbstractTool

Method GoogleVoiceTool.execute_sync

Execute TTS synthesis synchronously.

execute_sync(text: str, voice_model: Optional[str] = None, voice_gender: str = 'FEMALE', language_code: str = 'en-US', output_format: str = 'OGG_OPUS', file_prefix: str = 'podcast', speaking_rate: float = 1.0, pitch: float = 0.0, use_ssml: bool = True) -> Dict[str, Any]

Parameter Type Default Description
text str Text content to convert to speech
voice_model Optional[str] None Specific voice model
voice_gender str 'FEMALE' Voice gender preference
language_code str 'en-US' Language code
output_format str 'OGG_OPUS' Audio output format
file_prefix str 'podcast' Output filename prefix
speaking_rate float 1.0 Speech rate
pitch float 0.0 Voice pitch
use_ssml bool True Whether to use SSML

Returns: Dict[str, Any] — Dictionary with synthesis results

Method GoogleVoiceTool.get_available_voices

Get available voice models for a language or all languages.

get_available_voices(language_code: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
language_code Optional[str] None

Returns: Dict[str, Any]

Method GoogleVoiceTool.get_supported_formats

Get supported audio output formats.

get_supported_formats() -> Dict[str, str]

Returns: Dict[str, str]

Method GoogleVoiceTool.preview_ssml

Preview how text would be converted to SSML.

preview_ssml(text: str) -> str

Parameter Type Default Description
text str

Returns: str

Method GoogleVoiceTool.estimate_cost

Estimate the cost for TTS synthesis (rough calculation).

estimate_cost(text: str, use_ssml: bool = True) -> Dict[str, Any]

Parameter Type Default Description
text str
use_ssml bool True

Returns: Dict[str, Any]

Attribute MD_REPLACEMENTS

Function markdown_to_plain

Convert Markdown to plain text via HTML parsing.

markdown_to_plain(md: str) -> str

Parameter Type Default Description
md str

Returns: str

Function strip_markdown

Remove the most common inline Markdown markers.

strip_markdown(text: str) -> str

Parameter Type Default Description
text str

Returns: str

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally