Documentation ¶
Overview ¶
Package rag provides functionality for Retrieval-Augmented Generation (RAG).
Index ¶
- Variables
- type ConversationalRetrievalQA
- func (c *ConversationalRetrievalQA) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *ConversationalRetrievalQA) Callbacks() []schema.Callback
- func (c *ConversationalRetrievalQA) InputKeys() []string
- func (c *ConversationalRetrievalQA) Memory() schema.Memory
- func (c *ConversationalRetrievalQA) OutputKeys() []string
- func (c *ConversationalRetrievalQA) Type() string
- func (c *ConversationalRetrievalQA) Verbose() bool
- type ConversationalRetrievalQAOptions
- type MapReduceDocuments
- func (c *MapReduceDocuments) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *MapReduceDocuments) Callbacks() []schema.Callback
- func (c *MapReduceDocuments) InputKeys() []string
- func (c *MapReduceDocuments) Memory() schema.Memory
- func (c *MapReduceDocuments) OutputKeys() []string
- func (c *MapReduceDocuments) Type() string
- func (c *MapReduceDocuments) Verbose() bool
- type MapReduceDocumentsOptions
- type MapReduceSummarizationOptions
- type RefineDocuments
- func (c *RefineDocuments) Call(ctx context.Context, values schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *RefineDocuments) Callbacks() []schema.Callback
- func (c *RefineDocuments) InputKeys() []string
- func (c *RefineDocuments) Memory() schema.Memory
- func (c *RefineDocuments) OutputKeys() []string
- func (c *RefineDocuments) Type() string
- func (c *RefineDocuments) Verbose() bool
- type RefineDocumentsOptions
- type RefineSummarizationOptions
- type RetrievalQA
- func (c *RetrievalQA) Call(ctx context.Context, values schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *RetrievalQA) Callbacks() []schema.Callback
- func (c *RetrievalQA) InputKeys() []string
- func (c *RetrievalQA) Memory() schema.Memory
- func (c *RetrievalQA) OutputKeys() []string
- func (c *RetrievalQA) Type() string
- func (c *RetrievalQA) Verbose() bool
- type RetrievalQAOptions
- type StuffDocuments
- func (c *StuffDocuments) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *StuffDocuments) Callbacks() []schema.Callback
- func (c *StuffDocuments) InputKeys() []string
- func (c *StuffDocuments) Memory() schema.Memory
- func (c *StuffDocuments) OutputKeys() []string
- func (c *StuffDocuments) Type() string
- func (c *StuffDocuments) Verbose() bool
- type StuffDocumentsOptions
- type StuffSummarizationOptions
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoInputValues = errors.New("no input values") ErrNoOutputParser = errors.New("no output parser") )
Functions ¶
This section is empty.
Types ¶
type ConversationalRetrievalQA ¶ added in v0.0.59
type ConversationalRetrievalQA struct {
// contains filtered or unexported fields
}
ConversationalRetrievalQA is a chain implementation for conversational retrieval.
func NewConversationalRetrievalQA ¶ added in v0.0.59
func NewConversationalRetrievalQA(model schema.Model, retriever schema.Retriever, optFns ...func(o *ConversationalRetrievalQAOptions)) (*ConversationalRetrievalQA, error)
NewConversationalRetrievalQA creates a new instance of the ConversationalRetrievalQA chain.
func (*ConversationalRetrievalQA) Call ¶ added in v0.0.59
func (c *ConversationalRetrievalQA) Call(ctx context.Context, inputs schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)
Call executes the ConversationalRetrievalQA chain with the given context and inputs. It returns the outputs of the chain or an error, if any.
func (*ConversationalRetrievalQA) Callbacks ¶ added in v0.0.59
func (c *ConversationalRetrievalQA) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*ConversationalRetrievalQA) InputKeys ¶ added in v0.0.59
func (c *ConversationalRetrievalQA) InputKeys() []string
InputKeys returns the expected input keys.
func (*ConversationalRetrievalQA) Memory ¶ added in v0.0.59
func (c *ConversationalRetrievalQA) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*ConversationalRetrievalQA) OutputKeys ¶ added in v0.0.59
func (c *ConversationalRetrievalQA) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*ConversationalRetrievalQA) Type ¶ added in v0.0.59
func (c *ConversationalRetrievalQA) Type() string
Type returns the type of the chain.
func (*ConversationalRetrievalQA) Verbose ¶ added in v0.0.59
func (c *ConversationalRetrievalQA) Verbose() bool
Verbose returns the verbosity setting of the chain.
type ConversationalRetrievalQAOptions ¶ added in v0.0.59
type ConversationalRetrievalQAOptions struct { *schema.CallbackOptions // Return the source documents ReturnSourceDocuments bool // Return the generated question ReturnGeneratedQuestion bool CondenseQuestionPrompt schema.PromptTemplate RetrievalQAPrompt schema.PromptTemplate Memory schema.Memory InputKey string OutputKey string // If set, restricts the docs to return from store based on tokens, enforced only // for StuffDocumentsChain MaxTokenLimit uint }
ConversationalRetrievalQAOptions represents the options for the ConversationalRetrievalQA chain.
type MapReduceDocuments ¶ added in v0.0.59
type MapReduceDocuments struct {
// contains filtered or unexported fields
}
func NewMapReduceDocuments ¶ added in v0.0.59
func NewMapReduceDocuments(mapChain *chain.LLM, combineChain *StuffDocuments, optFns ...func(o *MapReduceDocumentsOptions)) (*MapReduceDocuments, error)
func NewMapReduceSummarization ¶ added in v0.0.59
func NewMapReduceSummarization(model schema.Model, optFns ...func(o *MapReduceSummarizationOptions)) (*MapReduceDocuments, error)
func (*MapReduceDocuments) Call ¶ added in v0.0.59
func (c *MapReduceDocuments) Call(ctx context.Context, inputs schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)
Call executes the MapReduceDocuments chain with the given context and inputs. It returns the outputs of the chain or an error, if any.
func (*MapReduceDocuments) Callbacks ¶ added in v0.0.59
func (c *MapReduceDocuments) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*MapReduceDocuments) InputKeys ¶ added in v0.0.59
func (c *MapReduceDocuments) InputKeys() []string
InputKeys returns the expected input keys.
func (*MapReduceDocuments) Memory ¶ added in v0.0.59
func (c *MapReduceDocuments) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*MapReduceDocuments) OutputKeys ¶ added in v0.0.59
func (c *MapReduceDocuments) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*MapReduceDocuments) Type ¶ added in v0.0.59
func (c *MapReduceDocuments) Type() string
Type returns the type of the chain.
func (*MapReduceDocuments) Verbose ¶ added in v0.0.59
func (c *MapReduceDocuments) Verbose() bool
Verbose returns the verbosity setting of the chain.
type MapReduceDocumentsOptions ¶ added in v0.0.59
type MapReduceDocumentsOptions struct { *schema.CallbackOptions InputKey string DocumentVariableName string }
type MapReduceSummarizationOptions ¶ added in v0.0.59
type MapReduceSummarizationOptions struct { *schema.CallbackOptions MapReduceSummarizationPrompt schema.PromptTemplate StuffSummarizationPrompt schema.PromptTemplate }
type RefineDocuments ¶
type RefineDocuments struct {
// contains filtered or unexported fields
}
func NewRefineDocuments ¶
func NewRefineDocuments(llmChain *chain.LLM, refineLLMChain *chain.LLM, optFns ...func(o *RefineDocumentsOptions)) (*RefineDocuments, error)
func NewRefineSummarization ¶
func NewRefineSummarization(model schema.Model, optFns ...func(o *RefineSummarizationOptions)) (*RefineDocuments, error)
func (*RefineDocuments) Call ¶
func (c *RefineDocuments) Call(ctx context.Context, values schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)
Call executes the RefineDocuments chain with the given context and inputs. It returns the outputs of the chain or an error, if any.
func (*RefineDocuments) Callbacks ¶
func (c *RefineDocuments) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*RefineDocuments) InputKeys ¶
func (c *RefineDocuments) InputKeys() []string
InputKeys returns the expected input keys.
func (*RefineDocuments) Memory ¶
func (c *RefineDocuments) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*RefineDocuments) OutputKeys ¶
func (c *RefineDocuments) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*RefineDocuments) Type ¶
func (c *RefineDocuments) Type() string
Type returns the type of the chain.
func (*RefineDocuments) Verbose ¶
func (c *RefineDocuments) Verbose() bool
Verbose returns the verbosity setting of the chain.
type RefineDocumentsOptions ¶
type RefineDocumentsOptions struct { *schema.CallbackOptions InputKey string DocumentVariableName string InitialResponseName string DocumentPrompt schema.PromptTemplate OutputKey string }
type RefineSummarizationOptions ¶
type RefineSummarizationOptions struct { *schema.CallbackOptions StuffSummarizationPrompt schema.PromptTemplate RefineSummarizationPrompt schema.PromptTemplate }
type RetrievalQA ¶
type RetrievalQA struct {
// contains filtered or unexported fields
}
func NewRetrievalQA ¶
func NewRetrievalQA(model schema.Model, retriever schema.Retriever, optFns ...func(o *RetrievalQAOptions)) (*RetrievalQA, error)
func (*RetrievalQA) Call ¶
func (c *RetrievalQA) Call(ctx context.Context, values schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)
Call executes the ConversationalRetrieval chain with the given context and inputs. It returns the outputs of the chain or an error, if any.
func (*RetrievalQA) Callbacks ¶
func (c *RetrievalQA) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*RetrievalQA) InputKeys ¶
func (c *RetrievalQA) InputKeys() []string
InputKeys returns the expected input keys.
func (*RetrievalQA) Memory ¶
func (c *RetrievalQA) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*RetrievalQA) OutputKeys ¶
func (c *RetrievalQA) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*RetrievalQA) Verbose ¶
func (c *RetrievalQA) Verbose() bool
Verbose returns the verbosity setting of the chain.
type RetrievalQAOptions ¶
type RetrievalQAOptions struct { *schema.CallbackOptions RetrievalQAPrompt schema.PromptTemplate InputKey string // Return the source documents ReturnSourceDocuments bool // If set, restricts the docs to return from store based on tokens, enforced only // for StuffDocumentsChain MaxTokenLimit uint }
type StuffDocuments ¶
type StuffDocuments struct {
// contains filtered or unexported fields
}
func NewStuffDocuments ¶
func NewStuffDocuments(llmChain *chain.LLM, optFns ...func(o *StuffDocumentsOptions)) (*StuffDocuments, error)
func NewStuffSummarization ¶
func NewStuffSummarization(model schema.Model, optFns ...func(o *StuffSummarizationOptions)) (*StuffDocuments, error)
func (*StuffDocuments) Call ¶
func (c *StuffDocuments) Call(ctx context.Context, inputs schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)
Call executes the StuffDocuments chain with the given context and inputs. It returns the outputs of the chain or an error, if any.
func (*StuffDocuments) Callbacks ¶
func (c *StuffDocuments) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*StuffDocuments) InputKeys ¶
func (c *StuffDocuments) InputKeys() []string
InputKeys returns the expected input keys.
func (*StuffDocuments) Memory ¶
func (c *StuffDocuments) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*StuffDocuments) OutputKeys ¶
func (c *StuffDocuments) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*StuffDocuments) Type ¶
func (c *StuffDocuments) Type() string
Type returns the type of the chain.
func (*StuffDocuments) Verbose ¶
func (c *StuffDocuments) Verbose() bool
Verbose returns the verbosity setting of the chain.
type StuffDocumentsOptions ¶
type StuffDocumentsOptions struct { *schema.CallbackOptions InputKey string DocumentVariableName string DocumentSeparator string }
type StuffSummarizationOptions ¶
type StuffSummarizationOptions struct { *schema.CallbackOptions StuffSummarizationPrompt schema.PromptTemplate }