streaming

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Streaming package for processing real-time conversations

Streaming package for processing real-time conversations

Streaming package for processing real-time conversations

Streaming package for processing real-time conversations

Index

Constants

View Source
const (
	SymblPlatformHost string = "api.symbl.ai"

	TypeRequestStart string = "start_request"
	TypeRequestStop  string = "stop_request"
)

Handshake Related

View Source
const (
	MessageTypeInitListening        string = "started_listening"
	MessageTypeInitConversation     string = "conversation_created"
	MessageTypeInitRecognition      string = "recognition_started"
	MessageTypeSessionModified      string = "session_modified"
	MessageTypeTeardownConversation string = "conversation_completed"
	MessageTypeTeardownRecognition  string = "recognition_stopped"

	MessageTypeError   string = "error"
	MessageTypeMessage string = "message"
)

Message Types

Variables

View Source
var (
	// ErrInvalidMessageType invalid message type
	ErrInvalidMessageType = errors.New("invalid message type")

	// ErrUserCallbackNotDefined user callback object not defined
	ErrUserCallbackNotDefined = errors.New("user callback object not defined")
)

Functions

This section is empty.

Types

type DefaultMessageRouter

type DefaultMessageRouter struct {
	TranscriptionDemo    bool
	TranscriptionDisable bool

	ChatmessageDemo    bool
	ChatmessageDisable bool

	AllDisable     bool
	InsightDisable bool
	EntityDisable  bool
	TopicDisable   bool
	TrackerDisable bool
	UserDisable    bool
}

DefaultMessageRouter is a sample implementation that just prints insights to the console

func NewDefaultMessageRouter

func NewDefaultMessageRouter() *DefaultMessageRouter

NewDefaultMessageRouter creates a new DefaultMessageRouter

func (*DefaultMessageRouter) EntityResponseMessage

func (dmr *DefaultMessageRouter) EntityResponseMessage(tr *interfaces.EntityResponse) error

EntityResponseMessage implements the streaming interface

func (*DefaultMessageRouter) InitializedConversation

func (dmr *DefaultMessageRouter) InitializedConversation(im *interfaces.InitializationMessage) error

InitializedConversation implements the interface

func (*DefaultMessageRouter) InsightResponseMessage

func (dmr *DefaultMessageRouter) InsightResponseMessage(ir *interfaces.InsightResponse) error

InsightResponseMessage implements the streaming interface

func (*DefaultMessageRouter) MessageResponseMessage

func (dmr *DefaultMessageRouter) MessageResponseMessage(mr *interfaces.MessageResponse) error

MessageResponseMessage implements the streaming interface

func (*DefaultMessageRouter) RecognitionResultMessage

func (dmr *DefaultMessageRouter) RecognitionResultMessage(rr *interfaces.RecognitionResult) error

RecognitionResultMessage implements the streaming interface

func (*DefaultMessageRouter) TeardownConversation

func (dmr *DefaultMessageRouter) TeardownConversation(tm *interfaces.TeardownMessage) error

TeardownConversation implements the streaming interface

func (*DefaultMessageRouter) TopicResponseMessage

func (dmr *DefaultMessageRouter) TopicResponseMessage(tr *interfaces.TopicResponse) error

TopicResponseMessage implements the streaming interface

func (*DefaultMessageRouter) TrackerResponseMessage

func (dmr *DefaultMessageRouter) TrackerResponseMessage(tr *interfaces.TrackerResponse) error

TrackerResponseMessage implements the streaming interface

func (*DefaultMessageRouter) UnhandledMessage

func (dmr *DefaultMessageRouter) UnhandledMessage(byMsg []byte) error

UnhandledMessage implements the streaming interface

func (*DefaultMessageRouter) UserDefinedMessage

func (dmr *DefaultMessageRouter) UserDefinedMessage(byMsg []byte) error

UserDefinedMessage implements the streaming interface

type MessageType

type MessageType struct {
	Type string `json:"type"`
}

MessageType is the header to bootstrap you way unmarshalling other messages

Example:
{
	"type": "message",
	"message": {
		"type": "started_listening"
	}
}

type SybmlMessageType

type SybmlMessageType struct {
	Type    string `json:"type"`
	Message struct {
		Type string `json:"type"`
	} `json:"message"`
}

SybmlMessageType is the header to bootstrap you way unmarshalling other messages

Example:
{
	"type": "message",
	"message": {
		"type": "started_listening"
	}
}

type SymblError

type SymblError struct {
	Type    string `json:"type"`
	Details string `json:"details"`
	Message string `json:"message"`
}

SymblError when mt.Type == "error"

type SymblMessageRouter

type SymblMessageRouter struct {
	ConversationID string
	// contains filtered or unexported fields
}

SymblMessageRouter is helper struct that routes events

func New

New creates a SymblMessageRouter with user defined callback

func NewWithDefault

func NewWithDefault() *SymblMessageRouter

NewWithDefault creates a default SymblMessageRouter

func (*SymblMessageRouter) EntityResponseMessage

func (smr *SymblMessageRouter) EntityResponseMessage(byMsg []byte) error

EntityResponseMessage handles the EntityResponseMessage message

func (*SymblMessageRouter) GetConversationID

func (smr *SymblMessageRouter) GetConversationID() string

GetConversationID returns the conversation ID of the streaming connection

func (*SymblMessageRouter) HandleError

func (smr *SymblMessageRouter) HandleError(byMsg []byte) error

HandleError handles error messages

func (*SymblMessageRouter) InitializedConversation

func (smr *SymblMessageRouter) InitializedConversation(byMsg []byte) error

InitializedConversation handles the InitializedConversation message

func (*SymblMessageRouter) InsightResponseMessage

func (smr *SymblMessageRouter) InsightResponseMessage(byMsg []byte) error

InsightResponseMessage handles the InsightResponseMessage message

func (*SymblMessageRouter) Message

func (smr *SymblMessageRouter) Message(byMsg []byte) error

Message handles symbl platform messages

func (*SymblMessageRouter) MessageResponseMessage

func (smr *SymblMessageRouter) MessageResponseMessage(byMsg []byte) error

MessageResponseMessage handles the MessageResponseMessage message

func (*SymblMessageRouter) RecognitionResultMessage

func (smr *SymblMessageRouter) RecognitionResultMessage(byMsg []byte) error

RecognitionResultMessage handles the RecognitionResultMessage message

func (*SymblMessageRouter) TeardownConversation

func (smr *SymblMessageRouter) TeardownConversation(byMsg []byte) error

TeardownConversation handles the TeardownConversation message

func (*SymblMessageRouter) TopicResponseMessage

func (smr *SymblMessageRouter) TopicResponseMessage(byMsg []byte) error

TopicResponseMessage handles the TopicResponseMessage message

func (*SymblMessageRouter) TrackerResponseMessage

func (smr *SymblMessageRouter) TrackerResponseMessage(byMsg []byte) error

TrackerResponseMessage handles the TrackerResponseMessage message

func (*SymblMessageRouter) UnhandledMessage

func (smr *SymblMessageRouter) UnhandledMessage(byMsg []byte) error

UnhandledMessage handles the UnhandledMessage message

func (*SymblMessageRouter) UserDefinedMessage

func (smr *SymblMessageRouter) UserDefinedMessage(byMsg []byte) error

UserDefinedMessage handles the UserDefinedMessage message

Directories

Path Synopsis
Defines everything that makes up the Streaming API interface
Defines everything that makes up the Streaming API interface

Jump to

Keyboard shortcuts

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