Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion go/plugins/localvec/localvec.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const provider = "devLocalVectorStore"

// Config provides configuration options for the Init function.
type Config struct {
// Where to store the data.
// Where to store the data. Defaults to os.TempDir.
Dir string
Name string
Embedder *ai.EmbedderAction
Expand Down Expand Up @@ -90,6 +90,9 @@ type dbValue struct {

// newDocStore returns a new ai.DocumentStore to register.
func newDocStore(dir, name string, embedder *ai.EmbedderAction, embedderOptions any) (*docStore, error) {
if dir == "" {
dir = os.TempDir()
}
if err := os.MkdirAll(dir, 0o755); err != nil {
return nil, err
}
Expand Down
1 change: 0 additions & 1 deletion go/samples/menu/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ func main() {

const localvecName = "go-menu-items"
if err := localvec.Init(ctx, localvec.Config{
Dir: os.TempDir(),
Name: localvecName,
Embedder: vertexai.Embedder(embeddingGecko),
}); err != nil {
Expand Down
1 change: 0 additions & 1 deletion go/samples/rag/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func main() {

const localvecName = "simpleQa"
if err := localvec.Init(context.Background(), localvec.Config{
Dir: os.TempDir(),
Name: localvecName,
Embedder: googleai.Embedder("embedding-001"),
}); err != nil {
Expand Down