azurespeech

package
v0.76.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package azurespeech implements stt.STTProvider on the Azure Speech fast-transcription surface of a Microsoft Foundry resource. That surface is where Microsoft's own MAI-Transcribe models live: they are not deployments, never show up on the OpenAI-compatible /openai/v1 route, and are addressed on the resource's custom domain instead.

Stability: Experimental — may change in any release.

Index

Constants

View Source
const (
	// APIVersion is the fast-transcription API version this adapter speaks
	// (verified live 2026-09-04).
	APIVersion = "2025-10-15"
	// DefaultModel is the MAI transcription model used when none is configured.
	DefaultModel = "MAI-Transcribe-2"
)

Variables

This section is empty.

Functions

func IsMAITranscribeModel

func IsMAITranscribeModel(model string) bool

IsMAITranscribeModel reports whether model names a Microsoft MAI transcription model, which is what decides between this adapter and the OpenAI-compatible route.

func ShortLocale

func ShortLocale(bcp47 string) string

ShortLocale converts a BCP-47 tag to the primary language subtag MAI expects in "locales": de-DE -> de, pt-BR -> pt, zh-CN -> zh. Three-letter tags such as yue or fil pass through unchanged.

Types

type Options

type Options struct {
	// Host is the resource's custom domain, e.g.
	// "myresource.cognitiveservices.azure.com" (no scheme). Required.
	Host string
	// APIKey is the resource key, sent as Ocp-Apim-Subscription-Key.
	APIKey string
	// BearerToken, when set, wins over APIKey: it is called per request and
	// the token rides "Authorization: Bearer". Hosts set it for Entra sign-in.
	BearerToken speechkit.BearerTokenFunc
	// Model is "MAI-Transcribe-2" (default) or "MAI-Transcribe-1.5".
	Model string
	// Style is "clean" (default; dictation wants readable text) or "verbatim".
	Style string
	// Timestamps is "none" (default), "segment" or "word".
	Timestamps string
	// Diarization enables speaker labels for every request. A request can
	// also ask for them through TranscribeOpts.Speaker.
	Diarization bool
	// MaxPhrases caps the phraseList built from keyterms (default 100).
	MaxPhrases int
}

Options configures the MAI fast-transcription provider.

type Provider

type Provider struct {
	Host        string
	APIKey      string
	BearerToken speechkit.BearerTokenFunc
	Model       string
	Style       string
	Timestamps  string
	Diarization bool
	MaxPhrases  int
	Validation  netsec.ValidationOptions
	// contains filtered or unexported fields
}

Provider implements stt.STTProvider for MAI-Transcribe on Azure Speech.

Host is user-supplied configuration and is validated against Validation on every request. The default Validation is strict: only public https hosts are accepted. Tests and hosts pointing at loopback servers relax it.

func New

func New(opts Options) *Provider

New creates a provider. Default Validation is strict (public https only).

func (*Provider) Capabilities

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

Capabilities reports the STT baseline plus speaker diarization, which the fast-transcription API does natively.

func (*Provider) Health

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

Health lists one base model with the configured credential. It is free, read-only, and exercises exactly the auth path Transcribe uses.

func (*Provider) Name

func (*Provider) Name() string

Name returns the shared Foundry provider id.

func (*Provider) Transcribe

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

Transcribe posts the audio to transcriptions:transcribe and maps the combined text, phrase locale and (when asked for) speaker segments.

Jump to

Keyboard shortcuts

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