assemblyai

package module
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package assemblyai wraps AssemblyAI's speech-to-text API.

NewTranscriptionModel orchestrates the upload → submit → poll → fetch flow against AssemblyAI's async /v2/transcript endpoints. transcription.Options.Model selects the primary official model; use "universal-3-5-pro" for the current frontier model and add "universal-2" to the native speech_models option as a fallback.

Provider extras (speaker diarization, auto chapters, sentiment analysis, entity detection, PII redaction, content safety, language detection) use official JSON names under RequestExtensionKey. A Core language, native language_codes, and enabled language_detection are mutually exclusive after defaults and per-call options resolve. Conflicts fail before either upload or transcript creation.

See https://www.assemblyai.com/docs for the full reference.

Index

Constants

View Source
const (
	RequestExtensionKey  = Provider + "/request"
	ResponseExtensionKey = Provider + "/response"

	DefaultBaseURL      = "https://api.assemblyai.com/v2"
	DefaultPollInterval = 2 * time.Second
	DefaultPollTimeout  = 30 * time.Minute
)
View Source
const (
	ModelUniversal3Point5Pro = "universal-3-5-pro"
	ModelUniversal2          = "universal-2"
)
View Source
const (
	Provider = "assemblyai"
)

Provider is the stable backend name for host-side attribution.

Variables

This section is empty.

Functions

This section is empty.

Types

type TranscriptionModel added in v0.41.0

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

TranscriptionModel wraps AssemblyAI's async transcription flow behind a synchronous transcription.Model.Call surface. One Call uploads the audio, enqueues a job, and polls until the job reaches a terminal state — callers don't see the polling unless their ctx cancels or [PollTimeout] elapses.

Speaker labels, sentiment analysis, auto chapters, entity detection and the rest of AssemblyAI's analysis features live on official JSON option names under RequestExtensionKey.

Audio comes only from transcription.Request.Audio. URI media is submitted directly; inline bytes are uploaded before the transcription is created.

func NewTranscriptionModel added in v0.41.0

func NewTranscriptionModel(ctx context.Context, config TranscriptionModelConfig) (*TranscriptionModel, error)

func (*TranscriptionModel) Call added in v0.41.0

type TranscriptionModelConfig added in v0.41.0

type TranscriptionModelConfig struct {
	APIKey         string
	DefaultOptions transcription.Options
	BaseURL        string
	HTTPClient     *http.Client

	// PollInterval / PollTimeout configure the synchronous Call
	// wrapper around AssemblyAI's async job model. Zero values fall
	// back to [DefaultPollInterval] / [DefaultPollTimeout].
	PollInterval time.Duration
	PollTimeout  time.Duration
}

func (TranscriptionModelConfig) Validate added in v0.41.0

func (t TranscriptionModelConfig) Validate() error

Jump to

Keyboard shortcuts

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