Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions vectorstores/options.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package vectorstores

import "github.com/tmc/langchaingo/embeddings"

// Option is a function that configures an Options.
type Option func(*Options)

Expand All @@ -8,6 +10,7 @@ type Options struct {
NameSpace string
ScoreThreshold float64
Filters any
Embedder embeddings.Embedder
}

// WithNameSpace returns an Option for setting the name space.
Expand All @@ -32,3 +35,12 @@ func WithFilters(filters any) Option {
o.Filters = filters
}
}

// WithEmbedder returns an Option for setting the embedder that could be used when
// adding documents or doing similarity search (instead the embedder from the Store context)
// this is useful when we are using multiple LLMs with single vectorstore.
func WithEmbedder(embedder embeddings.Embedder) Option {
return func(o *Options) {
o.Embedder = embedder
}
}