constitution

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrResponseTextNotFound is returned when the response does not provide 'text' key as the result.
	ErrResponseTextNotFound = errors.New("result as a string value of a 'text' key is not found")
	// ErrStringConvert is returned when a value cannot be converted into a string.
	ErrStringConvert = errors.New("cannot convert the provided value to string")
)

Functions

This section is empty.

Types

type Constitutional

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

Constitutional is a data structure for providing chains of critique and revision to an ordinary chain based on a list of ConstitutionalPrinciple.

func NewConstitutional

func NewConstitutional(llm llms.Model, chain chains.LLMChain,
	constitutionalPrinciples []ConstitutionalPrinciple, options map[string]*prompts.FewShotPrompt,
) *Constitutional

NewConstitutional creates a new Constitutional chain.

func (*Constitutional) Call

func (c *Constitutional) Call(ctx context.Context, inputs map[string]any,
	options ...chains.ChainCallOption,
) (map[string]any, error)

Call handles the inner logic of the Constitutional chain.

func (*Constitutional) GetInputKeys

func (c *Constitutional) GetInputKeys() []string

func (*Constitutional) GetMemory

func (c *Constitutional) GetMemory() schema.Memory

func (*Constitutional) GetOutputKeys

func (c *Constitutional) GetOutputKeys() []string

type ConstitutionalPrinciple

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

ConstitutionalPrinciple provides critiqueRequest and revisionRequest to be used in a Constitutional instance.

func NewConstitutionalPrinciple

func NewConstitutionalPrinciple(critique, revision string, names ...string) ConstitutionalPrinciple

NewConstitutionalPrinciple creates a new ConstitutionalPrinciple.

Jump to

Keyboard shortcuts

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