inmemory

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package inmemory provides an in-memory vector store implementation.

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 that uses cosine similarity.

func New

func New(embedder embeddings.Embedder) *Store

New creates a new in-memory vector store.

func (*Store) AddDocuments

func (s *Store) AddDocuments(ctx context.Context, documents []*core.Document) ([]string, error)

AddDocuments embeds and stores documents.

func (*Store) Delete

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

Delete removes documents by their IDs.

func (*Store) GetEmbedder

func (s *Store) GetEmbedder() embeddings.Embedder

GetEmbedder returns the embedder.

func (*Store) SimilaritySearch

func (s *Store) SimilaritySearch(ctx context.Context, query string, k int) ([]*core.Document, error)

SimilaritySearch finds the k most similar documents to the query.

func (*Store) SimilaritySearchWithScore

func (s *Store) SimilaritySearchWithScore(ctx context.Context, query string, k int) ([]vectorstores.DocumentWithScore, error)

SimilaritySearchWithScore finds the k most similar documents with scores.

Jump to

Keyboard shortcuts

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