Skip to content

marvin.ai.audio

generate_speech async

Generates an image based on a provided prompt template.

This function uses the DALL-E API to generate an image based on a provided prompt template. The function supports additional arguments for the prompt and the model.

Parameters:

Name Type Description Default
prompt_template str

The template for the prompt.

required
prompt_kwargs dict

Additional keyword arguments for the prompt. Defaults to None.

None
model_kwargs dict

Additional keyword arguments for the language model. Defaults to None.

None

Returns:

Name Type Description
ImagesResponse HttpxBinaryResponseContent

The response from the DALL-E API, which includes the generated image.

speak

Generates audio from text using an AI.

This function uses an AI to generate audio from the provided text. The voice used for the audio can be specified.

Parameters:

Name Type Description Default
text str

The text to generate audio from.

required
voice Literal['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']

The voice to use for the audio. Defaults to None.

'alloy'
model_kwargs dict

Additional keyword arguments for the language model. Defaults to None.

None

Returns:

Name Type Description
HttpxBinaryResponseContent HttpxBinaryResponseContent

The generated audio.

speak_async async

Generates audio from text using an AI.

This function uses an AI to generate audio from the provided text. The voice used for the audio can be specified.

Parameters:

Name Type Description Default
text str

The text to generate audio from.

required
voice Literal['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']

The voice to use for the audio. Defaults to None.

'alloy'
model_kwargs dict

Additional keyword arguments for the language model. Defaults to None.

None

Returns:

Name Type Description
HttpxBinaryResponseContent HttpxBinaryResponseContent

The generated audio.

speech

Function decorator that generates audio from the wrapped function's return value. The voice used for the audio can be specified.

Parameters:

Name Type Description Default
fn Callable

The function to wrap. Defaults to None.

None
voice str

The voice to use for the audio. Defaults to None.

None

Returns:

Name Type Description
Callable Callable

The wrapped function.

transcribe

Transcribes audio from a file.

This function converts audio from a file to text.

transcribe_async async

Transcribes audio from a file.

This function converts audio from a file to text.