listen

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 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
)

********************************* LiveClient *********************************

Variables

View Source
var NewLive = NewWebSocket

NewLive is an alias for NewWebSocket

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

View Source
var NewLiveForDemo = NewWebSocketForDemo

NewLiveForDemo is an alias for NewWebSocketForDemo

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

View Source
var NewLiveWithCancel = NewWebSocketWithCancel

NewLiveWithCancel is an alias for NewWebSocketWithCancel

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

View Source
var NewLiveWithDefaults = NewWebSocketWithDefaults

NewLiveWithDefaults is an alias for NewWebSocketWithDefaults

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

View Source
var NewPreRecorded = NewREST

NewPreRecorded is an alias for NewREST

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

View Source
var NewPreRecordedWithDefaults = NewRESTWithDefaults

NewPreRecordedWithDefaults is an alias for NewRESTWithDefaults

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

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 NewREST

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

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

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 NewWebSocket

NewWebSocket 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 NewWebSocketForDemo

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

NewWebSocketForDemo creates a new websocket connection with all default options

Notes:

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

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)

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

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

Types

type InitLib

type InitLib struct {
	LogLevel      common.LogLevel
	DebugFilePath string
}

Initialization options for this SDK.

type LiveClient deprecated

type LiveClient = listenv1ws.Client

LiveClient is an alias for listenv1rest.Client

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

type PreRecordedClient deprecated

type PreRecordedClient = listenv1rest.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

type RestClient = listenv1rest.Client

RestClient is an alias for listenv1rest.Client

type WebSocketClient

type WebSocketClient = listenv1ws.Client

WebSocketClient is an alias for listenv1ws.Client

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