Documentation
¶
Overview ¶
Package embed provides an OpenAI-compatible embeddings client and the similarity + fusion primitives for hybrid (BM25 + vector) catalog retrieval.
It is the in-house alternative to a Python embedding sidecar or a vector-DB dependency: embeddings are served by the same OpenAI-compatible endpoint as the model (in-cluster vLLM, Ollama, OpenAI), and similarity is brute-force cosine over the (small) catalog — no new datastore, still a single static binary.
This package is the foundation only; wiring hybrid retrieval into the catalog index and the recall gates is an eval-validated follow-up (the BM25-tuned recall thresholds must be re-measured for fused scores, not guessed).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client calls an OpenAI-compatible /embeddings endpoint.
type Fused ¶
Fused is an id with its fused relevance score.
func FuseRRF ¶
FuseRRF combines several rankings of the same id space by Reciprocal Rank Fusion: score(id) = Σ 1/(k + rank), rank 0-based within each ranking; an id absent from a ranking contributes nothing. RRF is scale-free — it fuses BM25 and cosine rankings without their different score magnitudes distorting the result. k dampens low ranks (60 is the common default). Results are sorted by descending fused score, ties broken by id for determinism.