google

package
v0.67.7 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 24 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

Index

Constants

View Source
const (
	EnvAPIKey                 = envGoogleSTTAPIKey
	EnvCloudAPIKey            = envGoogleCloudSTTAPIKey
	EnvLegacyAPIKey           = envGoogleLegacySTTAPIKey
	EnvCredentialsJSON        = envGoogleSTTCredentialsJSON
	EnvApplicationCredentials = envGoogleApplicationCreds
)

Credential env names a host can present to a user when streaming transcription is unavailable for lack of credentials.

Variables

This section is empty.

Functions

func StreamingCredentialsPresent added in v0.64.3

func StreamingCredentialsPresent() bool

StreamingCredentialsPresent reports whether service-account or ADC credentials are configured for streaming recognition. Batch transcription only needs an API key and is unaffected.

Types

type Provider

type Provider struct {
	APIKey                    string
	Model                     string // "latest_long", "latest_short", or another Google STT v1 model tag
	STTCredentialsJSONEnv     string
	ApplicationCredentialsEnv string
	BaseURL                   string // Override for testing; defaults to googleSTTBaseURL
	Validation                netsec.ValidationOptions
	// contains filtered or unexported fields
}

Provider implements stt.STTProvider for Google Cloud Speech-to-Text v1 REST API.

BaseURL is user-configurable (for testing or regional endpoints). It is validated against Validation on every request. Default Validation is strict (public https only).

func New

func New(apiKey, model string) *Provider

New creates a provider for Google Cloud Speech-to-Text. Model defaults to "latest_long" if empty.

func (*Provider) Capabilities added in v0.64.3

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

Capabilities reports what this provider does beyond plain transcription.

func (*Provider) Health added in v0.64.3

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

Health checks if the Google Speech API is reachable.

func (*Provider) Name added in v0.64.3

func (p *Provider) Name() string

Name returns the provider identifier.

func (*Provider) SetStreamingCredentialEnvs added in v0.64.3

func (p *Provider) SetStreamingCredentialEnvs(credentialsJSONEnv, applicationCredentialsEnv string)

func (*Provider) StartSpeakerStream added in v0.64.3

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

StartSpeakerStream opens a Google Cloud Speech-to-Text v2 StreamingRecognize session.

IMPORTANT: Google STT v2 does NOT support speaker diarization in streaming mode — diarization is available only in BatchRecognize/Recognize (see the Chirp-3 docs). This adapter therefore provides realtime TRANSCRIPTION only: frames carry Text without speaker labels (no Segment/Speakers). Streaming speaker diarization in the Voice Agent comes from Deepgram/AssemblyAI.

func (*Provider) Transcribe added in v0.64.3

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

Transcribe sends audio to Google Cloud Speech-to-Text v1 REST API.

Jump to

Keyboard shortcuts

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