Documentation
¶
Index ¶
- Constants
- Variables
- func FileSource(d model.Doc, force bool) map[string]model.Value
- func GitSource(d model.Doc, root string, force bool) map[string]model.Value
- func LLMSource(d model.Doc, s *schema.Schema, root string, force bool) map[string]model.Value
- func RunLLM(cmdline string, req LLMRequest) (map[string]model.Value, error)
- type LLMRequest
- type Result
Constants ¶
const DefaultLLMPrompt = "" /* 205-byte string literal not displayed */
DefaultLLMPrompt is the opening instruction buildPrompt prepends to every request. It frames the task for the model; the machinery that follows (the JSON contract, field meanings, and doc context) is fixed. Config may override it via mark.llm_prompt.
Variables ¶
var LLMCmd string
LLMCmd is set by the mark command before Plan runs the llm source.
var LLMExcerptBytes int
LLMExcerptBytes caps how many bytes of each doc body are sent to the llm as context. Zero or less means send the whole file untruncated. The mark command sets it from config before Plan runs the llm source.
var LLMPrompt string
LLMPrompt is the opening instruction sent to the llm. The mark command sets it from config before Plan runs the llm source; an empty value falls back to DefaultLLMPrompt.
Functions ¶
func FileSource ¶ added in v0.0.8
FileSource derives id, title, and type from the path and headings. It fills absent keys and leaves existing values alone unless force is set. Values come from the raw inputs (path slug, H1 heading, parent dir), not from d.Title/d.Type, which already prefer the frontmatter value and so could never be overwritten under force.
func GitSource ¶ added in v0.0.8
GitSource derives lastUpdated and owner from git history. lastUpdated always refreshes: it is git's to own and moves on every commit, so a stale value is never what you want. owner is filled only when absent, since a project may set it by hand. force overwrites either.
func LLMSource ¶ added in v0.0.8
LLMSource builds a request for llm-derived fields the doc lacks and runs it. Its output is nondeterministic, so it never refreshes a field that is already present: re-generating on every run would churn the corpus. It fills absent fields, and force overwrites present ones.
Types ¶
type LLMRequest ¶
type LLMRequest struct {
Path string `json:"path"`
Title string `json:"title"`
Type string `json:"type"`
Excerpt string `json:"excerpt"`
Want []string `json:"want"`
Schema map[string]schema.Field `json:"schema"`
}
LLMRequest is the JSON written to the subprocess stdin.
type Result ¶
Result is the set of new field values for one document.
func Plan ¶
Plan runs the requested sources over docs and returns one Result per doc that gained or refreshed a field. Sources run in order: they fill absent keys, the git source refreshes lastUpdated, and force overwrites present keys. Later sources see earlier sources' additions through the merged view.