assemblyai

package
v0.68.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTurnCleanupPrompt = "" /* 164-byte string literal not displayed */

DefaultTurnCleanupPrompt asks the gateway to tidy a single turn without summarizing. {{turn}} is substituted by AssemblyAI.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	APIKey           string
	Models           []string
	StreamingModel   string
	BaseURL          string
	StreamingBaseURL string
	// SyncBaseURL points at the synchronous transcription endpoint
	// (https://sync.assemblyai.com; regional variants sync.us / sync.eu
	// exist). The Sync API returns a finished Universal-3.5 Pro transcript
	// in one request/response (~134 ms p50) for clips up to 120 s / 40 MB —
	// the low-latency dictation path. Empty uses the global endpoint.
	SyncBaseURL string
	// SyncModel is the X-AAI-Model routing header value for sync requests.
	// Empty uses universal-3-5-pro.
	SyncModel string
	// DisableSync forces every transcription through the classic async
	// upload+poll flow, even for clips the Sync API could serve.
	DisableSync bool
	// StreamingLLM, when set, attaches AssemblyAI LLM Gateway to Universal-3.5
	// Pro realtime turns. The formatted transcript still arrives as Turn;
	// LLMGatewayResponse may rewrite the final text for live cleanup.
	StreamingLLM *StreamingLLM
	Validation   netsec.ValidationOptions
	PollInterval time.Duration
	PollTimeout  time.Duration
	// contains filtered or unexported fields
}

Provider transcribes through AssemblyAI.

func New

func New(apiKey, models string) *Provider

New creates an AssemblyAI provider. models is the comma-separated model list; empty uses the provider default.

func (*Provider) Capabilities added in v0.64.3

func (*Provider) Capabilities() []speechkit.Capability

Capabilities reports what this provider does beyond plain transcription: besides separating voices it attributes them to caller-supplied names or roles.

func (*Provider) EnableStreamingLLM added in v0.64.3

func (p *Provider) EnableStreamingLLM(model, prompt string, maxTokens int)

EnableStreamingLLM attaches LLM Gateway cleanup to realtime dictation.

func (*Provider) Health added in v0.64.3

func (p *Provider) Health(ctx context.Context) error

func (*Provider) Name added in v0.64.3

func (p *Provider) Name() string

func (*Provider) StartDictationStream added in v0.64.3

StartDictationStream opens a Universal-3.5 Pro realtime session for live dictation partials. DictationStreamOptions.PromptHint rides as agent_context — the "minimal situational info" (domain, audience, locale hints) the model conditions on from the first frame; finalized user turns are carried forward by the provider automatically. Finalize sends Terminate: the provider flushes the trailing turn, emits Termination, and closes the socket (Receive then returns io.EOF), which matches SpeechKit's one-provider-stream-per-segment model.

func (*Provider) StartSpeakerStream added in v0.64.3

func (p *Provider) StartSpeakerStream(ctx context.Context, opts speaker.Options, format speaker.AudioFormat) (speaker.SpeakerStream, error)

func (*Provider) Transcribe added in v0.64.3

func (p *Provider) Transcribe(ctx context.Context, audio []byte, opts stt.TranscribeOpts) (*stt.Result, error)

func (*Provider) Warm added in v0.64.3

func (p *Provider) Warm(ctx context.Context) error

Warm pre-establishes the HTTPS connection to the Sync API (DNS, TCP, TLS) so the subsequent /transcribe request skips connection setup. Hosts should call it when recording starts; the endpoint is unauthenticated and safe to call repeatedly, and idle connections are evicted after seconds to minutes, so warm close to the transcription rather than at startup.

type StreamingLLM

type StreamingLLM struct {
	Model     string
	Prompt    string
	MaxTokens int
}

StreamingLLM is the LLM Gateway payload attached to a realtime dictation WebSocket. Model IDs are LLM Gateway catalog names, not STT names.

Jump to

Keyboard shortcuts

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