openaitranscriptions

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: Apache-2.0, MIT Imports: 4 Imported by: 0

Documentation

Overview

Package openaitranscriptions implements the speech-to-text shape OpenAI defined and the compatible servers copied: a multipart POST to {base}/audio/transcriptions carrying file and model, answering {text}, or {text, segments} when response_format is verbose_json.

response_format is the one optional field that matters, and it differs by model: gpt-4o-transcribe and gpt-4o-mini-transcribe accept only json, whisper-1 also serves verbose_json, SiliconFlow documents no such field at all. json is the default everywhere it is documented, so nothing is sent unless api.TranscriptionsSettings names a format.

https://developers.openai.com/api/reference/resources/audio/subresources/transcriptions/methods/create

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client talks the OpenAI transcription shape to one endpoint.

func New

func New(cfg Config) *Client

New builds a client.

func (*Client) FormFields

func (c *Client) FormFields(language string) []api.FormField

FormFields is the golden-test entry point: the text parts of the form, in the order they are written.

func (*Client) Transcribe

func (c *Client) Transcribe(ctx context.Context, req api.TranscriptionRequest) (*api.Transcription, error)

Transcribe sends one audio file.

type Config

type Config struct {
	Endpoint api.Endpoint
	Settings api.TranscriptionsSettings
	Retry    api.RetryPolicy
}

Config is everything the client needs, already resolved by the api.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL