live

package
v1.6.0-dev.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: MIT Imports: 5 Imported by: 10

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

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

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

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

type InitLib

type InitLib struct {
	LogLevel      common.LogLevel
	DebugFilePath string
}

Initialization options for this SDK.

Jump to

Keyboard shortcuts

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