Documentation ¶
Overview ¶
This package contains the interface to manage the prerecorded and live/stream interfaces for the Deepgram API
Index ¶
- Constants
- Variables
- func WithCustomHeaders(ctx context.Context, headers http.Header) context.Context
- func WithCustomParameters(ctx context.Context, params map[string][]string) context.Context
- func WithSigner(ctx context.Context, s Signer) context.Context
- type AnalyzeOptions
- type ClientOptions
- type DeepgramError
- type DeepgramWarning
- type HeadersContext
- type LiveTranscriptionOptions
- type ParametersContext
- type PreRecordedTranscriptionOptions
- type RawResponse
- type Signer
- type SignerContext
- type SpeakOptions
- type StatusError
- type WSSpeakOptions
Constants ¶
const (
PackageVersion string = "v1.0"
)
Variables ¶
var DgAgent string = "@deepgram/sdk/" + sdkVersion + " go/" + goVersion()
DgAgent is the user agent string for the SDK
var ( // ErrNoAPIKey no api key found ErrNoAPIKey = errors.New("no api key found") )
errors
Functions ¶
func WithCustomHeaders ¶
WithCustomHeaders appends a header to the given context
func WithCustomParameters ¶
WithCustomParameters
Types ¶
type AnalyzeOptions ¶
type AnalyzeOptions struct { Callback string `json:"callback,omitempty" schema:"callback,omitempty"` CallbackMethod string `json:"callback_method,omitempty" schema:"callback_method,omitempty"` CustomIntent []string `json:"custom_intent,omitempty" schema:"custom_intent,omitempty"` CustomIntentMode string `json:"custom_intent_mode,omitempty" schema:"custom_intent_mode,omitempty"` CustomTopic []string `json:"custom_topic,omitempty" schema:"custom_topic,omitempty"` CustomTopicMode string `json:"custom_topic_mode,omitempty" schema:"custom_topic_mode,omitempty"` Intents bool `json:"intents,omitempty" schema:"intents,omitempty"` Language string `json:"language,omitempty" schema:"language,omitempty"` Summarize bool `json:"summarize,omitempty" schema:"summarize,omitempty"` Sentiment bool `json:"sentiment,omitempty" schema:"sentiment,omitempty"` Topics bool `json:"topics,omitempty" schema:"topics,omitempty"` }
func (*AnalyzeOptions) Check ¶
func (o *AnalyzeOptions) Check() error
type ClientOptions ¶
type ClientOptions struct { APIKey string 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 // 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 AutoFlushReplyDelta int64 // enables the auto flush feature based on the delta in milliseconds // text-to-speech client options AutoFlushSpeakDelta int64 // enables the auto flush feature based on the delta in milliseconds }
ClientOptions defines any options for the client
func (*ClientOptions) InspectListenMessage ¶ added in v1.6.0
func (o *ClientOptions) InspectListenMessage() bool
InspectListenMessage returns true if the Listen message should be inspected
func (*ClientOptions) InspectSpeakMessage ¶ added in v1.6.0
func (o *ClientOptions) InspectSpeakMessage() bool
InspectSpeakMessage returns true if the Speak message should be inspected
func (*ClientOptions) Parse ¶
func (o *ClientOptions) Parse() error
type DeepgramError ¶
type DeepgramError struct { Type string ErrCode string `json:"err_code,omitempty"` ErrMsg string `json:"err_msg,omitempty"` Description string `json:"description,omitempty"` Variant string `json:"variant,omitempty"` }
DeepgramError is the Deepgram specific response error
type DeepgramWarning ¶
type DeepgramWarning struct { Type string WarnCode string `json:"warn_code,omitempty"` WarnMsg string `json:"warn_msg,omitempty"` Description string `json:"description,omitempty"` Variant string `json:"variant,omitempty"` }
DeepgramWarning is the Deepgram specific response warning
type LiveTranscriptionOptions ¶
type LiveTranscriptionOptions struct { Alternatives int `json:"alternatives,omitempty" schema:"alternatives,omitempty"` Callback string `json:"callback,omitempty" schema:"callback,omitempty"` CallbackMethod string `json:"callback_method,omitempty" schema:"callback_method,omitempty"` Channels int `json:"channels,omitempty" schema:"channels,omitempty"` Diarize bool `json:"diarize,omitempty" schema:"diarize,omitempty"` DiarizeVersion string `json:"diarize_version,omitempty" schema:"diarize_version,omitempty"` Dictation bool `json:"dictation,omitempty" schema:"dictation,omitempty"` // Option to format spoken punctuated commands, must be enabled with punctuate parameter to true. Eg: "i went to the store comma new paragraph then i went home period" --> "i went to the store, <\n> then i went home." Encoding string `json:"encoding,omitempty" schema:"encoding,omitempty"` Endpointing string `json:"endpointing,omitempty" schema:"endpointing,omitempty"` Extra []string `json:"extra,omitempty" schema:"extra,omitempty"` FillerWords bool `json:"filler_words,omitempty" schema:"filler_words,omitempty"` InterimResults bool `json:"interim_results,omitempty" schema:"interim_results,omitempty"` Keywords []string `json:"keywords,omitempty" schema:"keywords,omitempty"` Language string `json:"language,omitempty" schema:"language,omitempty"` Model string `json:"model,omitempty" schema:"model,omitempty"` Multichannel bool `json:"multichannel,omitempty" schema:"multichannel,omitempty"` NoDelay bool `json:"no_delay,omitempty" schema:"no_delay,omitempty"` Numerals bool `json:"numerals,omitempty" schema:"numerals,omitempty"` ProfanityFilter bool `json:"profanity_filter,omitempty" schema:"profanity_filter,omitempty"` Punctuate bool `json:"punctuate,omitempty" schema:"punctuate,omitempty"` Redact []string `json:"redact,omitempty" schema:"redact,omitempty"` Replace []string `json:"replace,omitempty" schema:"replace,omitempty"` SampleRate int `json:"sample_rate,omitempty" schema:"sample_rate,omitempty"` Search []string `json:"search,omitempty" schema:"search,omitempty"` SmartFormat bool `json:"smart_format,omitempty" schema:"smart_format,omitempty"` Tag []string `json:"tag,omitempty" schema:"tag,omitempty"` Tier string `json:"tier,omitempty" schema:"tier,omitempty"` // Tier is only used for legacy models. Deprecated: This field is deprecated and will be removed in a future release. UtteranceEndMs string `json:"utterance_end_ms,omitempty" schema:"utterance_end_ms,omitempty"` VadEvents bool `json:"vad_events,omitempty" schema:"vad_events,omitempty"` Version string `json:"version,omitempty" schema:"version,omitempty"` }
LiveTranscriptionOptions contain all of the knobs and dials to control the live transcription from the Deepgram API
Please see the live/streaming documentation for more details: https://developers.deepgram.com/reference/streaming
func (*LiveTranscriptionOptions) Check ¶
func (o *LiveTranscriptionOptions) Check() error
type PreRecordedTranscriptionOptions ¶
type PreRecordedTranscriptionOptions struct { Alternatives int `json:"alternatives,omitempty" schema:"alternatives,omitempty"` Callback string `json:"callback,omitempty" schema:"callback,omitempty"` CallbackMethod string `json:"callback_method,omitempty" schema:"callback_method,omitempty"` Channels int `json:"channels,omitempty" schema:"channels,omitempty"` CustomIntent []string `json:"custom_intent,omitempty" schema:"custom_intent,omitempty"` CustomIntentMode string `json:"custom_intent_mode,omitempty" schema:"custom_intent_mode,omitempty"` CustomTopic []string `json:"custom_topic,omitempty" schema:"custom_topic,omitempty"` CustomTopicMode string `json:"custom_topic_mode,omitempty" schema:"custom_topic_mode,omitempty"` DetectEntities bool `json:"detect_entities,omitempty" schema:"detect_entities,omitempty"` DetectLanguage bool `json:"detect_language,omitempty" schema:"detect_language,omitempty"` DetectTopics bool `json:"detect_topics,omitempty" schema:"detect_topics,omitempty"` Diarize bool `json:"diarize,omitempty" schema:"diarize,omitempty"` DiarizeVersion string `json:"diarize_version,omitempty" schema:"diarize_version,omitempty"` Dictation bool `json:"dictation,omitempty" schema:"dictation,omitempty"` Encoding string `json:"encoding,omitempty" schema:"encoding,omitempty"` Extra []string `json:"extra,omitempty" schema:"extra,omitempty"` FillerWords bool `json:"filler_words,omitempty" schema:"filler_words,omitempty"` Intents bool `json:"intents,omitempty" schema:"intents,omitempty"` Keywords []string `json:"keywords,omitempty" schema:"keywords,omitempty"` Language string `json:"language,omitempty" schema:"language,omitempty"` Measurements bool `json:"measurements,omitempty" schema:"measurements,omitempty"` Model string `json:"model,omitempty" schema:"model,omitempty"` Multichannel bool `json:"multichannel,omitempty" schema:"multichannel,omitempty"` Numerals bool `json:"numerals,omitempty" schema:"numerals,omitempty"` Paragraphs bool `json:"paragraphs,omitempty" schema:"paragraphs,omitempty"` ProfanityFilter bool `json:"profanity_filter,omitempty" schema:"profanity_filter,omitempty"` Punctuate bool `json:"punctuate,omitempty" schema:"punctuate,omitempty"` Redact []string `json:"redact,omitempty" schema:"redact,omitempty"` Replace []string `json:"replace,omitempty" schema:"replace,omitempty"` SampleRate int `json:"sample_rate,omitempty" schema:"sample_rate,omitempty"` Search []string `json:"search,omitempty" schema:"search,omitempty"` Sentiment bool `json:"sentiment,omitempty" schema:"sentiment,omitempty"` SmartFormat bool `json:"smart_format,omitempty" schema:"smart_format,omitempty"` Summarize string `json:"summarize,omitempty" schema:"summarize,omitempty"` Tag []string `json:"tag,omitempty" schema:"tag,omitempty"` Topics bool `json:"topics,omitempty" schema:"topics,omitempty"` UttSplit float64 `json:"utt_split,omitempty" schema:"utt_split,omitempty"` Utterances bool `json:"utterances,omitempty" schema:"utterances,omitempty"` Version string `json:"version,omitempty" schema:"version,omitempty"` }
PreRecordedTranscriptionOptions contain all of the knobs and dials to control a Prerecorded transcription from the Deepgram API
Please see the prerecorded audio documentation for more details: https://developers.deepgram.com/reference/pre-recorded
func (*PreRecordedTranscriptionOptions) Check ¶
func (o *PreRecordedTranscriptionOptions) Check() error
type RawResponse ¶
RawResponse may be used with the Do method as the resBody argument in order to capture the raw response data.
type SpeakOptions ¶
type SpeakOptions struct { Model string `json:"model,omitempty" schema:"model,omitempty"` Encoding string `json:"encoding,omitempty" schema:"encoding,omitempty"` Container string `json:"container,omitempty" schema:"container,omitempty"` SampleRate int `json:"sample_rate,omitempty" schema:"sample_rate,omitempty"` BitRate int `json:"bit_rate,omitempty" schema:"bit_rate,omitempty"` Callback string `json:"callback,omitempty" schema:"callback,omitempty"` CallbackMethod string `json:"callback_method,omitempty" schema:"callback_method,omitempty"` }
SpeakOptions contain all of the knobs and dials to transform text into speech using the Deepgram API
Please see the text-to-speech documentation for more details: https://developers.deepgram.com/reference/text-to-speech-api
func (*SpeakOptions) Check ¶
func (o *SpeakOptions) Check() error
type StatusError ¶
type StatusError struct { Resp *http.Response DeepgramError *DeepgramError }
StatusError captures a REST error in the library
func (*StatusError) Error ¶
func (e *StatusError) Error() string
Error string representation for a given error
type WSSpeakOptions ¶ added in v1.6.0
type WSSpeakOptions struct { Model string `json:"model,omitempty" schema:"model,omitempty"` Encoding string `json:"encoding,omitempty" schema:"encoding,omitempty"` SampleRate int `json:"sample_rate,omitempty" schema:"sample_rate,omitempty"` BitRate int `json:"bit_rate,omitempty" schema:"bit_rate,omitempty"` }
WSSpeakOptions contain all of the knobs and dials to transform text into speech using the Deepgram API
Please see the text-to-speech documentation for more details: https://developers.deepgram.com/reference/transform-text-to-speech-websocket
func (*WSSpeakOptions) Check ¶ added in v1.6.0
func (o *WSSpeakOptions) Check() error