retrievalqachain

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chain

type Chain struct {
	// Retriever used to retrieve the relevant documents.
	Retriever llm.Retriever

	// The chain the documents and query is given to.
	CombineDocumentsChain llm.Chain

	// The input key to get the query from, by default "query".
	InputKey string

	// If the chain should return the documents used by the combine
	// documents chain in the "source_documents" key.
	ReturnSourceDocuments bool
}

func New

func New(combineDocumentsChain llm.Chain, retriever llm.Retriever, options ...func(*Chain)) Chain

New creates a new Chain from a retriever and a chain for combining documents. The chain for combining documents is expected to have the expected input values for the "question" and "input_documents" key.

func (Chain) Call

func (c Chain) Call(ctx context.Context, values map[string]any, options ...llm.ChainOption) (map[string]any, error)

Call gets relevant documents from the retriever and gives them to the combine documents chain.

func (Chain) InputKeys

func (c Chain) InputKeys() []string

func (Chain) Memory

func (c Chain) Memory() llm.Memory

Memory returns empty memory.

func (Chain) OutputKeys

func (c Chain) OutputKeys() []string

Jump to

Keyboard shortcuts

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