Docs /Templates/ sinapsis-openai

OpenAIAudioTranslationWrapper

sinapsis-openaiOpenAIdynamicopenaiprompttext

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 set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-openai==1.0.0
uv pip install sinapsis-openai==1.0.0
uv add sinapsis-openai==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

modelRequired
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

typing.Literal['whisper-1', 'gpt-transcribe', 'gpt-4o-transcribe', 'gpt-4o-mini-transcribe', 'gpt-4o-mini-transcribe-2025-12-15', 'gpt-4o-transcribe-diarize']
Required
Default: null
createRequired
createAttributes
Required
Default: null
prompt
Any
Optional
Default: null
timeout
Any
Optional
Default: null
extra_body
Any
Optional
Default: null
extra_query
Any
Optional
Default: null
temperature
Any
Optional
Default: null
extra_headers
Any
Optional
Default: null
response_format
Any
Optional
Default: null
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
openai_initRequired
__init__Attributes
Required
Default: null
api_key
typing.Union[str, typing.Callable[[], str], NoneType]
Optional
Default: null
project
typing.Optional[str]
Optional
Default: null
timeout
Any
Optional
Default: null
base_url
Any
Optional
Default: null
provider
Any
Optional
Default: null
http_client
Any
Optional
Default: null
max_retries
int
Optional
Default: 2
organization
typing.Optional[str]
Optional
Default: null
admin_api_key
typing.Optional[str]
Optional
Default: null
default_query
typing.Optional[typing.Mapping[str, object]]
Optional
Default: null
webhook_secret
typing.Optional[str]
Optional
Default: null
default_headers
typing.Optional[typing.Mapping[str, str]]
Optional
Default: null
workload_identity
Any
Optional
Default: null
websocket_base_url
Any
Optional
Default: null

Configuration example

Example from the Python docstring:

yaml
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: en
Show schema-based configuration skeleton
yaml
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

Immediate parent: sinapsis_openai.templates.openai_audio.OpenAIAudioTranslation

Environment variables

Environment definitions belong to their canonical Python modules.

SINAPSIS_BUILD_DOCS · defined elsewhere