search

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApproxTokenCount

func ApproxTokenCount(text string) int

ApproxTokenCount returns an approximate token count for the given text. Uses a 1.5x multiplier on word count as a rough heuristic for code-heavy content.

func FormatDocSnippets

func FormatDocSnippets(snippets []Snippet, tokenBudget int) string

FormatDocSnippets renders snippets as LLM-friendly markdown text, stopping when the token budget is exceeded (always keeps at least 1 snippet).

func RankLibraries

func RankLibraries(query string, libs []store.LibraryRecord) []store.LibraryRecord

RankLibraries scores library results for resolve-library-id.

Types

type Snippet

type Snippet struct {
	EntityName    string
	MethodName    string
	Signature     string
	Description   string
	Parameters    []SnippetParam
	ReturnType    string
	ReturnDesc    string
	SourceCode    string
	WrappedSource string
	WrappedMethod string
	URL           string
}

Snippet holds the data needed for formatting a documentation snippet.

type SnippetParam

type SnippetParam struct {
	Name        string
	Type        string
	Required    bool
	Description string
}

SnippetParam describes a function/method parameter for formatting.

Jump to

Keyboard shortcuts

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