speech

package
v0.21.0 Latest Latest
Warning

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

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

Documentation

Overview

Package speech instruments Core speech-synthesis calls with OpenTelemetry.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidConfig   = errors.New("otel/speech: invalid config")
	ErrInvalidModel    = errors.New("otel/speech: invalid model")
	ErrInvalidStreamer = errors.New("otel/speech: invalid streamer")
)

Functions

This section is empty.

Types

type Middleware

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

Middleware observes synthesis metadata without recording input text, voice names, or generated audio.

func NewMiddleware

func NewMiddleware(config MiddlewareConfig) (Middleware, error)

NewMiddleware snapshots provider identity and resolves nil OTel providers to the official process globals.

func (Middleware) Wrap

func (m Middleware) Wrap(next corespeech.Model) (corespeech.Model, error)

Wrap decorates one synchronous speech Model.

func (Middleware) WrapStream

func (m Middleware) WrapStream(next corespeech.Streamer) (corespeech.Streamer, error)

WrapStream decorates one streaming speech capability. Provider work remains lazy and stopping iteration closes the observation synchronously.

type MiddlewareConfig

type MiddlewareConfig struct {
	Provider       string
	TracerProvider trace.TracerProvider
	MeterProvider  metric.MeterProvider
	// LoggerProvider receives GenAI exception events. Nil uses the global provider.
	LoggerProvider log.LoggerProvider
}

MiddlewareConfig identifies the provider and optional OTel providers used by speech instrumentation.

func (MiddlewareConfig) Validate

func (m MiddlewareConfig) Validate() error

Validate checks construction inputs without resolving global providers.

Jump to

Keyboard shortcuts

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