listen

package
v1.7.0-dev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: MIT Imports: 6 Imported by: 2

Documentation

Overview

This package provides the prerecorded client implementation for the Deepgram API

Index

Constants

View Source
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

View Source
const (
	RESTPackageVersion = listenv1rest.PackageVersion
)

********************************* REST Client *********************************

View Source
const (
	WebSocketPackageVersion = listenv1ws.PackageVersion
)

********************************* WebSocket / Streaming / Live *********************************

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.

func NewLive deprecated

NewLive is an alias for NewWebSocket

Deprecated: This package is deprecated. Use NewWebSocket instead. This will be removed in a future release.

func NewLiveForDemo deprecated

Older "Live" functions

NewLiveForDemo is an alias for NewWebSocketForDemo

Deprecated: This package is deprecated. Use NewWebSocketForDemo instead. This will be removed in a future release.

func NewLiveWithCancel deprecated

NewLiveWithCancel is an alias for NewWebSocketWithCancel

Deprecated: This package is deprecated. Use NewWebSocketWithCancel instead. This will be removed in a future release.

func NewLiveWithDefaults deprecated

NewLiveWithDefaults is an alias for NewWebSocketWithDefaults

Deprecated: This package is deprecated. Use NewWebSocketWithDefaults instead. This will be removed in a future release.

func NewPreRecorded deprecated

func NewPreRecorded(apiKey string, options *interfaces.ClientOptions) *listenv1rest.RESTClient

NewPreRecorded is an alias for NewREST

Deprecated: This package is deprecated. Use NewREST instead. This will be removed in a future release.

func NewPreRecordedWithDefaults deprecated

func NewPreRecordedWithDefaults() *listenv1rest.RESTClient

NewPreRecordedWithDefaults is an alias for NewRESTWithDefaults

Deprecated: This package is deprecated. Use NewRESTWithDefaults instead. This will be removed in a future release.

func NewREST

func NewREST(apiKey string, options *interfaces.ClientOptions) *listenv1rest.RESTClient

NewREST creates a new prerecorded client with the specified options

Input parameters: - apiKey: string containing the Deepgram API key - options: ClientOptions which allows overriding things like hostname, version of the API, etc.

func NewRESTWithDefaults

func NewRESTWithDefaults() *listenv1rest.RESTClient

NewRESTWithDefaults creates a new analyze/read client with all default options

Notes:

  • The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY

func NewWSUsingCallback added in v1.6.0

NewWSUsingCallback 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 NewWSUsingCallbackForDemo added in v1.6.0

func NewWSUsingCallbackForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSCallback, error)
Using Callbacks

NewWSUsingCallbackForDemo 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.

Notes:

  • The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY

func NewWSUsingCallbackWithCancel added in v1.6.0

func NewWSUsingCallbackWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)

NewWSUsingCallbackWithCancel 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 NewWSUsingCallbackWithDefaults added in v1.6.0

func NewWSUsingCallbackWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)

NewWSUsingCallbackWithDefaults 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

func NewWSUsingChan added in v1.6.0

NewWSUsingChan 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. - chans: LiveMessageCallback which is a chans that allows you to perform actions based on the transcription

func NewWSUsingChanForDemo added in v1.6.0

func NewWSUsingChanForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSChannel, error)
Using Channels

NewWSUsingChanForDemo creates a new websocket connection for demo purposes only

Input parameters: - ctx: context.Context object - tOptions: LiveTranscriptionOptions which allows overriding things like language, model, etc.

Notes:

  • The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY

func NewWSUsingChanWithCancel added in v1.6.0

func NewWSUsingChanWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)

NewWSUsingChanWithCancel creates a new websocket connection with the specified options

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. - chans: LiveMessageCallback which is a chans that allows you to perform actions based on the transcription

func NewWSUsingChanWithDefaults added in v1.6.0

func NewWSUsingChanWithDefaults(ctx context.Context, options *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)

NewWebSocketUsingChanWithDefaults 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.

Notes:

  • The Deepgram API KEY is read from the environment variable DEEPGRAM_API_KEY
  • The chans handler is set to the default handler which just prints all messages to the console

func NewWebSocket

NewWebSocket creates a new websocket connection with the specified options

Please see NewWebSocketUsingCallback for more information.

TODO: Deprecate this function later

func NewWebSocketForDemo

func NewWebSocketForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.Client, error)

********************************* Deprecated (THESE WILL STILL WORK, BUT WILL BE REMOVED IN A FUTURE RELEASE) *********************************

NewWebSocketForDemo creates a new websocket connection with all default options

