config

package
v0.12.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigTemplate = `` /* 1130-byte string literal not displayed */

Functions

func AddCollection

func AddCollection(configPath string, col Collection) error

AddCollection adds or updates a collection in the config file at configPath. Existing YAML comments and structure are preserved via yaml.Node round-trip.

func AssignCollectionNames

func AssignCollectionNames(paths []string) []string

AssignCollectionNames names every path, lengthening only those that would otherwise collide. Two "notes" directories become "work-notes" and "personal-notes"; everything else keeps its short name.

func CanonicalPath

func CanonicalPath(path string) (string, error)

CanonicalPath expands a filesystem path to an absolute, symlink-resolved, clean path. Symlink resolution is best effort so nonexistent paths can still be compared by their cleaned absolute form.

func DefaultConfigPath

func DefaultConfigPath() string

func DefaultDBPath

func DefaultDBPath() string

func ExpandHome

func ExpandHome(path string) string

ExpandHome expands a leading ~ to the user home directory.

func RemoveCollection

func RemoveCollection(configPath string, name string) error

RemoveCollection removes a collection from the config file at configPath. Existing YAML comments and structure are preserved via yaml.Node round-trip. Returns an error if the collection name is not found.

func SlugFromPath

func SlugFromPath(path string) string

SlugFromPath returns a collection name derived from a filesystem path. It is the directory's own name: a full-path slug produced names too long to type after -c, such as Library-Mobile-Documents-iCloud-md-obsidian-Documents-health. Use AssignCollectionNames when several paths must stay distinguishable.

Types

type Collection

type Collection struct {
	Name         string   `yaml:"name"`
	Path         string   `yaml:"path"`
	Description  string   `yaml:"description,omitempty"`
	Extensions   []string `yaml:"extensions,omitempty"`
	Ignore       []string `yaml:"ignore,omitempty"`
	OriginalName string   `yaml:"-"`
}

type Config

type Config struct {
	DatabasePath string       `yaml:"database_path"`
	Collections  []Collection `yaml:"collections"`
	Providers    Providers    `yaml:"providers"`
	Search       SearchConfig `yaml:"search"`
}

func DefaultConfig

func DefaultConfig() *Config

func Load

func Load(path string) (*Config, error)

type EmbeddingProviderConfig

type EmbeddingProviderConfig struct {
	Name          string `yaml:"name"`
	BaseURL       string `yaml:"base_url"`
	APIKey        string `yaml:"api_key,omitempty"`
	Model         string `yaml:"model"`
	Dimension     int    `yaml:"dimension"`
	BatchSize     int    `yaml:"batch_size,omitempty"`
	MaxInputChars int    `yaml:"max_input_chars,omitempty"`
}

func (*EmbeddingProviderConfig) Fingerprint

func (c *EmbeddingProviderConfig) Fingerprint() string

Fingerprint identifies the provider endpoint and embedding settings that produced a vector. API keys and batching are intentionally excluded.

type Providers

type Providers struct {
	Embedding *EmbeddingProviderConfig `yaml:"embedding,omitempty"`
	Rerank    *RerankProviderConfig    `yaml:"rerank,omitempty"`
}

type RerankProviderConfig added in v0.2.0

type RerankProviderConfig struct {
	Name    string `yaml:"name"`
	BaseURL string `yaml:"base_url"`
	Model   string `yaml:"model"`
}

type SearchConfig

type SearchConfig struct {
	DefaultMode      string   `yaml:"default_mode"`
	BM25TopK         int      `yaml:"bm25_top_k"`
	VectorTopK       int      `yaml:"vector_top_k"`
	RerankTopK       int      `yaml:"rerank_top_k"`
	RRFK             int      `yaml:"rrf_k"`
	ChunkSize        int      `yaml:"chunk_size"`
	ChunkOverlap     int      `yaml:"chunk_overlap"`
	PreferExtensions []string `yaml:"prefer_extensions,omitempty"`
	ExtensionBoost   float64  `yaml:"extension_boost,omitempty"`
}

Jump to

Keyboard shortcuts

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