Skip to content

API Reference parrot_tools.google.lyria

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

parrot_tools.google.lyria

View source

LyriaToolkit — Google Lyria music generation toolkit for ai-parrot.

Alias BYTES_PER_SECOND

Re-exported from parrot_tools.google.audio_utils.BYTES_PER_SECOND.

Alias DEFAULT_CHANNELS

Re-exported from parrot_tools.google.audio_utils.DEFAULT_CHANNELS.

Alias DEFAULT_SAMPLE_RATE

Re-exported from parrot_tools.google.audio_utils.DEFAULT_SAMPLE_RATE.

Alias LyriaMusicParameters

Re-exported from parrot_tools.google.lyria_models.LyriaMusicParameters.

Alias LyriaMusicResult

Re-exported from parrot_tools.google.lyria_models.LyriaMusicResult.

Class LyriaToolkit

Toolkit for converting natural language descriptions into Google Lyria music generation.

Exposes tools for:

  • generate_music: Generate audio from a prompt and musical parameters.
  • list_genres_and_moods: Discover supported genres and moods.
  • parse_music_prompt: Parse raw natural language into structured parameters.
Parameter Type Default Description
client Optional[Any] None Optional pre-constructed GoogleGenAIClient (or compatible mock). When omitted, a client is lazily instantiated on first use and owned (and closed) by the toolkit.
output_dir Optional[Union[str, Path]] None Directory where generated WAV files are written. Defaults to tmp/music relative to the current working directory.
default_duration int 10 Default audio duration in seconds when the caller does not supply one (default: 10).
mode Literal['stream', 'batch'] 'stream' Generation mode — "stream" (Lyria RealTime, default) or "batch" (Vertex AI lyria-002).
model str 'models/lyria-realtime-exp' Model identifier used when lazily constructing the client (default: "models/lyria-realtime-exp").
**kwargs Any {} Additional configuration forwarded to AbstractToolkit.__init__.

Attributes:

Attribute Type Description
tool_prefix str
auto_open bool

Method LyriaToolkit.generate_music

Generate music using Google Lyria from a prompt and structured musical parameters.

generate_music(prompt: str, duration_seconds: int = 10, genre: Optional[str] = None, mood: Optional[str] = None, bpm: int = 90, temperature: float = 1.0, density: float = 0.5, brightness: float = 0.5, negative_prompt: Optional[str] = None, seed: Optional[int] = None) -> Dict[str, Any]

Parameter Type Default Description
prompt str Text description of the desired music (instruments, style, feel).
duration_seconds int 10 Duration of the generated audio in seconds (1 to 120, default 10).
genre Optional[str] None Music genre hint (e.g. 'Ambient', 'Chillout', 'Lo-Fi Hip Hop', 'Classical').
mood Optional[str] None Music mood hint (e.g. 'Ambient', 'Chill', 'Dreamy', 'Ethereal Ambience').
bpm int 90 Tempo in beats per minute (60-200, default 90). Slow=60-80, Medium=90-110, Fast=120-160.
temperature float 1.0 Creativity/randomness parameter (0.0 to 3.0, default 1.0).
density float 0.5 Note density (0.0 to 1.0). Use 0.2-0.4 for soft/sparse, 0.7-0.9 for dense.
brightness float 0.5 Tonal brightness (0.0 to 1.0). Use 0.2-0.4 for warm/mellow, 0.7-0.9 for bright.
negative_prompt Optional[str] None Musical elements or sounds to exclude (e.g. 'drums, vocals').
seed Optional[int] None Deterministic integer seed for reproducible generation.

Returns: Dict[str, Any] — Dict containing status, file_path, duration_seconds, sample_rate, channels, and parameters.

Method LyriaToolkit.list_genres_and_moods

Return the catalog of genres and moods supported by Google Lyria.

list_genres_and_moods() -> Dict[str, Any]

Returns: Dict[str, Any] — Dict with genres, moods, and default parameter values.

Method LyriaToolkit.parse_music_prompt

Parse a natural language request into structured Lyria parameters.

parse_music_prompt(request: str) -> Dict[str, Any]

Parameter Type Default Description
request str Free-form natural language music description.

Returns: Dict[str, Any] — Dict matching LyriaMusicParameters fields.

Alias async_save_pcm_to_wav

Re-exported from parrot_tools.google.audio_utils.async_save_pcm_to_wav.

Alias async_slice_wav_file

Re-exported from parrot_tools.google.audio_utils.async_slice_wav_file.

Attribute logger

Alias parse_natural_music_request

Re-exported from parrot_tools.google.lyria_models.parse_natural_music_request.

Alias seconds_to_pcm_bytes

Re-exported from parrot_tools.google.audio_utils.seconds_to_pcm_bytes.

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