Function signature
RuntimeError.
Parameters set to None are omitted from the configuration and fall back to Zvec’s internal defaults, which may be derived from the runtime environment (e.g., cgroup CPU/memory limits). Explicitly provided values always override defaults.
Parameters
Logging configuration
Logger destination.
LogType.CONSOLE(default if omitted or set to this)LogType.FILE
None, uses internal default (currently CONSOLE).Minimum log severity. Accepted values:
DEBUG, INFO, WARN, ERROR, FATAL.If None, uses internal default (WARN).Directory for log files (only used when
log_type=FILE).Parent directories are not created automatically. If None, internal default is used.Base name for rotated log files (e.g.,
zvec.log.1, zvec.log.2).Max size per log file in MB before rotation. Default: 2048 MB (2 GB).
Days to retain rotated log files before deletion.
Thread configuration
Number of threads for query execution.If
None (default), inferred from available CPU cores (via cgroup). Must be ≥ 1 if provided.Threads for background tasks (e.g., compaction, indexing).If
None, defaults to same as query_threads or CPU count.Query optimization
Threshold to switch from inverted index to full forward scan.Range: [0.0, 1.0]. Higher → more aggressive index skipping. Default: 0.9 (if omitted).
Threshold to use brute-force key lookup over index.Lower → prefer index; higher → prefer brute-force. Range: [0.0, 1.0]. Default: 0.1.
Memory configuration
Soft memory cap in MB. Zvec may throttle or fail operations approaching this limit.If
None, inferred from cgroup memory limit × 0.8 (e.g., in Docker). Must be > 0 if provided.Return value
ReturnsNone.
Exceptions
RuntimeError: If Zvec is already initialized.ValueError: On invalid values (e.g., negative thread count, log level out of range).TypeError: If a value has incorrect type (e.g., string forquery_threads).
Examples
Initialize with defaults
Log to console and auto-detect resources:Customize logging to file
With rotation settings:Limit resources explicitly
Set memory and thread limits:Fine-tune query heuristics
Customize query optimization thresholds:Notes
- All
Nonearguments are excluded from the configuration payload, allowing the core library to apply environment-aware defaults. - This design ensures container-friendliness: in Kubernetes/Docker, omitting
memory_limit_mband thread counts lets Zvec auto-adapt. - In containerized environments, Zvec automatically detects cgroup limits for optimal resource utilization.