chain

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// For map-reduce
	DefaultPromptTemplateForMap = `` /* 291-byte string literal not displayed */

	DefaultPromptTemplatForReduce = `` /* 334-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func GetChainOptions

func GetChainOptions(config v1alpha1.CommonChainConfig) []chains.ChainCallOption

func GetMemory added in v0.2.1

func GetMemory(llm llms.Model, config v1alpha1.Memory, history langchaingoschema.ChatMessageHistory, inputKey, outputKey string) langchaingoschema.Memory

Types

type APIChain

type APIChain struct {
	chains.APIChain
	base.BaseNode
	Instance *v1alpha1.APIChain
}

func NewAPIChain

func NewAPIChain(baseNode base.BaseNode) *APIChain

func (*APIChain) Init

func (l *APIChain) Init(ctx context.Context, cli client.Client, _ map[string]any) error

func (*APIChain) Ready

func (l *APIChain) Ready() (isReady bool, msg string)

func (*APIChain) Run

func (l *APIChain) Run(ctx context.Context, _ client.Client, args map[string]any) (map[string]any, error)

type LLMChain

type LLMChain struct {
	chains.LLMChain
	base.BaseNode
	Instance *v1alpha1.LLMChain
}

func NewLLMChain

func NewLLMChain(baseNode base.BaseNode) *LLMChain

func (*LLMChain) Init

func (l *LLMChain) Init(ctx context.Context, cli client.Client, args map[string]any) error

func (*LLMChain) Ready

func (l *LLMChain) Ready() (isReady bool, msg string)

func (*LLMChain) Run

func (l *LLMChain) Run(ctx context.Context, cli client.Client, args map[string]any) (outArgs map[string]any, err error)

type MapReduceChain

type MapReduceChain struct {
	// BaseNode for this MapReduceChain
	// Only chain is allowed
	base.BaseNode

	// MapReduceDocuments used to generate summary
	chains.MapReduceDocuments
	// LLMChain used to
	chains.LLMChain
	// contains filtered or unexported fields
}

func NewMapReduceChain

func NewMapReduceChain(baseNode base.BaseNode, chainCallOptions ...chains.ChainCallOption) *MapReduceChain

func (*MapReduceChain) Init

func (l *MapReduceChain) Init(ctx context.Context, _ client.Client, _ map[string]any) error

func (*MapReduceChain) Ready

func (l *MapReduceChain) Ready() (bool, string)

func (*MapReduceChain) Run

func (l *MapReduceChain) Run(ctx context.Context, _ client.Client, args map[string]any) (outArgs map[string]any, err error)

type RetrievalQAChain

type RetrievalQAChain struct {
	chains.ConversationalRetrievalQA
	base.BaseNode
	Instance *v1alpha1.RetrievalQAChain
}

func NewRetrievalQAChain

func NewRetrievalQAChain(baseNode base.BaseNode) *RetrievalQAChain

func (*RetrievalQAChain) Init

func (l *RetrievalQAChain) Init(ctx context.Context, cli client.Client, _ map[string]any) error

func (*RetrievalQAChain) Ready

func (l *RetrievalQAChain) Ready() (isReady bool, msg string)

func (*RetrievalQAChain) Run

func (l *RetrievalQAChain) Run(ctx context.Context, cli client.Client, args map[string]any) (outArgs map[string]any, err error)

Jump to

Keyboard shortcuts

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