combine_document

package
v0.0.0-...-1ea5cf0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CombinedDocument

type CombinedDocument interface {
	// Combine document and do something
	// the implementation of combine can run LLM againts the doc
	Combine(ctx context.Context, docs []string, options ...func(*model.Option)) (output string, err error)
}

type MapReduceCombineDocument

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

MapReduceCombineDocument Combining documents by mapping a chain over them first, then combining results.

func NewMapReduceCombineDocument

func NewMapReduceCombineDocument(mapPrompt *prompt.PromptTemplate, reducePrompt *prompt.PromptTemplate,
	promptTemplateKey string, llmChain *llm_chain.LLMChain, splitter textsplitter.TextSplitter, maxDocLength int, callbackManager *callback.Manager, verbose bool) *MapReduceCombineDocument

NewMapReduceCombineDocument creates new instance of MapReduceCombineDocument

func (*MapReduceCombineDocument) Combine

func (M *MapReduceCombineDocument) Combine(ctx context.Context, docs []string, options ...func(*model.Option)) (output string, err error)

Combine run the mapreduce process

func (*MapReduceCombineDocument) Run

func (M *MapReduceCombineDocument) Run(ctx context.Context, input map[string]string, options ...func(*model.Option)) (output map[string]string, err error)

Run all entries in input map will be treated as document to be combined output will be output["output"]

func (*MapReduceCombineDocument) SimpleRun

func (M *MapReduceCombineDocument) SimpleRun(ctx context.Context, input string, options ...func(*model.Option)) (output string, err error)

SimpleRun will run the input string agains llmchain

type StuffCombineDocument

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

StuffCombineDocument chain to feed text document to LLM with specified prompt

func NewStuffCombineDocument

func NewStuffCombineDocument(callbackManager *callback.Manager, prompt *prompt.PromptTemplate,
	templateKey string, llmChain *llm_chain.LLMChain, verbose bool) *StuffCombineDocument

NewStuffCombineDocument creates new instance of StuffCombineDocument

func (*StuffCombineDocument) Combine

func (S *StuffCombineDocument) Combine(ctx context.Context, docs []string, options ...func(*model.Option)) (output string, err error)

Combine concatenate the given document and then feed to LLM

func (*StuffCombineDocument) Run

func (S *StuffCombineDocument) Run(ctx context.Context, input map[string]string, options ...func(*model.Option)) (output map[string]string, err error)

Run expect input["input"] as input, and put the result to output["output"]

func (*StuffCombineDocument) SimpleRun

func (S *StuffCombineDocument) SimpleRun(ctx context.Context, input string, options ...func(*model.Option)) (output string, err error)

SimpleRun will run the input string agains llmchain

Jump to

Keyboard shortcuts

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