sqlbrain

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RecommendedPrep

func RecommendedPrep(conn *sqlite.Conn) error

RecommendedPrep is an sqlitex.ConnPrepareFunc that sets options recommended for a brain.

Types

type Brain

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

Brain is an implementation of knowledge using an SQLite database.

func Open

func Open(ctx context.Context, db *sqlitex.Pool) (*Brain, error)

Open returns a brain within the given database. The db must remain open for the lifetime of the brain.

func (*Brain) Close

func (br *Brain) Close() error

Close closes the underlying database.

func (*Brain) Forget

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

Forget forgets everything learned from a single given message. If nothing has been learned from the message, a message with that ID cannot be learned in the future.

func (*Brain) Learn

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

Learn records a set of tuples.

func (*Brain) Recall

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

Recall fills out with messages read from the brain.

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