config

package
v0.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigPath

func GetConfigPath() string

GetConfigPath returns the default config file path

Types

type Config

type Config struct {
	DataDirectory string          `yaml:"data_directory"`
	Database      DatabaseConfig  `yaml:"database"` // SQLite settings
	Search        SearchConfig    `yaml:"search"`   // Optional search
	Vectors       VectorConfig    `yaml:"vectors"`  // Optional vectors
	Embeddings    EmbeddingConfig `yaml:"embeddings"`
}

Config represents the SRAKE configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration

func Load

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

Load loads configuration from a file

func (*Config) EnsureDirectories

func (c *Config) EnsureDirectories() error

EnsureDirectories creates necessary directories

func (*Config) GetOperationalMode

func (c *Config) GetOperationalMode() string

GetOperationalMode returns the operational mode based on config

func (*Config) IsSearchEnabled

func (c *Config) IsSearchEnabled() bool

IsSearchEnabled returns true if search is enabled

func (*Config) IsVectorEnabled

func (c *Config) IsVectorEnabled() bool

IsVectorEnabled returns true if vectors are enabled

func (*Config) Save

func (c *Config) Save(path string) error

Save saves the configuration to a file

type DatabaseConfig

type DatabaseConfig struct {
	Path        string `yaml:"path"`
	CacheSize   int    `yaml:"cache_size"`   // in KB
	MMapSize    int64  `yaml:"mmap_size"`    // in bytes
	JournalMode string `yaml:"journal_mode"` // WAL
}

DatabaseConfig contains SQLite database settings

type EmbeddingConfig

type EmbeddingConfig struct {
	Enabled         bool     `yaml:"enabled"`
	ModelsDirectory string   `yaml:"models_directory"`
	DefaultModel    string   `yaml:"default_model"`    // HuggingFace model path
	DefaultVariant  string   `yaml:"default_variant"`  // quantized, fp16, or default
	BatchSize       int      `yaml:"batch_size"`       // Batch size for embedding
	NumThreads      int      `yaml:"num_threads"`      // ONNX runtime threads
	MaxTextLength   int      `yaml:"max_text_length"`  // Max tokens
	CombineFields   []string `yaml:"combine_fields"`   // Fields to combine for embedding
	CacheEmbeddings bool     `yaml:"cache_embeddings"` // Cache computed embeddings
}

EmbeddingConfig contains embedding settings

type SearchConfig

type SearchConfig struct {
	Enabled        bool   `yaml:"enabled"`          // Enable Bleve search
	Backend        string `yaml:"backend"`          // "bleve" or "sqlite"
	IndexPath      string `yaml:"index_path"`       // Path to Bleve index
	RebuildOnStart bool   `yaml:"rebuild_on_start"` // Rebuild index on startup
	AutoSync       bool   `yaml:"auto_sync"`        // Auto-sync with SQLite
	SyncInterval   int    `yaml:"sync_interval"`    // Sync interval in seconds
	DefaultLimit   int    `yaml:"default_limit"`    // Default result limit
	BatchSize      int    `yaml:"batch_size"`       // Indexing batch size
	UseCache       bool   `yaml:"use_cache"`        // Enable search cache
	CacheTTL       int    `yaml:"cache_ttl"`        // Cache TTL in seconds
}

SearchConfig contains search-related settings

type VectorConfig

type VectorConfig struct {
	Enabled          bool   `yaml:"enabled"`           // Enable vector search
	RequiresSearch   bool   `yaml:"requires_search"`   // Requires search to be enabled
	SimilarityMetric string `yaml:"similarity_metric"` // cosine, dot_product, l2_norm
	UseQuantized     bool   `yaml:"use_quantized"`     // Use INT8 for speed
	Dimensions       int    `yaml:"dimensions"`        // Vector dimensions (768 for SapBERT)
	Optimization     string `yaml:"optimization"`      // memory_efficient, latency, recall
}

VectorConfig contains vector search settings

Jump to

Keyboard shortcuts

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