pyrit.prompt_target.OpenAIChatAudioConfig#

class OpenAIChatAudioConfig(voice: Literal['alloy', 'ash', 'ballad', 'coral', 'echo', 'fable', 'nova', 'onyx', 'sage', 'shimmer', 'verse', 'marin', 'cedar'], audio_format: Literal['wav', 'aac', 'mp3', 'flac', 'opus', 'pcm16'] = 'wav', prefer_transcript_for_history: bool = True)[source]#

Bases: object

Configuration for audio output from OpenAI Chat Completions API.

When provided to OpenAIChatTarget, this enables audio output from models that support it (e.g., gpt-4o-audio-preview).

Note: This is specific to the Chat Completions API. The Responses API does not support audio input or output. For real-time audio, use RealtimeTarget instead.

__init__(voice: Literal['alloy', 'ash', 'ballad', 'coral', 'echo', 'fable', 'nova', 'onyx', 'sage', 'shimmer', 'verse', 'marin', 'cedar'], audio_format: Literal['wav', 'aac', 'mp3', 'flac', 'opus', 'pcm16'] = 'wav', prefer_transcript_for_history: bool = True) None#

Methods

__init__(voice[, audio_format, ...])

to_extra_body_parameters()

Convert the config to extra_body_parameters format for OpenAI API.

Attributes

audio_format: Literal['wav', 'aac', 'mp3', 'flac', 'opus', 'pcm16'] = 'wav'#
prefer_transcript_for_history: bool = True#
to_extra_body_parameters() dict[str, Any][source]#

Convert the config to extra_body_parameters format for OpenAI API.

Returns:

Parameters to include in the request body for audio output.

Return type:

dict

voice: Literal['alloy', 'ash', 'ballad', 'coral', 'echo', 'fable', 'nova', 'onyx', 'sage', 'shimmer', 'verse', 'marin', 'cedar']#