df

package
v0.0.0-...-979f466 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package df Package bot establishes a client session with a Dialog Flow agent or bot associated with GCP project. The bot will respond to user questions as they type the questions.

Index

Constants

View Source
const (
	// GCPProjectID  GCP project ID in use
	GCPProjectID = "your-gcp-project-id"
	// DefaultLanguage of the bot
	DefaultLanguage = "en"
	// ENUSLanguage US English
	ENUSLanguage = "en-US"
	// DefaultTimeZone where user is in
	DefaultTimeZone = "PST"
	// DefaultTimeout for API timeout
	DefaultTimeout = 10 * time.Second
	// SampleConvo a conversation asking question at a time
	SampleConvo = "hello\ni like to cancel\ntaking too long"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentSession

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

AgentSession for a particular call on a path

func NewAgentSession

func NewAgentSession(env Environment, gcpProjectName string) (s *AgentSession)

NewAgentSession creates a new session with a specific environment.

type Bot

type Bot interface {
	Converse(s *AgentSession, q string) ([]string, error)
}

Bot interface defines methods available for BotClient Generate the mock interface for this. mockgen -destination=mocks/df/mock_converse.go -package=mocks -source=clients/df/converse.go Bot

func New

func New(logger *log.Logger, gcpProject string, lang string) Bot

New create a Dialog Flow agent or bot.

type Environment

type Environment string

Environment is Dialogflow bot environments

const (
	Draft   Environment = "DRAFT" // DRAFT environment
	Staging Environment = "STAGING"
	Prod    Environment = "PROD"
)

Dialog flow environmental names

Jump to

Keyboard shortcuts

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