Documentation
¶
Index ¶
- func StringifyChatMessages(messages []ChatMessage, optFns ...func(o *StringifyChatMessagesOptions)) (string, error)
- type AIChatMessage
- type Agent
- type Chain
- type ChainValues
- type ChatMessage
- type ChatMessageType
- type Document
- type Generation
- type GenericChatMessage
- type HumanChatMessage
- type LLM
- type LLMResult
- type Memory
- type OutputParser
- type PromptValue
- type Retriever
- type StringifyChatMessagesOptions
- type SystemChatMessage
- type Tool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringifyChatMessages ¶
func StringifyChatMessages(messages []ChatMessage, optFns ...func(o *StringifyChatMessagesOptions)) (string, error)
Types ¶
type AIChatMessage ¶
type AIChatMessage struct {
// contains filtered or unexported fields
}
func NewAIChatMessage ¶
func NewAIChatMessage(text string) *AIChatMessage
func (AIChatMessage) Text ¶
func (m AIChatMessage) Text() string
func (AIChatMessage) Type ¶
func (m AIChatMessage) Type() ChatMessageType
type Chain ¶ added in v0.0.2
type Chain interface { Call(ctx context.Context, values ChainValues) (ChainValues, error) InputKeys() []string OutputKeys() []string }
type ChainValues ¶
type ChatMessage ¶
type ChatMessage interface { Text() string Type() ChatMessageType }
type ChatMessageType ¶
type ChatMessageType string
const ( ChatMessageTypeHuman ChatMessageType = "human" ChatMessageTypeAI ChatMessageType = "ai" ChatMessageTypeSystem ChatMessageType = "system" ChatMessageTypeGeneric ChatMessageType = "generic" )
type Generation ¶
type Generation struct { Text string Message ChatMessage Info map[string]any }
type GenericChatMessage ¶
type GenericChatMessage struct {
// contains filtered or unexported fields
}
func NewGenericChatMessage ¶
func NewGenericChatMessage(text, role string) *GenericChatMessage
func (GenericChatMessage) Role ¶
func (m GenericChatMessage) Role() string
func (GenericChatMessage) Text ¶
func (m GenericChatMessage) Text() string
func (GenericChatMessage) Type ¶
func (m GenericChatMessage) Type() ChatMessageType
type HumanChatMessage ¶
type HumanChatMessage struct {
// contains filtered or unexported fields
}
func NewHumanChatMessage ¶
func NewHumanChatMessage(text string) *HumanChatMessage
func (HumanChatMessage) Text ¶
func (m HumanChatMessage) Text() string
func (HumanChatMessage) Type ¶
func (m HumanChatMessage) Type() ChatMessageType
type LLM ¶
type LLM interface { GeneratePrompt(ctx context.Context, promptValues []PromptValue) (*LLMResult, error) Predict(ctx context.Context, text string) (string, error) PredictMessages(ctx context.Context, messages []ChatMessage) (ChatMessage, error) }
type LLMResult ¶
type LLMResult struct { Generations [][]Generation LLMOutput map[string]any }
type Memory ¶
type Memory interface { // Input keys this memory class will load dynamically. MemoryVariables() []string // Return key-value pairs given the text input to the chain. // If None, return all memories LoadMemoryVariables(inputs map[string]any) (map[string]any, error) // Save the context of this model run to memory. SaveContext(inputs map[string]any, outputs map[string]any) error // Clear memory contents. Clear() error }
type OutputParser ¶ added in v0.0.2
type OutputParser[T any] interface { // Parse parses the output of an LLM call. Parse(text string) (T, error) // ParseWithPrompt parses the output of an LLM call with the prompt used. ParseWithPrompt(text string, prompt PromptValue) (T, error) // GetFormatInstructions returns a string describing the format of the output. GetFormatInstructions() (string, error) // Type returns the string type key uniquely identifying this class of parser Type() string }
OutputParser is an interface for parsing the output of an LLM call.
type PromptValue ¶
type PromptValue interface { String() string Messages() []ChatMessage }
type SystemChatMessage ¶
type SystemChatMessage struct {
// contains filtered or unexported fields
}
func NewSystemChatMessage ¶
func NewSystemChatMessage(text string) *SystemChatMessage
func (SystemChatMessage) Text ¶
func (m SystemChatMessage) Text() string
func (SystemChatMessage) Type ¶
func (m SystemChatMessage) Type() ChatMessageType
Click to show internal directories.
Click to hide internal directories.