chat

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_SQL_TIMEOUT = 5 * time.Second
	DEFAULT_MAX_RESULTS = 1000
	DEFAULT_LANGUAGE    = "en"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	Context   context.Context
	Language  string
	AIClient  ai.IAI
	K8SClient *kubernetes.Client

	Persist bool
	// contains filtered or unexported fields
}

func NewChat

func NewChat(
	backend string,
	password string,
	logger logger.ILogger,
	opts ...Option,
) (*Chat, error)

func (*Chat) Chat

func (c *Chat) Chat(message, threadID string) (string, error)

func (*Chat) FetchChatMessages

func (c *Chat) FetchChatMessages(threadID string) ([]db.ChatModel, error)

func (*Chat) FindThreadUnique

func (c *Chat) FindThreadUnique(
	threadID string,
) (*db.ThreadModel, error)

func (*Chat) GetThread

func (c *Chat) GetThread(threadID string) (*db.ThreadModel, error)

func (*Chat) InitChat

func (c *Chat) InitChat() (string, error)

func (*Chat) PersistChat

func (c *Chat) PersistChat(chat, response, threadID string) (*db.ChatModel, error)

func (*Chat) PersistThread

func (c *Chat) PersistThread(threadID string) (*db.ThreadModel, error)

type Option

type Option func(*Chat)

func WithConfigureAssistant

func WithConfigureAssistant(logger logger.ILogger, enableExecutors bool) Option

func WithDbClient

func WithDbClient(db *db.PrismaClient) Option

func WithLanguage

func WithLanguage(language string) Option

func WithPersist

func WithPersist(persist bool) Option

Jump to

Keyboard shortcuts

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