Documentation
¶
Overview ¶
Package llmprefix implements Anthropic-style contextual retrieval (roadmap Phase D.2): an LLM writes a one-sentence description of each code chunk, which is prepended to the chunk's embed text so the vector carries situating context. Generation is expensive, so results are disk-cached by chunk content hash and a generation failure degrades to no prefix (the caller falls back to the cheap rule-based prefix) rather than failing the build.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPrompt ¶
BuildPrompt is the one-sentence contextual-description prompt for a chunk.
Types ¶
type Cached ¶
type Cached struct {
// contains filtered or unexported fields
}
Cached is a disk-cached LLM prefixer. It keys prefixes by chunk content hash so a rebuild reuses them, and returns "" on any generation error rather than failing the build.
type Generator ¶
Generator produces an LLM completion for a prompt. Injectable so the prefixer is unit-testable without a live model and swappable across backends (ollama, Claude CLI, API).
type OllamaGenerator ¶
type OllamaGenerator struct {
// contains filtered or unexported fields
}
OllamaGenerator generates contextual prefixes via a local Ollama chat model (POST /api/generate, non-streaming). The default endpoint is overridable with CKV_OLLAMA_ENDPOINT, matching the embedder adapter.
func NewOllamaGenerator ¶
func NewOllamaGenerator(model string) *OllamaGenerator
NewOllamaGenerator builds a generator for the named Ollama model (e.g. "llama3"). Requires `ollama serve` with the model pulled.