vector

package
v0.80.5 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package vector provides the vector retrieval service interface for AI agents. This interface is consumed by Team C (Memo Enhancement).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockVectorService

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

MockVectorService is a mock implementation of VectorService for testing.

func NewMockVectorService

func NewMockVectorService() *MockVectorService

NewMockVectorService creates a new MockVectorService with sample data.

func (*MockVectorService) HybridSearch

func (m *MockVectorService) HybridSearch(ctx context.Context, query string, limit int) ([]SearchResult, error)

HybridSearch performs hybrid search combining vector and keyword search. Match types: - "keyword": exact keyword match found in content - "vector": no keyword match, but included via vector similarity In this mock, we don't do real vector embedding, so "hybrid" would require both.

func (*MockVectorService) SearchSimilar

func (m *MockVectorService) SearchSimilar(ctx context.Context, vector []float32, limit int, filter map[string]any) ([]VectorResult, error)

SearchSimilar performs similarity search on vectors.

func (*MockVectorService) StoreEmbedding

func (m *MockVectorService) StoreEmbedding(ctx context.Context, docID string, vector []float32, metadata map[string]any) error

StoreEmbedding stores a vector embedding with metadata.

type SearchResult

type SearchResult struct {
	Name      string  `json:"name"`
	Content   string  `json:"content"`
	MatchType string  `json:"match_type"`
	Score     float32 `json:"score"`
}

SearchResult represents a hybrid search result.

type VectorResult

type VectorResult struct {
	Metadata map[string]any `json:"metadata"`
	DocID    string         `json:"doc_id"`
	Score    float32        `json:"score"`
}

VectorResult represents a vector search result.

type VectorService

type VectorService interface {
	// StoreEmbedding stores a vector embedding with metadata.
	StoreEmbedding(ctx context.Context, docID string, vector []float32, metadata map[string]any) error

	// SearchSimilar performs similarity search on vectors.
	// filter: filter conditions (user_id, created_after, etc.)
	SearchSimilar(ctx context.Context, vector []float32, limit int, filter map[string]any) ([]VectorResult, error)

	// HybridSearch performs hybrid search combining vector and keyword search.
	HybridSearch(ctx context.Context, query string, limit int) ([]SearchResult, error)
}

Consumers: Team C (Memo Enhancement).

Jump to

Keyboard shortcuts

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