Documentation
¶
Index ¶
- func FindMarkdownFiles(dir string) ([]string, error)
- type Chunk
- type Indexer
- type SectionNode
- type SectionSummarizer
- func (s *SectionSummarizer) SummarizeDirectory(ctx context.Context, dir string, emb embedder.Embedder, st store.Store) (int, error)
- func (s *SectionSummarizer) SummarizeNode(ctx context.Context, node *SectionNode, source string) (*models.Memory, error)
- func (s *SectionSummarizer) SummarizeTree(ctx context.Context, nodes []*SectionNode, source string) ([]*models.Memory, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindMarkdownFiles ¶ added in v0.4.0
Types ¶
type Chunk ¶
type Chunk struct {
Content string
Source string
Heading string
SectionPath string // full " / "-delimited path from document root
SectionDepth int // 1=H1, 2=H2, 3=H3, 4=H4; 0 if no heading
Tags []string
Metadata map[string]any
}
Chunk represents a section of text extracted from a file.
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer scans markdown files, chunks them, generates embeddings, and stores them.
func NewIndexer ¶
func NewIndexer(emb embedder.Embedder, st store.Store, chunkSize, chunkOverlap int, logger *slog.Logger) *Indexer
NewIndexer creates a new file indexer.
func (*Indexer) IndexDirectory ¶
IndexDirectory scans a directory for markdown files and indexes them.
type SectionNode ¶ added in v0.4.0
type SectionNode struct {
Title string
Depth int // 1=H1, 2=H2, 3=H3, 4=H4
Path string // " / "-delimited: "Architecture / Store / Qdrant"
Content string // raw body text (no sub-headings)
WordCount int
Children []*SectionNode
}
SectionNode represents a section of a markdown document.
func ParseMarkdownTree ¶ added in v0.4.0
func ParseMarkdownTree(content string) []*SectionNode
ParseMarkdownTree parses markdown into a forest of SectionNodes.
type SectionSummarizer ¶ added in v0.4.0
type SectionSummarizer struct {
// contains filtered or unexported fields
}
SectionSummarizer generates concise summary memories for document sections using Claude Haiku. Summaries are stored alongside the raw chunk memories and surface during broad recall queries where a specific chunk might be missed.
func NewSectionSummarizer ¶ added in v0.4.0
func NewSectionSummarizer(client llm.LLMClient, model string, logger *slog.Logger) *SectionSummarizer
NewSectionSummarizer creates a SectionSummarizer backed by Claude.
func (*SectionSummarizer) SummarizeDirectory ¶ added in v0.4.0
func (s *SectionSummarizer) SummarizeDirectory(ctx context.Context, dir string, emb embedder.Embedder, st store.Store) (int, error)
SummarizeDirectory walks a directory for markdown files, generates section summaries for each, embeds them, and upserts them into the store. Returns the total number of summary memories stored.
func (*SectionSummarizer) SummarizeNode ¶ added in v0.4.0
func (s *SectionSummarizer) SummarizeNode(ctx context.Context, node *SectionNode, source string) (*models.Memory, error)
SummarizeNode generates a single-sentence summary Memory for the given SectionNode. Returns (nil, nil) for sections below the word count threshold.
func (*SectionSummarizer) SummarizeTree ¶ added in v0.4.0
func (s *SectionSummarizer) SummarizeTree(ctx context.Context, nodes []*SectionNode, source string) ([]*models.Memory, error)
SummarizeTree recursively summarizes all nodes in the section tree with sufficient content and returns the resulting Memory objects.