enrich

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package enrich generates one-sentence purpose summaries for indexed code symbols using an OpenAI-compatible chat completion endpoint. Summaries are written to .contextmaxxer/synthetic-docs.json and merged into symbol docstrings at index time, closing the vocabulary gap between intent-style queries ("why") and code text ("how").

DECISION(2026-06): one client for both local and cloud backends — Ollama, LM Studio and DeepSeek all expose the OpenAI chat completions API, so the backend is just BaseURL+Model+APIKey. Local (Ollama, qwen2.5-coder:3b) is the default: ~2GB on disk, runs CPU-only on an average dev machine. REVISIT IF: a local runtime without an OpenAI-compatible endpoint must be supported.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StripEchoTail

func StripEchoTail(s string) string

StripEchoTail removes an instruction-echo clause ("..., distinguishing it from similar symbols by ...") and everything after it. Exported so existing sidecar files can be sanitized without regeneration.

Types

type Client

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

func NewClient

func NewClient(cfg Config) *Client

func (*Client) SummarizeSymbol

func (c *Client) SummarizeSymbol(ctx context.Context, filePath string, sym store.Symbol) (string, error)

SummarizeSymbol asks the model for a one-sentence purpose summary of a symbol. Returns a cleaned single-line summary.

type Config

type Config struct {
	BaseURL string // OpenAI-compatible endpoint, e.g. http://localhost:11434/v1
	Model   string
	APIKey  string // empty for local backends
	Timeout time.Duration
	Log     *slog.Logger
}

Jump to

Keyboard shortcuts

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