Documentation
¶
Overview ¶
*********** WARNING *********** This package provides the live client implementation for the Deepgram API
Deprecated: This package is deprecated. Use the listen package instead. This will be removed in a future release.
This package is frozen and no new functionality will be added. *********** WARNING ***********
*********** WARNING *********** This package provides the live client implementation for the Deepgram API
Deprecated: This package is deprecated. Use the listen package instead. This will be removed in a future release.
This package is frozen and no new functionality will be added. *********** WARNING ***********
Index ¶
- Constants
- func Init(init InitLib)
- func InitWithDefault()
- type Client
- func New(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, ...) (*Client, error)
- func NewForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*Client, error)
- func NewWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, ...) (*Client, error)
- func NewWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, ...) (*Client, error)
- type InitLib
Constants ¶
const ( LogLevelDefault = common.LogLevelDefault LogLevelErrorOnly = common.LogLevelErrorOnly LogLevelStandard = common.LogLevelStandard LogLevelElevated = common.LogLevelElevated LogLevelFull = common.LogLevelFull LogLevelDebug = common.LogLevelDebug LogLevelTrace = common.LogLevelTrace LogLevelVerbose = common.LogLevelVerbose )
please see pkg/common/init.go for more information
const (
PackageVersion = listenv1ws.PackageVersion
)
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(init InitLib)
The SDK Init function for this library. Allows you to set the logging level and use of a log file. Default is output to the stdout.
func InitWithDefault ¶
func InitWithDefault()
InitWithDefault is the SDK Init function for this library using default values.
Types ¶
type Client ¶
type Client = listenv1ws.Client
********************************* LiveClient *********************************
func New ¶
func New(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*Client, error)
New creates a new websocket connection with the specified options
Input parameters: - ctx: context.Context object - apiKey: string containing the Deepgram API key - cOptions: ClientOptions which allows overriding things like hostname, version of the API, etc. - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc. - callback: LiveMessageCallback which is a callback that allows you to perform actions based on the transcription
Notes:
- If apiKey is an empty string, the Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
- The callback handler is set to the default handler which just prints all messages to the console
func NewForDemo ¶
func NewForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*Client, error)
NewForDemo creates a new websocket connection with all default options
Notes:
- The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
func NewWithCancel ¶ added in v1.3.0
func NewWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*Client, error)
NewWithCancel creates a new websocket connection but has facilities to BYOC (Bring Your Own Cancel)
Input parameters: - ctx: context.Context object - ctxCancel: allow passing in own cancel - apiKey: string containing the Deepgram API key - cOptions: ClientOptions which allows overriding things like hostname, version of the API, etc. - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc. - callback: LiveMessageCallback which is a callback that allows you to perform actions based on the transcription
Notes:
- If apiKey is an empty string, the Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
- The callback handler is set to the default handler which just prints all messages to the console
func NewWithDefaults ¶
func NewWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*Client, error)
NewWithDefaults creates a new websocket connection with all default options
Input parameters: - ctx: context.Context object - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc. - callback: LiveMessageCallback which is a callback that allows you to perform actions based on the transcription
Notes:
- The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
- The callback handler is set to the default handler which just prints all messages to the console