Documentation ¶
Index ¶
- Constants
- Variables
- type Chain
- type ChainFunc
- type ChatMessage
- type ChatMessages
- type ChatPrompt
- type Document
- type DocumentLoader
- type DocumentLoaderFunc
- type Embeddings
- type FileStore
- type LLM
- type Memory
- type MessageTemplate
- type OutputParser
- type Prompt
- type PromptFunc
- type ScoredDocument
- type Splitter
- type Tool
- type Values
- type VectorStore
Constants ¶
const DefaultOutputKey = "text"
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Chain ¶
Chain wraps calls to "chain links", like LLMs, Databases, etc...
TODO: Add support for a context (for timeout, cancellation, etc...) TODO: Maybe rename it to "Link"?
type ChainFunc ¶
ChainFunc is a function that implements the Chain interface. It is used to wrap simple functions that can be used as chain links.
type ChatMessage ¶
type ChatMessages ¶
type ChatMessages []ChatMessage
func (ChatMessages) Last ¶
func (m ChatMessages) Last(size int) ChatMessages
func (ChatMessages) String ¶
func (m ChatMessages) String() string
type ChatPrompt ¶
type ChatPrompt interface {
Messages(Values) []MessageTemplate
}
type DocumentLoader ¶
type DocumentLoaderFunc ¶
type Embeddings ¶
type Embeddings interface { // EmbedDocuments returns the embeddings for the given documents EmbedDocuments(context.Context, []string) ([][]float32, error) // EmbedQuery returns the embedding for the given query EmbedQuery(context.Context, string) ([]float32, error) }
Embeddings can be used to create a numerical representation of textual data. This numerical representation is useful because it can be used to find similar documents.
type FileStore ¶
type FileStore interface { ReadFile(ctx context.Context, path string) (string, error) WriteFile(ctx context.Context, path, content string) error AppendToFile(ctx context.Context, path, content string) error }
FileStore is an abstraction of a filesystem, used to read and write files.
type MessageTemplate ¶
type OutputParser ¶
type PromptFunc ¶
func (PromptFunc) Format ¶
func (f PromptFunc) Format(values ...Values) string
type ScoredDocument ¶
type Tool ¶
type Tool interface { // Name returns the name of the tool. Name() string // Description returns a short description of the tool. Description() string // Args returns a list of arguments. Each argument must be a string with the format "name:description". Args() []string // Call is called to execute the tool with the given argument values. // The returned string has to be a valid JSON string. Call(ctx context.Context, args map[string]string) (string, error) }
type VectorStore ¶
type VectorStore interface { // AddDocuments adds the given documents to the store AddDocuments(context.Context, ...Document) error // SimilaritySearch returns the k most similar documents to the query SimilaritySearch(ctx context.Context, query string, k int) ([]Document, error) // SimilaritySearchVectorWithScore returns the k most similar documents to the query, along with their similarity score SimilaritySearchVectorWithScore(ctx context.Context, query []float32, k int) ([]ScoredDocument, error) }
VectorStore is a particular type of database optimized for storing documents and their embeddings, and then fetching of the most relevant documents for a particular query, ie. those whose embeddings are most similar to the embedding of the query.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
llms
|
|
Package pl implements some Data Pipeline helper functions.
|
Package pl implements some Data Pipeline helper functions. |