Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPrompt ¶
BuildPrompt constructs a RAG prompt from search results.
Types ¶
type Asker ¶
type Asker struct {
// contains filtered or unexported fields
}
Asker retrieves relevant chunks and generates an LLM answer with citations.
type BM25 ¶
type BM25 struct {
// contains filtered or unexported fields
}
BM25 runs a full-text search using SQLite FTS5's built-in BM25 ranking.
type Hybrid ¶
type Hybrid struct {
// contains filtered or unexported fields
}
Hybrid orchestrates BM25 + vector search + RRF fusion.
func NewHybrid ¶
func NewHybrid(bm25 *BM25, vector *VectorSearch, embedding providers.EmbeddingProvider, cfg config.SearchConfig) *Hybrid
type LLMCache ¶
type LLMCache struct {
// contains filtered or unexported fields
}
LLMCache caches LLM responses keyed by SHA-256(model + prompt).
func NewLLMCache ¶
type Result ¶
type Result struct {
DocID int64 `json:"doc_id"`
ChunkID int64 `json:"chunk_id"`
Collection string `json:"collection"`
Path string `json:"path"`
Title string `json:"title,omitempty"`
HeadingPath string `json:"heading_path,omitempty"`
Snippet string `json:"snippet"`
Score float64 `json:"score"`
Explain *ScoreExplain `json:"explain,omitempty"`
}
Result is a single search hit.
type ScoreExplain ¶
type ScoreExplain struct {
BM25Score float64 `json:"bm25_score,omitempty"`
BM25Rank int `json:"bm25_rank,omitempty"`
VectorDist float64 `json:"vector_distance,omitempty"`
VectorRank int `json:"vector_rank,omitempty"`
RRFScore float64 `json:"rrf_score,omitempty"`
RerankScore float64 `json:"rerank_score,omitempty"`
}
ScoreExplain breaks down how a score was computed.
type SearchOpts ¶
type SearchOpts struct {
Query string
Collection string // empty = all collections
TopK int
Mode string // lexical | hybrid | deep
Explain bool
}
SearchOpts configures a search operation.
type VectorSearch ¶
type VectorSearch struct {
// contains filtered or unexported fields
}
VectorSearch performs KNN search using pure Go cosine similarity. Embeddings are loaded from the DB and compared in memory. For large corpora, a dedicated vector index (sqlite-vec, etc.) is preferred.
func NewVectorSearch ¶
func NewVectorSearch(database *db.DB) *VectorSearch
Click to show internal directories.
Click to hide internal directories.