fake

package
v0.36.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package fake provides an in-memory vector store for testing.

Use the Store type as a lightweight alternative to real vector databases in unit tests. It stores documents in memory and supports basic retrieval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is an in-memory vector store for testing purposes.

func New

func New() *Store

New a new fake vector store.

func (*Store) AddDocuments

func (s *Store) AddDocuments(_ context.Context, docs []schema.Document, _ ...vectorstores.Option) ([]string, error)

AddDocuments adds documents to the in-memory store.

func (*Store) DeleteCollection added in v0.5.0

func (s *Store) DeleteCollection(_ context.Context, _ string) error

DeleteCollection simulates deleting a collection.

func (*Store) Docs

func (s *Store) Docs() []schema.Document

Docs returns all documents currently in the fake store.

func (*Store) ListCollections

func (s *Store) ListCollections(_ context.Context) ([]string, error)

ListCollections returns a dummy collection name.

func (*Store) SimilaritySearch

func (s *Store) SimilaritySearch(_ context.Context, _ string, numDocuments int, _ ...vectorstores.Option) ([]schema.Document, error)

SimilaritySearch returns the first N documents from the store, simulating a search.

func (*Store) SimilaritySearchWithScores

func (s *Store) SimilaritySearchWithScores(ctx context.Context, query string, numDocuments int, options ...vectorstores.Option) ([]vectorstores.DocumentWithScore, error)

SimilaritySearchWithScores returns documents with a faked score of 1.0.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL