Documentation
¶
Overview ¶
Package config loads and validates the andino-kb YAML configuration.
Decoding is strict: unknown fields are errors, so a typo in a pipeline definition fails at startup instead of silently indexing nothing. ${VAR} references are expanded from the environment before parsing; unset variables expand to the empty string.
Index ¶
Constants ¶
const ManagedSourceName = "managed"
ManagedSourceName is the implicit source name for agent-written documents in writable knowledge bases.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKey ¶
APIKey grants access to the REST and MCP APIs. Scope "read" allows search and reads; "readwrite" additionally allows store/delete on writable KBs.
type ChatModel ¶ added in v0.2.0
type ChatModel struct {
Name string `yaml:"name"`
Backend string `yaml:"backend"`
Model string `yaml:"model"`
MaxTokens int `yaml:"max_tokens"`
// ExtraBody is merged into the /v1/chat/completions request body.
// Needed e.g. to disable reasoning on thinking-first models
// (llama.cpp/vLLM: chat_template_kwargs: {enable_thinking: false}),
// whose reasoning otherwise consumes max_tokens and returns empty
// content.
ExtraBody map[string]any `yaml:"extra_body"`
}
ChatModel is a chat-completions model used for index-time work such as contextual retrieval.
type Config ¶
type Config struct {
Server Server `yaml:"server"`
Storage Storage `yaml:"storage"`
Inference Inference `yaml:"inference"`
Defaults Defaults `yaml:"defaults"`
KnowledgeBases []KnowledgeBase `yaml:"knowledge_bases"`
}
func (*Config) ChatModelByName ¶ added in v0.3.0
ChatModelByName resolves a chat model reference to its definition and backend.
func (*Config) EmbeddingModelFor ¶
func (c *Config) EmbeddingModelFor(kb *KnowledgeBase) (EmbeddingModel, Backend, error)
EmbeddingModelFor resolves a KB's embedding model definition.
type Contextual ¶ added in v0.2.0
type Contextual struct {
Enabled bool `yaml:"enabled"`
Model string `yaml:"model"` // ref into inference.chat_models
}
Contextual enables contextual retrieval for a knowledge base: an LLM generates a short situating context per chunk at index time, which is embedded and BM25-indexed alongside the text.
type EmbeddingModel ¶
type Inference ¶
type Inference struct {
Backends []Backend `yaml:"backends"`
EmbeddingModels []EmbeddingModel `yaml:"embedding_models"`
RerankModels []RerankModel `yaml:"rerank_models"`
ChatModels []ChatModel `yaml:"chat_models"`
}
type KnowledgeBase ¶
type KnowledgeBase struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Writable bool `yaml:"writable"`
Sources []Source `yaml:"sources"`
Chunking *Chunking `yaml:"chunking"`
EmbeddingModel string `yaml:"embedding_model"`
RerankModel string `yaml:"rerank_model"`
// RerankDefault decides whether searches rerank when no per-request
// override is given: "on" (default) or "off". With "off" the reranker
// stays available to requests that ask for rerank: true.
RerankDefault string `yaml:"rerank_default"`
Contextual *Contextual `yaml:"contextual"`
OCR *OCR `yaml:"ocr"`
}
type OCR ¶ added in v0.3.0
type OCR struct {
Enabled bool `yaml:"enabled"`
Model string `yaml:"model"` // ref into inference.chat_models (must be vision-capable)
}
OCR enables transcription of scanned PDF pages through a vision-capable chat model at index time.
type RerankModel ¶
type Source ¶
type Source struct {
Name string `yaml:"name"`
Type string `yaml:"type"` // localdir | git | s3
// localdir
Path string `yaml:"path"`
Include []string `yaml:"include"`
Exclude []string `yaml:"exclude"`
Watch bool `yaml:"watch"`
DebounceMS int `yaml:"debounce_ms"`
// git
URL string `yaml:"url"`
Branch string `yaml:"branch"`
Paths []string `yaml:"paths"` // also used by s3
PollInterval time.Duration `yaml:"poll_interval"`
TokenEnv string `yaml:"token_env"`
// s3
Bucket string `yaml:"bucket"`
Prefix string `yaml:"prefix"`
Region string `yaml:"region"`
Endpoint string `yaml:"endpoint"` // custom endpoint for MinIO/compatible
PathStyle bool `yaml:"path_style"` // path-style addressing (MinIO)
}
Source is a single ingestion pipeline. Type-specific fields are flat; the validator enforces which apply to which type.