sqlbrain

package
v0.0.0-...-2e5d07d Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: GPL-3.0 Imports: 9 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) Think

func (br *Brain) Think(ctx context.Context, tag string, prompt []string) iter.Seq[func(id *[]byte, suf *[]byte) error]

Jump to

Keyboard shortcuts

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