dictation

package
v0.35.18 Latest Latest
Warning

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

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

Documentation

Overview

Package dictation implements the POST /v1/dictation/transcribe handler. It is a thin adapter around the Framework's STT router: accept audio bytes and metadata, normalize to canonical PCM via internal/server/audio, and delegate to the router. The handler has no knowledge of which provider serves the request; that's the router's job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler implements the dictation HTTP surface.

func New

func New(opts Options) (*Handler, error)

New constructs a Handler. The router must be non-nil; a zero maxBytes defaults to 25 MB to match the documented API contract.

func (*Handler) Mount

func (h *Handler) Mount(mux *http.ServeMux)

Mount registers the handler on the given mux at /v1/dictation/transcribe.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP routes the request by Content-Type.

type Options

type Options struct {
	Router        Transcriber
	MaxUploadMB   int    // request body ceiling; 0 disables the limit (discouraged)
	DefaultPrompt string // applied when the request does not provide a prompt
	Store         store.Store
}

Options configures a single handler instance.

type Transcriber

type Transcriber interface {
	Route(ctx context.Context, audio []byte, audioDurationSecs float64, opts stt.TranscribeOpts) (*stt.Result, error)
}

Transcriber is the minimal surface the handler needs from an STT router. The production implementation is `internal/router.Router`; tests provide a fake.

Jump to

Keyboard shortcuts

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