kvbrain

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Brain

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

func New

func New(knowledge *badger.DB) *Brain

func (*Brain) Forget

func (br *Brain) Forget(ctx context.Context, tag, id string) error

Forget forgets everything learned from a single given message. If nothing has been learned from the message, it should be ignored.

func (*Brain) Learn

func (br *Brain) Learn(ctx context.Context, tag string, msg *brain.Message, tuples []brain.Tuple) error

Learn records a set of tuples. Each tuple prefix has length equal to the result of Order. The tuples begin with empty strings in the prefix to denote the start of the message and end with one empty suffix to denote the end; all other tokens are non-empty. Each tuple's prefix has entropy reduction transformations applied.

func (*Brain) Recall

func (br *Brain) Recall(ctx context.Context, tag string, page string, out []brain.Message) (n int, next string, err error)

func (*Brain) Speak

func (br *Brain) Speak(ctx context.Context, tag string, prompt []string, w *brain.Builder) error

Speak generates a full message and appends it to w. The prompt is in reverse order and has entropy reduction applied.

Jump to

Keyboard shortcuts

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