Documentation ¶
Overview ¶
Package rag provides functionality for Retrieval-Augmented Generation (RAG).
Index ¶
- Variables
- type ConversationalRetrieval
- func (c ConversationalRetrieval) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c ConversationalRetrieval) Callbacks() []schema.Callback
- func (c ConversationalRetrieval) InputKeys() []string
- func (c ConversationalRetrieval) Memory() schema.Memory
- func (c ConversationalRetrieval) OutputKeys() []string
- func (c ConversationalRetrieval) Type() string
- func (c ConversationalRetrieval) Verbose() bool
- type ConversationalRetrievalOptions
- 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, values 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 ¶
Functions ¶
This section is empty.
Types ¶
type ConversationalRetrieval ¶
type ConversationalRetrieval struct {
// contains filtered or unexported fields
}
ConversationalRetrieval is a chain implementation for conversational retrieval.
func NewConversationalRetrieval ¶
func NewConversationalRetrieval(llm schema.LLM, retriever schema.Retriever, optFns ...func(o *ConversationalRetrievalOptions)) (*ConversationalRetrieval, error)
NewConversationalRetrieval creates a new instance of the ConversationalRetrieval chain.
func (ConversationalRetrieval) Call ¶
func (c ConversationalRetrieval) Call(ctx context.Context, inputs 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 (ConversationalRetrieval) Callbacks ¶
func (c ConversationalRetrieval) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (ConversationalRetrieval) InputKeys ¶
func (c ConversationalRetrieval) InputKeys() []string
InputKeys returns the expected input keys.
func (ConversationalRetrieval) Memory ¶
func (c ConversationalRetrieval) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (ConversationalRetrieval) OutputKeys ¶
func (c ConversationalRetrieval) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (ConversationalRetrieval) Type ¶
func (c ConversationalRetrieval) Type() string
Type returns the type of the chain.
func (ConversationalRetrieval) Verbose ¶
func (c ConversationalRetrieval) Verbose() bool
Verbose returns the verbosity setting of the chain.
type ConversationalRetrievalOptions ¶
type ConversationalRetrievalOptions struct { *schema.CallbackOptions // Return the source documents ReturnSourceDocuments bool // Return the generated question ReturnGeneratedQuestion bool CondenseQuestionPrompt *prompt.Template StuffQAPrompt *prompt.Template 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 }
ConversationalRetrievalOptions represents the options for the ConversationalRetrieval chain.
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(llm schema.LLM, 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 ConversationalRetrieval 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 RefineSummarizationOptions ¶
type RefineSummarizationOptions struct {
*schema.CallbackOptions
}
type RetrievalQA ¶
type RetrievalQA struct {
// contains filtered or unexported fields
}
func NewRetrievalQA ¶
func NewRetrievalQA(llm schema.LLM, 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 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(llm schema.LLM, optFns ...func(o *StuffSummarizationOptions)) (*StuffDocuments, error)
func (*StuffDocuments) Call ¶
func (c *StuffDocuments) 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 (*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 Separator string }
type StuffSummarizationOptions ¶
type StuffSummarizationOptions struct {
*schema.CallbackOptions
}