constitution

package
v0.1.14-update.7 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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