interfaces

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 9 Imported by: 39

Documentation

Overview

This package contains the interface to manage the prerecorded and live/stream interfaces for the Deepgram API

Index

Constants

This section is empty.

Variables

View Source
var DgAgent string = "@deepgram/sdk/" + sdkVersion + " go/" + goVersion()

DgAgent is the user agent string for the SDK

View Source
var (
	// ErrNoAPIKey no api key found
	ErrNoAPIKey = errors.New("no api key found")
)

errors

Functions

func WithCustomHeaders

func WithCustomHeaders(ctx context.Context, headers http.Header) context.Context

WithCustomHeaders appends a header to the given context

func WithCustomParameters

func WithCustomParameters(ctx context.Context, params map[string][]string) context.Context

WithCustomParameters

func WithSigner

func WithSigner(ctx context.Context, s Signer) context.Context

WithSigner appends a signer to the given context

Types

type AnalyzeOptions added in v1.1.0

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 added in v1.1.0

func (o *AnalyzeOptions) Check() error

type ClientOptions added in v1.0.4

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

	// live client options
	RedirectService bool // allows HTTP redirects to be followed
	EnableKeepAlive bool // enables the keep alive feature
}

ClientOptions defines any options for the client

func (*ClientOptions) Parse added in v1.0.4

func (o *ClientOptions) Parse() error

type DeepgramError added in v1.3.0

type DeepgramError struct {
	ErrCode   string `json:"err_code"`
	ErrMsg    string `json:"err_msg"`
	RequestID string `json:"request_id"`
}

DeepgramError is the Deepgram specific response error

type HeadersContext

type HeadersContext struct{}

HeadersContext blackbox of data

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"`
	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"`
	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 added in v1.0.4

func (o *LiveTranscriptionOptions) Check() error

type ParametersContext

type ParametersContext struct{}

ParametersContext blackbox of data

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 added in v1.0.4

type RawResponse

type RawResponse struct {
	bytes.Buffer
}

RawResponse may be used with the Do method as the resBody argument in order to capture the raw response data.

type Signer

type Signer interface {
	SignRequest(*http.Request) error
}
custom headers and configuration options

Signer callback for the certificant signer

type SignerContext

type SignerContext struct{}

SignerContext blackbox of data

type SpeakOptions added in v1.2.0

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"`
}

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-preview-api

func (*SpeakOptions) Check added in v1.2.0

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

Jump to

Keyboard shortcuts

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