Please see NewWebSocketUsingCallbackForDemo for more information.

TODO: Deprecate this function later

func NewWebSocketUsingCallback added in v1.6.0

func NewWebSocketUsingCallback(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)

NewWebSocketUsingCallback is an alias for NewWSUsingCallback TODO: Deprecate this function later

func NewWebSocketUsingCallbackForDemo added in v1.6.0

func NewWebSocketUsingCallbackForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSCallback, error)

NewWebSocketUsingCallbackForDemo is an alias for NewWSUsingCallbackForDemo TODO: Deprecate this function later

func NewWebSocketUsingCallbackWithCancel added in v1.6.0

func NewWebSocketUsingCallbackWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)

NewWebSocketUsingCallbackWithCancel is an alias for NewWSUsingCallbackWithCancel TODO: Deprecate this function later

func NewWebSocketUsingCallbackWithDefaults added in v1.6.0

func NewWebSocketUsingCallbackWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.WSCallback, error)

NewWebSocketUsingCallbackWithDefaults is an alias for NewWSUsingCallbackWithDefaults TODO: Deprecate this function later

func NewWebSocketUsingChan added in v1.6.0

func NewWebSocketUsingChan(ctx context.Context, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)

NewWebSocketUsingChan is an alias for NewWSUsingChan TODO: Deprecate this function later

func NewWebSocketUsingChanForDemo added in v1.6.0

func NewWebSocketUsingChanForDemo(ctx context.Context, options *interfaces.LiveTranscriptionOptions) (*listenv1ws.WSChannel, error)

NewWebSocketUsingChanForDemo is an alias for NewWSUsingChanForDemo TODO: Deprecate this function later

func NewWebSocketUsingChanWithCancel added in v1.6.0

func NewWebSocketUsingChanWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)

NewWebSocketUsingChanWithCancel is an alias for NewWSUsingChanWithCancel TODO: Deprecate this function later

func NewWebSocketUsingChanWithDefaults added in v1.6.0

func NewWebSocketUsingChanWithDefaults(ctx context.Context, options *interfaces.LiveTranscriptionOptions, chans msginterfaces.LiveMessageChan) (*listenv1ws.WSChannel, error)

NewWebSocketUsingChanWithDefaults is an alias for NewWSUsingChanWithDefaults TODO: Deprecate this function later

func NewWebSocketWithCancel

func NewWebSocketWithCancel(ctx context.Context, ctxCancel context.CancelFunc, apiKey string, cOptions *interfaces.ClientOptions, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.Client, error)

NewWebSocketWithCancel creates a new websocket connection but has facilities to BYOC (Bring Your Own Cancel)

Please see NewWebSocketUsingCallbackWithCancel for more information.

TODO: Deprecate this function later

func NewWebSocketWithDefaults

func NewWebSocketWithDefaults(ctx context.Context, tOptions *interfaces.LiveTranscriptionOptions, callback msginterfaces.LiveMessageCallback) (*listenv1ws.Client, error)

NewWebSocketWithDefaults creates a new websocket connection with all default options

Please see NewWebSocketUsingCallbackWithDefaults for more information.

TODO: Deprecate this function later

Types

type InitLib

type InitLib struct {
	LogLevel      common.LogLevel
	DebugFilePath string
}

Initialization options for this SDK.

type LiveClient deprecated

type LiveClient = listenv1ws.Client

********************************* WebSocket / Streaming / Live ********************************* LiveClient is an alias for listenv1rest.Client

Deprecated: This alias is deprecated. Use WSCallback instead. This will be removed in a future release.

type PreRecordedClient deprecated

type PreRecordedClient = listenv1rest.RESTClient

********************************* REST Client ********************************* PreRecordedClient is an alias for listenv1rest.Client

Deprecated: This package is deprecated. Use RestClient instead. This will be removed in a future release.

type RESTClient added in v1.6.0

type RESTClient = listenv1rest.RESTClient

RestClient is an alias for listenv1rest.Client

type WSCallback added in v1.6.0

type WSCallback = listenv1ws.WSCallback

WSCallback is an alias for listenv1ws.WSCallback

type WSChannel added in v1.6.0

type WSChannel = listenv1ws.WSChannel

WSChannel is an alias for listenv1ws.WSChannel

Directories

Path Synopsis
v1
rest
This package provides the prerecorded client implementation for the Deepgram API
This package provides the prerecorded client implementation for the Deepgram API
websocket
This package provides the live/streaming client implementation for the Deepgram API
This package provides the live/streaming client implementation for the Deepgram API

Jump to

Keyboard shortcuts

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