config

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func AddCollection added in v0.4.0

func AddCollection(configPath string, col Collection) error

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

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 added in v0.4.0

func RemoveCollection(configPath string, name string) error

RemoveCollection removes a named 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 RenameCollection added in v0.5.0

func RenameCollection(configPath, oldName, newName string) error

RenameCollection changes the name of an existing collection in the config file at configPath. It performs a single read-modify-write so there is no window where the old entry has been deleted but the new entry has not yet been written.

func SlugFromPath added in v0.5.0

func SlugFromPath(path string) string

SlugFromPath returns a URL-safe slug derived from the last component of path.

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"`
}

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"`
}

type GenerationProviderConfig

type GenerationProviderConfig struct {
	Name    string `yaml:"name"`
	BaseURL string `yaml:"base_url"`
	Model   string `yaml:"model"`
	APIKey  string `yaml:"api_key,omitempty"`
}

type Providers

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

type RerankProviderConfig

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"`
}

Jump to

Keyboard shortcuts

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