Documentation
¶
Index ¶
- Constants
- Variables
- type ClientOptions
- func (o *ClientOptions) GetAuthToken() (token string, isBearer bool)
- func (o *ClientOptions) GetHost() string
- func (o *ClientOptions) GetProxy() func(*http.Request) (*url.URL, error)
- func (o *ClientOptions) GetRedirectService() bool
- func (o *ClientOptions) GetSkipServerAuth() bool
- func (o *ClientOptions) GetWSHeaderProcessor() func(http.Header)
- func (o *ClientOptions) Parse() error
- func (o *ClientOptions) SetAPIKey(apiKey string)
- func (o *ClientOptions) SetAccessToken(accessToken string)
- type FluxConfigureOptions
- type FluxThresholds
- type FluxTranscriptionOptions
Constants ¶
const (
PackageVersion string = "v2.0"
)
const (
TypeSettings = v1.TypeSettings
)
Variables ¶
var ( // ErrNoAPIKey no api key found ErrNoAPIKey = v1.ErrNoAPIKey )
errors
Functions ¶
This section is empty.
Types ¶
type ClientOptions ¶
type ClientOptions struct {
APIKey string
AccessToken string // JWT access token for Bearer authentication
Host string // override for the host endpoint
APIVersion string // override for the version used
Path string // override for the endpoint path usually <version/listen> or <version/projects>
SelfHosted bool // set to true if using on-prem
Proxy func(*http.Request) (*url.URL, error) // provide function for proxy -- e.g. http.ProxyFromEnvironment
WSHeaderProcessor func(http.Header) // process headers before dialing for websocket connection
// shared client options
SkipServerAuth bool // keeps the client from authenticating with the server
// speech-to-text client options
RedirectService bool // allows HTTP redirects to be followed
EnableKeepAlive bool // enables the keep alive feature
// contains filtered or unexported fields
}
ClientOptions defines any options for the client
func (*ClientOptions) GetAuthToken ¶
func (o *ClientOptions) GetAuthToken() (token string, isBearer bool)
GetAuthToken returns the effective authentication token following priority order (thread-safe): 1. AccessToken (Bearer) - highest priority 2. APIKey (Token) - fallback
func (*ClientOptions) GetHost ¶
func (o *ClientOptions) GetHost() string
func (*ClientOptions) GetRedirectService ¶
func (o *ClientOptions) GetRedirectService() bool
func (*ClientOptions) GetSkipServerAuth ¶
func (o *ClientOptions) GetSkipServerAuth() bool
func (*ClientOptions) GetWSHeaderProcessor ¶
func (o *ClientOptions) GetWSHeaderProcessor() func(http.Header)
func (*ClientOptions) Parse ¶
func (o *ClientOptions) Parse() error
func (*ClientOptions) SetAPIKey ¶
func (o *ClientOptions) SetAPIKey(apiKey string)
SetAPIKey dynamically sets the API key for Token authentication (thread-safe)
func (*ClientOptions) SetAccessToken ¶
func (o *ClientOptions) SetAccessToken(accessToken string)
SetAccessToken dynamically sets the access token for Bearer authentication (thread-safe)
type FluxConfigureOptions ¶
type FluxConfigureOptions struct {
Thresholds *FluxThresholds `json:"thresholds,omitempty"`
Keyterms []string `json:"keyterms,omitempty"`
LanguageHints []string `json:"language_hints,omitempty"`
}
FluxConfigureOptions are the parameters for a mid-session Configure control message. Send via WSCallback.Configure() or WSChannel.Configure() to adjust turn-detection behavior without reconnecting.
type FluxThresholds ¶
type FluxThresholds struct {
EagerEotThreshold float64 `json:"eager_eot_threshold,omitempty"`
EotThreshold float64 `json:"eot_threshold,omitempty"`
EotTimeoutMs int `json:"eot_timeout_ms,omitempty"`
}
FluxThresholds holds the turn-detection thresholds used in Configure messages and ConfigureSuccess responses.
type FluxTranscriptionOptions ¶
type FluxTranscriptionOptions struct {
// Model is required. Valid values: "flux-general-en", "flux-general-multi"
Model string `json:"model" schema:"model"`
// Encoding of the audio stream (e.g. "linear16", "opus"). Omit for containerized formats.
Encoding string `json:"encoding,omitempty" schema:"encoding,omitempty"`
// SampleRate of the audio in Hz (8000–48000). Omit for containerized formats.
SampleRate int `json:"sample_rate,omitempty" schema:"sample_rate,omitempty"`
// EagerEotThreshold (0.3–0.9): triggers early end-of-turn signal before silence completes.
EagerEotThreshold float64 `json:"eager_eot_threshold,omitempty" schema:"eager_eot_threshold,omitempty"`
// EotThreshold (0.5–0.9, default 0.7): confidence threshold for declaring EndOfTurn.
EotThreshold float64 `json:"eot_threshold,omitempty" schema:"eot_threshold,omitempty"`
// EotTimeoutMs (500–10000, default 5000): silence duration in ms before forcing EndOfTurn.
EotTimeoutMs int `json:"eot_timeout_ms,omitempty" schema:"eot_timeout_ms,omitempty"`
// Keyterm provides domain-specific vocabulary hints for improved recognition.
Keyterm []string `json:"keyterm,omitempty" schema:"keyterm,omitempty"`
// Tag attaches tracking metadata to the request.
Tag []string `json:"tag,omitempty" schema:"tag,omitempty"`
// MipOptOut opts the request out of Deepgram's model improvement program.
MipOptOut bool `json:"mip_opt_out,omitempty" schema:"mip_opt_out,omitempty"`
// LanguageHint constrains and prioritizes language detection for the
// flux-general-multi model. Only valid when Model is "flux-general-multi".
LanguageHint []string `json:"language_hint,omitempty" schema:"language_hint,omitempty"`
}
FluxTranscriptionOptions are the query parameters for wss://api.deepgram.com/v2/listen (the Deepgram Flux turn-based audio API).
func (*FluxTranscriptionOptions) Check ¶
func (o *FluxTranscriptionOptions) Check() error