database

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CosineSimilarity

func CosineSimilarity(a, b []float64) float64

CosineSimilarity calculates cosine similarity between two vectors

Types

type Document

type Document struct {
	ID         string `json:"id"`
	SourcePath string `json:"source_path"`
	ChunkIndex int    `json:"chunk_index"`
	Content    string `json:"content"`
	FileHash   string `json:"file_hash"`
	CreatedAt  string `json:"created_at"`
}

Document represents a chunk of text - the base type returned by all RAG strategies. Strategy-specific fields (embeddings, semantic summaries) are handled internally by each strategy and don't need to be exposed here.

type FileMetadata

type FileMetadata struct {
	SourcePath  string
	FileHash    string
	LastIndexed string
	ChunkCount  int
}

FileMetadata represents metadata about an indexed file. Used for change detection and incremental indexing.

type SearchResult

type SearchResult struct {
	Document   Document `json:"document"`
	Similarity float64  `json:"similarity"`
}

SearchResult represents a document with its relevance score. This is the common return type for all Strategy.Query() implementations.

Jump to

Keyboard shortcuts

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