assistant

package
v0.0.0-...-8ca1572 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assistant

type Assistant struct {
	GoogleAssistant embedded.EmbeddedAssistantClient
	Config          *embedded.ConverseRequest_Config
	AudioBuffer     *AudioBuffer

	Canceler                  context.CancelFunc
	Connection                *grpc.ClientConn
	Context                   context.Context
	Conversation              embedded.EmbeddedAssistant_ConverseClient
	ConversationConfiguration *embedded.ConverseConfig
	ConversationState         []byte
	GCPAuth                   *GCPAuthWrapper
}

func NewAssistant

func NewAssistant() *Assistant

func (*Assistant) AudioIn

func (a *Assistant) AudioIn(audioIn []byte) error

AudioIn sends input audio data to be handled when ready

func (*Assistant) Close

func (a *Assistant) Close()

func (*Assistant) Initialize

func (a *Assistant) Initialize(credentials *Token, oauthToken *oauth2.Token) error

func (*Assistant) InitializeRaw

func (a *Assistant) InitializeRaw(assistConfig *embedded.ConverseRequest_Config, audioBuffer *AudioBuffer, credentials *Token, oauthToken *oauth2.Token, oauthRedirectURL string, callbackFunc func(permissionCode string) error) error

func (*Assistant) RequestResponse

func (a *Assistant) RequestResponse() (*embedded.ConverseResponse, error)

RequestResponse requests a response based on the available input audio data

func (*Assistant) Start

func (a *Assistant) Start() error

type AudioBuffer

type AudioBuffer struct {
	AudioInEncoding        embedded.AudioInConfig_Encoding
	AudioInSampleRateHertz int32

	AudioOutEncoding         embedded.AudioOutConfig_Encoding
	AudioOutSampleRateHertz  int32
	AudioOutVolumePercentage int32
}

type GCPAuthWrapper

type GCPAuthWrapper struct {
	AuthURL        string
	CallbackFunc   PermissionCallback
	Config         *oauth2.Config
	OauthSrv       *http.Server
	OauthToken     *oauth2.Token
	PermissionCode string

	AuthError error
}

func (*GCPAuthWrapper) Error

func (w *GCPAuthWrapper) Error() error

func (*GCPAuthWrapper) Initialize

func (w *GCPAuthWrapper) Initialize(credentials *Token, oauthRedirectURL string, callbackFunc PermissionCallback) error

func (*GCPAuthWrapper) SetTokenSource

func (w *GCPAuthWrapper) SetTokenSource(permissionCode string) error

type PermissionCallback

type PermissionCallback func(string) error

type Token

type Token struct {
	Installed struct {
		ClientID                string   `json:"client_id"`
		ProjectID               string   `json:"project_id"`
		AuthURI                 string   `json:"auth_uri"`
		TokenURI                string   `json:"token_uri"`
		AuthProviderX509CertURL string   `json:"auth_provider_x509_cert_url"`
		ClientSecret            string   `json:"client_secret"`
		RedirectUris            []string `json:"redirect_uris"`
	} `json:"installed"`
}

func GetCredentialsFromFile

func GetCredentialsFromFile(fileCredentials string) (*Token, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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