context

package
v0.0.0-...-a497f71 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const CONTEXT_PREIX = "Context:"
View Source
const FORMAT_STRING = "%s %s\nExplanation: %s\nContent:\n%s"

Variables

View Source
var DEFAULT_FILE_LISTING_CONFIG = FileListingConfig{
	ItemConfigBase: ItemConfigBase{
		Enabled:  true,
		Priority: 10,
	},
}
View Source
var DEFAULT_SHELL_CONFIG = ShellConfig{
	ItemConfigBase: ItemConfigBase{
		Enabled:  true,
		Priority: 11,
	},
}

Functions

This section is empty.

Types

type FileListing

type FileListing struct {
	ItemBase
}

func NewFileListing

func NewFileListing(cfg FileListingConfig) (*FileListing, error)

func (*FileListing) Build

func (f *FileListing) Build() (msg ai.ChatCompletionMessage, err error)

func (FileListing) Name

func (f FileListing) Name() string

type FileListingConfig

type FileListingConfig struct {
	ItemConfigBase
}

type Item

type Item interface {
	// Build returns a ChatCompletionMessage that can be used to send to the AI
	Build() (ai.ChatCompletionMessage, error)

	// Name returns the name of the context item
	Name() string
}

Item provides context to the AI in a specific message

type ItemBase

type ItemBase struct {
	// Name is the name of the context item
	Name string
	// Explanation is the explanation of the context item
	Explanation string
	// Priority is used to determine the order of the context items
	// Higher number -> earlier in the request
	// The position can _slightly_ affet how much attention the AI pays to the context item
	Priority int
	// Content is the content of the context item
	Content string
}

GenericItem is a generic context item used for embedding in other structs

type ItemConfigBase

type ItemConfigBase struct {
	Enabled  bool `toml:"enabled"`
	Priority int  `toml:"priority"`
}

type Shell

type Shell struct {
	ItemBase
}

func NewShell

func NewShell(cfg ShellConfig) (*Shell, error)

func (*Shell) Build

func (s *Shell) Build() (msg ai.ChatCompletionMessage, err error)

func (Shell) Name

func (s Shell) Name() string

type ShellConfig

type ShellConfig struct {
	ItemConfigBase
}

Jump to

Keyboard shortcuts

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