app

package
v0.0.0-...-b6acc2a Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxMemory   = 10
	MemoryCount = 10

	MaxTokens      = 4096
	ResponseTokens = 1024
	SendTokens     = MaxTokens - ResponseTokens

	// NOTE(jkoelker) Allow 80% of the tokens to be used for the memory.
	//                Perform this calculation in integer space to avoid
	//                floating point errors.
	MemoryTokens  = SendTokens * 80 / 100
	HistoryTokens = SendTokens - MemoryTokens
)

Variables

This section is empty.

Functions

func AIContext

func AIContext(
	_ context.Context,
	memories []string,
	history []api.Message,
	model string,
	memoriesTokens int,
	historyTokens int,
) ([]api.Message, int, error)

func Completion

func Completion(
	ctx context.Context,
	manager *plugin.Manager,
	name string,
) (api.Completion, func() error, error)

func Executor

func Executor(
	ctx context.Context,
	completion api.Completion,
	memory api.Memory,
) func(string, string) error

func InitChatCmd

func InitChatCmd(app *LazyGPTApp)

func InitServeCmd

func InitServeCmd(app *LazyGPTApp)

func Memorize

func Memorize(msg *api.Message, result string, feedback string) string

func Memory

func Memory(
	ctx context.Context,
	manager *plugin.Manager,
	name string,
) (api.Memory, func() error, error)

func Prompt

func Prompt() string

func Recollection

func Recollection(ctx context.Context, memory api.Memory, memories []string) ([]string, error)

Types

type LazyGPTApp

type LazyGPTApp struct {
	ConfigFile string
	RootCmd    *cobra.Command
}

func NewLazyGPTApp

func NewLazyGPTApp() *LazyGPTApp

func (*LazyGPTApp) Execute

func (app *LazyGPTApp) Execute()

func (*LazyGPTApp) InitConfig

func (app *LazyGPTApp) InitConfig() context.Context

Jump to

Keyboard shortcuts

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