OpenAIAudioTranslationWrapper
Python template · sinapsis_openai.templates.openai_audio
Overview
Template that wraps the `OpenAI.audio.translations.create` API endpoint to perform audio translation tasks. This template excludes the `file` attribute (expected to be provided via the DataContainers packet `source`) and the `model` attribute (which is configured exclusively in the templates `AttributesBaseModel`) from the API caller. This design ensures that the file path is dynamically extracted from the data packet and that the audio model comes solely from the template configuration.
create — inherited documentation
Translates audio into English.
Args: file: The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough format metadata for the file to be identified. We recommend an extension-bearing filename and an appropriate content type.
model: ID of the model to use. Only `whisper-1` (which is powered by our open source Whisper V2 model) is currently available.
prompt: An optional text to guide the model's style or continue a previous audio segment. The [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting) should be in English.
response_format: The format of the output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`.
temperature: The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
extra_body: Add additional JSON properties to the request
timeout: Override the client-level default timeout for this request, in seconds
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-openai==1.0.0uv pip install sinapsis-openai==1.0.0uv add sinapsis-openai==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
The model to use for audio transcription. openai_init api_key typing.Union[str, typing.Callable[[], str], NoneType]: default: None admin_api_key typing.Optional[str]: default: None workload_identity typing.Any:… Read full field description
The model to use for audio transcription. openai_init api_key typing.Union[str, typing.Callable[[], str], NoneType]: default: None admin_api_key typing.Optional[str]: default: None workload_identity typing.Any: default: None organization typing.Optional[str]: default: None project typing.Optional[str]: default: None webhook_secret typing.Optional[str]: default: None provider typing.Any: default: None base_url typing.Any: default: None websocket_base_url typing.Any: default: None timeout typing.Any: default: NOT_GIVEN max_retries <class 'int'>: default: 2 default_headers typing.Optional[typing.Mapping[str, str]]: default: None default_query typing.Optional[typing.Mapping[str, object]]: default: None http_client typing.Any: default: None _strict_response_validation <class 'bool'>: default: False _enforce_credentials <class 'bool'>: default: Truecreate prompt typing.Any: default: <openai.Omit object at 0x74f9db285a90> response_format typing.Any: default: <openai.Omit object at 0x74f9db285a90> temperature typing.Any: default: <openai.Omit object at 0x74f9db285a90> extra_headers typing.Any: default: None extra_query typing.Any: default: None extra_body typing.Any: default: None timeout typing.Any: default: NOT_GIVEN
Required
Default: null
Required
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Required
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: 2
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Optional
Default: null
Configuration example
Example from the Python docstring:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: OpenAIAudioTranslationWrapper
class_name: OpenAIAudioTranslationWrapper
template_input: InputTemplate
attributes:
model: 'whisper-1'
openai_init:
api_key: openai_api_key
max_retries: 2
create:
language: enShow schema-based configuration skeleton
templates:
- template_name: "OpenAIAudioTranslationWrapper"
class_name: "OpenAIAudioTranslationWrapper"
attributes:
model: "<required>"
create:
prompt: null
timeout: null
extra_body: null
extra_query: null
temperature: null
extra_headers: null
response_format: null
openai_init:
api_key: null
project: null
timeout: null
base_url: null
provider: null
http_client: null
max_retries: 2
organization: null
admin_api_key: null
default_query: null
webhook_secret: null
default_headers: null
workload_identity: null
websocket_base_url: null
Inheritance
sinapsis_openai.templates.openai_audio.OpenAIAudioTranslationEnvironment variables
Environment definitions belong to their canonical Python modules.