Documentation ¶
Index ¶
- Variables
- func IsChatModel(model schema.Model) bool
- func IsLLM(model schema.Model) bool
- type Conditional
- type ConditionalFunc
- type ConditionalPromptSelector
- type Conversation
- func (c *Conversation) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *Conversation) Callbacks() []schema.Callback
- func (c *Conversation) InputKeys() []string
- func (c *Conversation) Memory() schema.Memory
- func (c *Conversation) OutputKeys() []string
- func (c *Conversation) Prompt() *prompt.Template
- func (c *Conversation) Type() string
- func (c *Conversation) Verbose() bool
- type ConversationOptions
- 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 LLM
- func (c *LLM) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *LLM) Callbacks() []schema.Callback
- func (c *LLM) InputKeys() []string
- func (c *LLM) Memory() schema.Memory
- func (c *LLM) OutputKeys() []string
- func (c *LLM) Prompt() *prompt.Template
- func (c *LLM) Type() string
- func (c *LLM) Verbose() bool
- type LLMBash
- func (c *LLMBash) Call(ctx context.Context, values schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *LLMBash) Callbacks() []schema.Callback
- func (c *LLMBash) InputKeys() []string
- func (c *LLMBash) Memory() schema.Memory
- func (c *LLMBash) OutputKeys() []string
- func (c *LLMBash) Type() string
- func (c *LLMBash) Verbose() bool
- type LLMBashOptions
- type LLMMath
- func (c *LLMMath) Call(ctx context.Context, values schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *LLMMath) Callbacks() []schema.Callback
- func (c *LLMMath) InputKeys() []string
- func (c *LLMMath) Memory() schema.Memory
- func (c *LLMMath) OutputKeys() []string
- func (c *LLMMath) Type() string
- func (c *LLMMath) Verbose() bool
- type LLMMathOptions
- type LLMOptions
- type PromptSelector
- 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 Sequential
- func (c *Sequential) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *Sequential) Callbacks() []schema.Callback
- func (c *Sequential) InputKeys() []string
- func (c *Sequential) Memory() schema.Memory
- func (c *Sequential) OutputKeys() []string
- func (c *Sequential) Type() string
- func (c *Sequential) Verbose() bool
- type SequentialOptions
- type SimpleSequential
- func (c *SimpleSequential) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *SimpleSequential) Callbacks() []schema.Callback
- func (c *SimpleSequential) InputKeys() []string
- func (c *SimpleSequential) Memory() schema.Memory
- func (c *SimpleSequential) OutputKeys() []string
- func (c *SimpleSequential) Type() string
- func (c *SimpleSequential) Verbose() bool
- type SimpleSequentialOptions
- 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
- type Transform
- func (c *Transform) Call(ctx context.Context, inputs schema.ChainValues, ...) (schema.ChainValues, error)
- func (c *Transform) Callbacks() []schema.Callback
- func (c *Transform) InputKeys() []string
- func (c *Transform) Memory() schema.Memory
- func (c *Transform) OutputKeys() []string
- func (c *Transform) Type() string
- func (c *Transform) Verbose() bool
- type TransformFunc
- type TransformOptions
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsChatModel ¶ added in v0.0.14
IsChatModel checks if the given model is of type schema.ChatModel.
Types ¶
type Conditional ¶ added in v0.0.14
type Conditional struct { Condition ConditionalFunc Prompt *prompt.Template }
Conditional represents a conditional prompt configuration.
type ConditionalFunc ¶ added in v0.0.14
ConditionalFunc represents a function that evaluates a condition based on a model.
type ConditionalPromptSelector ¶ added in v0.0.14
type ConditionalPromptSelector struct { DefaultPrompt *prompt.Template Conditionals []Conditional }
ConditionalPromptSelector is a prompt selector that selects prompts based on conditions.
func (*ConditionalPromptSelector) GetPrompt ¶ added in v0.0.14
func (cps *ConditionalPromptSelector) GetPrompt(model schema.Model) *prompt.Template
GetPrompt selects a prompt template based on the provided model. It evaluates the conditions in order and returns the prompt associated with the first matching condition, or returns the default prompt if no condition is met.
type Conversation ¶ added in v0.0.10
type Conversation struct {
// contains filtered or unexported fields
}
func NewConversation ¶ added in v0.0.10
func NewConversation(llm schema.LLM, optFns ...func(o *ConversationOptions)) (*Conversation, error)
func (*Conversation) Call ¶ added in v0.0.10
func (c *Conversation) 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 (*Conversation) Callbacks ¶ added in v0.0.13
func (c *Conversation) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*Conversation) InputKeys ¶ added in v0.0.10
func (c *Conversation) InputKeys() []string
InputKeys returns the expected input keys.
func (*Conversation) Memory ¶ added in v0.0.13
func (c *Conversation) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*Conversation) OutputKeys ¶ added in v0.0.10
func (c *Conversation) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*Conversation) Prompt ¶ added in v0.0.10
func (c *Conversation) Prompt() *prompt.Template
func (*Conversation) Type ¶ added in v0.0.13
func (c *Conversation) Type() string
Type returns the type of the chain.
func (*Conversation) Verbose ¶ added in v0.0.13
func (c *Conversation) Verbose() bool
Verbose returns the verbosity setting of the chain.
type ConversationOptions ¶ added in v0.0.10
type ConversationOptions struct { *schema.CallbackOptions Prompt *prompt.Template Memory schema.Memory OutputKey string OutputParser schema.OutputParser[any] // ReturnFinalOnly determines whether to return only the final parsed result or include extra generation information. // When set to true (default), the field will return only the final parsed result. // If set to false, the field will include additional information about the generation along with the final parsed result. ReturnFinalOnly bool }
type ConversationalRetrieval ¶ added in v0.0.16
type ConversationalRetrieval struct {
// contains filtered or unexported fields
}
ConversationalRetrieval is a chain implementation for conversational retrieval.
func NewConversationalRetrieval ¶ added in v0.0.16
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 ¶ added in v0.0.16
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 ¶ added in v0.0.16
func (c ConversationalRetrieval) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (ConversationalRetrieval) InputKeys ¶ added in v0.0.16
func (c ConversationalRetrieval) InputKeys() []string
InputKeys returns the expected input keys.
func (ConversationalRetrieval) Memory ¶ added in v0.0.16
func (c ConversationalRetrieval) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (ConversationalRetrieval) OutputKeys ¶ added in v0.0.16
func (c ConversationalRetrieval) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (ConversationalRetrieval) Type ¶ added in v0.0.16
func (c ConversationalRetrieval) Type() string
Type returns the type of the chain.
func (ConversationalRetrieval) Verbose ¶ added in v0.0.16
func (c ConversationalRetrieval) Verbose() bool
Verbose returns the verbosity setting of the chain.
type ConversationalRetrievalOptions ¶ added in v0.0.16
type ConversationalRetrievalOptions struct { *schema.CallbackOptions ReturnSourceDocuments bool ReturnGeneratedQuestion bool CondenseQuestionPrompt *prompt.Template StuffQAPrompt *prompt.Template Memory schema.Memory InputKey string OutputKey string }
ConversationalRetrievalOptions represents the options for the ConversationalRetrieval chain.
type LLM ¶ added in v0.0.16
type LLM struct {
// contains filtered or unexported fields
}
func (*LLM) Call ¶ added in v0.0.16
func (c *LLM) 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 (*LLM) OutputKeys ¶ added in v0.0.16
OutputKeys returns the output keys the chain will return.
type LLMBash ¶ added in v0.0.11
type LLMBash struct {
// contains filtered or unexported fields
}
func NewLLMBash ¶ added in v0.0.11
func NewLLMBash(llm schema.LLM, optFns ...func(o *LLMBashOptions)) (*LLMBash, error)
func (*LLMBash) Call ¶ added in v0.0.11
func (c *LLMBash) 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 (*LLMBash) OutputKeys ¶ added in v0.0.11
OutputKeys returns the output keys the chain will return.
type LLMBashOptions ¶ added in v0.0.11
type LLMBashOptions struct { *schema.CallbackOptions InputKey string OutputKey string }
type LLMMath ¶ added in v0.0.11
type LLMMath struct {
// contains filtered or unexported fields
}
func NewLLMMath ¶ added in v0.0.11
func NewLLMMath(llm schema.LLM, optFns ...func(o *LLMMathOptions)) (*LLMMath, error)
func (*LLMMath) Call ¶ added in v0.0.11
func (c *LLMMath) 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 (*LLMMath) Callbacks ¶ added in v0.0.13
Callbacks returns the callbacks associated with the chain.
func (*LLMMath) OutputKeys ¶ added in v0.0.11
OutputKeys returns the output keys the chain will return.
type LLMMathOptions ¶ added in v0.0.11
type LLMMathOptions struct { *schema.CallbackOptions InputKey string OutputKey string }
type LLMOptions ¶ added in v0.0.16
type LLMOptions struct { *schema.CallbackOptions Memory schema.Memory OutputKey string OutputParser schema.OutputParser[any] // ReturnFinalOnly determines whether to return only the final parsed result or include extra generation information. // When set to true (default), the field will return only the final parsed result. // If set to false, the field will include additional information about the generation along with the final parsed result. ReturnFinalOnly bool }
type PromptSelector ¶ added in v0.0.14
PromptSelector is an interface for selecting prompts based on a model.
type RefineDocuments ¶ added in v0.0.13
type RefineDocuments struct {
// contains filtered or unexported fields
}
func NewRefineDocuments ¶ added in v0.0.13
func NewRefineDocuments(llmChain *LLM, refineLLMChain *LLM, optFns ...func(o *RefineDocumentsOptions)) (*RefineDocuments, error)
func NewRefineSummarization ¶ added in v0.0.13
func NewRefineSummarization(llm schema.LLM, optFns ...func(o *RefineSummarizationOptions)) (*RefineDocuments, error)
func (*RefineDocuments) Call ¶ added in v0.0.13
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 ¶ added in v0.0.13
func (c *RefineDocuments) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*RefineDocuments) InputKeys ¶ added in v0.0.13
func (c *RefineDocuments) InputKeys() []string
InputKeys returns the expected input keys.
func (*RefineDocuments) Memory ¶ added in v0.0.13
func (c *RefineDocuments) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*RefineDocuments) OutputKeys ¶ added in v0.0.13
func (c *RefineDocuments) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*RefineDocuments) Type ¶ added in v0.0.13
func (c *RefineDocuments) Type() string
Type returns the type of the chain.
func (*RefineDocuments) Verbose ¶ added in v0.0.13
func (c *RefineDocuments) Verbose() bool
Verbose returns the verbosity setting of the chain.
type RefineDocumentsOptions ¶
type RefineSummarizationOptions ¶ added in v0.0.13
type RefineSummarizationOptions struct {
*schema.CallbackOptions
}
type RetrievalQA ¶ added in v0.0.2
type RetrievalQA struct {
// contains filtered or unexported fields
}
func NewRetrievalQA ¶ added in v0.0.2
func NewRetrievalQA(llm schema.LLM, retriever schema.Retriever, optFns ...func(o *RetrievalQAOptions)) (*RetrievalQA, error)
func (*RetrievalQA) Call ¶ added in v0.0.2
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 ¶ added in v0.0.13
func (c *RetrievalQA) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*RetrievalQA) InputKeys ¶ added in v0.0.2
func (c *RetrievalQA) InputKeys() []string
InputKeys returns the expected input keys.
func (*RetrievalQA) Memory ¶ added in v0.0.13
func (c *RetrievalQA) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*RetrievalQA) OutputKeys ¶ added in v0.0.2
func (c *RetrievalQA) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*RetrievalQA) Type ¶ added in v0.0.13
func (c *RetrievalQA) Type() string
Type returns the type of the chain.
func (*RetrievalQA) Verbose ¶ added in v0.0.13
func (c *RetrievalQA) Verbose() bool
Verbose returns the verbosity setting of the chain.
type RetrievalQAOptions ¶ added in v0.0.2
type Sequential ¶ added in v0.0.21
type Sequential struct {
// contains filtered or unexported fields
}
func NewSequential ¶ added in v0.0.21
func NewSequential(chains []schema.Chain, inputKeys []string, optFns ...func(o *SequentialOptions)) (*Sequential, error)
func (*Sequential) Call ¶ added in v0.0.21
func (c *Sequential) Call(ctx context.Context, inputs schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)
Call executes the Sequential chain with the given context and inputs. It returns the outputs of the chain or an error, if any.
func (*Sequential) Callbacks ¶ added in v0.0.21
func (c *Sequential) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*Sequential) InputKeys ¶ added in v0.0.21
func (c *Sequential) InputKeys() []string
InputKeys returns the expected input keys.
func (*Sequential) Memory ¶ added in v0.0.21
func (c *Sequential) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*Sequential) OutputKeys ¶ added in v0.0.21
func (c *Sequential) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*Sequential) Type ¶ added in v0.0.21
func (c *Sequential) Type() string
Type returns the type of the chain.
func (*Sequential) Verbose ¶ added in v0.0.21
func (c *Sequential) Verbose() bool
Verbose returns the verbosity setting of the chain.
type SequentialOptions ¶ added in v0.0.21
type SimpleSequential ¶ added in v0.0.21
type SimpleSequential struct {
// contains filtered or unexported fields
}
func NewSimpleSequential ¶ added in v0.0.21
func NewSimpleSequential(chains []schema.Chain, optFns ...func(o *SimpleSequentialOptions)) (*SimpleSequential, error)
func (*SimpleSequential) Call ¶ added in v0.0.21
func (c *SimpleSequential) Call(ctx context.Context, inputs schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)
Call executes the SimpleSequential chain with the given context and inputs. It returns the outputs of the chain or an error, if any.
func (*SimpleSequential) Callbacks ¶ added in v0.0.21
func (c *SimpleSequential) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*SimpleSequential) InputKeys ¶ added in v0.0.21
func (c *SimpleSequential) InputKeys() []string
InputKeys returns the expected input keys.
func (*SimpleSequential) Memory ¶ added in v0.0.21
func (c *SimpleSequential) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*SimpleSequential) OutputKeys ¶ added in v0.0.21
func (c *SimpleSequential) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*SimpleSequential) Type ¶ added in v0.0.21
func (c *SimpleSequential) Type() string
Type returns the type of the chain.
func (*SimpleSequential) Verbose ¶ added in v0.0.21
func (c *SimpleSequential) Verbose() bool
Verbose returns the verbosity setting of the chain.
type SimpleSequentialOptions ¶ added in v0.0.21
type StuffDocuments ¶ added in v0.0.13
type StuffDocuments struct {
// contains filtered or unexported fields
}
func NewStuffDocuments ¶ added in v0.0.13
func NewStuffDocuments(llmChain *LLM, optFns ...func(o *StuffDocumentsOptions)) (*StuffDocuments, error)
func NewStuffSummarization ¶ added in v0.0.13
func NewStuffSummarization(llm schema.LLM, optFns ...func(o *StuffSummarizationOptions)) (*StuffDocuments, error)
func (*StuffDocuments) Call ¶ added in v0.0.13
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 ¶ added in v0.0.13
func (c *StuffDocuments) Callbacks() []schema.Callback
Callbacks returns the callbacks associated with the chain.
func (*StuffDocuments) InputKeys ¶ added in v0.0.13
func (c *StuffDocuments) InputKeys() []string
InputKeys returns the expected input keys.
func (*StuffDocuments) Memory ¶ added in v0.0.13
func (c *StuffDocuments) Memory() schema.Memory
Memory returns the memory associated with the chain.
func (*StuffDocuments) OutputKeys ¶ added in v0.0.13
func (c *StuffDocuments) OutputKeys() []string
OutputKeys returns the output keys the chain will return.
func (*StuffDocuments) Type ¶ added in v0.0.13
func (c *StuffDocuments) Type() string
Type returns the type of the chain.
func (*StuffDocuments) Verbose ¶ added in v0.0.13
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 ¶ added in v0.0.13
type StuffSummarizationOptions struct {
*schema.CallbackOptions
}
type Transform ¶ added in v0.0.17
type Transform struct {
// contains filtered or unexported fields
}
func NewTransform ¶ added in v0.0.17
func NewTransform(inputKeys, outputKeys []string, transform TransformFunc, optFns ...func(o *TransformOptions)) (*Transform, error)
func (*Transform) Call ¶ added in v0.0.17
func (c *Transform) 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 (*Transform) Callbacks ¶ added in v0.0.17
Callbacks returns the callbacks associated with the chain.
func (*Transform) OutputKeys ¶ added in v0.0.17
OutputKeys returns the output keys the chain will return.
type TransformFunc ¶ added in v0.0.6
type TransformFunc func(ctx context.Context, inputs schema.ChainValues, optFns ...func(o *schema.CallOptions)) (schema.ChainValues, error)
type TransformOptions ¶ added in v0.0.17
type TransformOptions struct {
*schema.CallbackOptions
}