chipper

package
v0.0.0-...-99d038d Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 13 Imported by: 0

README

chipper client

This client is meant to be used to connect to chipper via other programs.

External TLS certificates

If you wish to use a testing, fake, or local root certificate, place it in /etc/ssl/certs/local/root.crt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIntent

func IsIntent(i IntentGraphResponse) bool

func IsKnowledgeGraph

func IsKnowledgeGraph(i IntentGraphResponse) bool

Types

type CompressOpts

type CompressOpts struct {
	Bitrate    uint
	Complexity uint
	FrameSize  float32
	PreEncoded bool
	Compress   bool
}

CompressOpts specifies whether compression should be used and, if so, allows the specification of parameters related to it

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn represents an underlying GRPC connection to the Chipper server

func NewConn

func NewConn(ctx context.Context, serverURL string, appKey string, options ...ConnOpt) (*Conn, error)

NewConn creates a new connection to the given GRPC server

func (*Conn) Close

func (c *Conn) Close() error

Close closes the underlying connection

func (*Conn) NewConnectionStream

func (c *Conn) NewConnectionStream(ctx context.Context, opts ConnectOpts) (Stream, error)

NewConnectionStream opens a stream for doing connection checks

func (*Conn) NewIntentGraphStream

func (c *Conn) NewIntentGraphStream(ctx context.Context, opts IntentGraphOpts) (Stream, error)

NewIntentGraphStream opens a new stream on the given connection to stream audio for the purpose of getting a knowledge graph response

func (*Conn) NewIntentStream

func (c *Conn) NewIntentStream(ctx context.Context, opts IntentOpts) (Stream, error)

NewIntentStream opens a new stream on the given connection to stream audio for the purpose of getting an intent response

func (*Conn) NewKGStream

func (c *Conn) NewKGStream(ctx context.Context, opts KGOpts) (Stream, error)

NewKGStream opens a new stream on the given connection to stream audio for the purpose of getting a knowledge graph response

func (*Conn) SendText

func (c *Conn) SendText(ctx context.Context, text, session, device string,
	service pb.IntentService) *pb.IntentResult

SendText performs an intent request with a text string instead of voice data

type ConnOpt

type ConnOpt func(o *connOpts)

ConnOpt represents an option that can be used to change connection behavior

func WithBootID

func WithBootID(value string) ConnOpt

WithBootID will include the given boot ID with requests

func WithCredentials

func WithCredentials(value credentials.PerRPCCredentials) ConnOpt

WithCredentials adds the given per RPC credentials to GRPC requests

func WithDeviceID

func WithDeviceID(value string) ConnOpt

WithDeviceID specifies the device ID to provide the server

func WithFirmwareVersion

func WithFirmwareVersion(value string) ConnOpt

WithFirmwareVersion specifies the firmware version to provide the server

func WithGrpcOptions

func WithGrpcOptions(value ...grpc.DialOption) ConnOpt

WithGrpcOptions adds the given GRPC DialOption values to those we pass to GRPC when creating a connection

func WithInsecure

func WithInsecure(value bool) ConnOpt

WithInsecure specifies whether the connection with chipper should be insecure

func WithSessionID

func WithSessionID(value string) ConnOpt

WithSessionID specifies the session ID to provide the server

type ConnectOpts

type ConnectOpts struct {
	StreamOpts
	TotalAudioMs      uint32
	AudioPerRequestMs uint32
}

ConnectOpts extends StreamOpts with options unique to connection check streams

type ConnectionCheckResponse

type ConnectionCheckResponse = pb.ConnectionCheckResponse

ConnectionCheckResponse aliases the protobuf ConnectionCheckResponse type

type IntentGraphOpts

type IntentGraphOpts struct {
	StreamOpts
	Handler    pb.IntentService
	Mode       pb.RobotMode
	SpeechOnly bool

	// Doesnt seem to be passing this in
	Timezone string
}

IntentGraphOpts extends StreamOpts with options of both Intent and KG

type IntentGraphResponse

type IntentGraphResponse = pb.IntentGraphResponse

IntentGraphResponse aliases the protobuf IntentGraphResponse type

type IntentOpts

type IntentOpts struct {
	StreamOpts
	Handler    pb.IntentService
	Mode       pb.RobotMode
	SpeechOnly bool
}

IntentOpts extends StreamOpts with options unique to intent streams

type IntentResponse

type IntentResponse = pb.IntentResponse

IntentResponse aliases the protobuf IntentResponse type

type IntentResult

type IntentResult = pb.IntentResult

IntentResult aliases the protobuf IntentResult type

func ConvertToIntentResp

func ConvertToIntentResp(resp *IntentGraphResponse) *IntentResult

type KGOpts

type KGOpts struct {
	StreamOpts
	Timezone string
}

KGOpts extends StreamOpts with options unique to knowledge graph streams

type KnowledgeGraphResponse

type KnowledgeGraphResponse = pb.KnowledgeGraphResponse

KnowledgeGraphResponse aliases the protobuf KnowledgeGraphResponse type

func ConvertToKnowledgeGraphResp

func ConvertToKnowledgeGraphResp(resp *IntentGraphResponse) *KnowledgeGraphResponse

type Stream

type Stream interface {
	SendAudio(audioData []byte) error
	WaitForResponse() (interface{}, error)
	Close() error
	CloseSend() error
}

Stream represents an open stream of various possible types (intent, knowledge graph) to Chipper

type StreamOpts

type StreamOpts struct {
	CompressOpts
	Timeout   time.Duration
	Language  pb.LanguageCode
	SaveAudio bool
	NoDas     bool
}

StreamOpts defines options common to all possible stream types

Jump to

Keyboard shortcuts

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