pub struct RagrigConfig {
pub workspace: PathBuf,
pub chat: ChatConfig,
pub embed: EmbedConfig,
pub parse: ParseConfig,
pub memory: MemoryConfig,
pub corpus_dirs: Vec<String>,
pub corpus_urls: Vec<String>,
pub semantic_scholar_api_key: Option<String>,
}Expand description
Top-level configuration for a ragrig session.
Composes ChatConfig, EmbedConfig, ParseConfig, and
MemoryConfig into a single format-agnostic tree. Serde support
enables JSON/TOML profile files; the CLI binary converts clap
arguments into this struct via From.
§Entry points
// 1. From CLI (binary only)
let config = RagrigConfig::from(Cli::parse());
// 2. From a profile file (TOML / JSON)
let config: RagrigConfig = toml::from_str(&fs::read_to_string("profile.toml")?)?;
// 3. Programmatic construction
let config = RagrigConfig {
workspace: "./workspace".into(),
..Default::default()
};Fields§
§workspace: PathBufWorkspace directory holding the vector store (.ragrig_store),
history, sessions, and profiles. Not a document corpus by itself —
documents come from corpus_dirs and
corpus_urls. Deserialised from "folder"
in older profiles.
chat: ChatConfigChat / generation settings.
embed: EmbedConfigEmbedding / search settings.
parse: ParseConfigDocument parsing and chunking settings.
memory: MemoryConfigMemory / query-rewrite settings.
corpus_dirs: Vec<String>Named directory corpora in name=path form (repeatable
--corpus-dir). Deserialised from "source_dirs" in older profiles.
corpus_urls: Vec<String>Named URL corpora in name=url form (repeatable --corpus-urls;
repeating a name accumulates URLs into one curated list).
Deserialised from "source_urls" in older profiles.
semantic_scholar_api_key: Option<String>Semantic Scholar API key for higher rate limits (free). See https://www.semanticscholar.org/product/api#api-key-form for a key.
Implementations§
Source§impl RagrigConfig
impl RagrigConfig
Sourcepub fn from_toml(src: &str) -> Result<Self>
pub fn from_toml(src: &str) -> Result<Self>
Parse a RagrigConfig from a TOML document (file contents or an
inline string). Missing sub-tables and fields fall back to the
library defaults.
Sourcepub fn from_json(src: &str) -> Result<Self>
pub fn from_json(src: &str) -> Result<Self>
Parse a RagrigConfig from a JSON document. Missing sub-tables
and fields fall back to the library defaults.
Sourcepub fn override_with(&mut self, cli: &RagrigConfig)
pub fn override_with(&mut self, cli: &RagrigConfig)
Merge cli overrides on top of this config (typically loaded from a profile).
Fields where cli equals RagrigConfig::default() are left untouched —
they were not explicitly set by the user. Only explicitly-changed fields
from the CLI override the profile base.
Sourcepub fn profiles_dir(folder: &Path) -> PathBuf
pub fn profiles_dir(folder: &Path) -> PathBuf
Directory where profile JSON files live for a given document folder.
Sourcepub fn save_to_profile(&self, folder: &Path, name: &str) -> Result<(), Error>
pub fn save_to_profile(&self, folder: &Path, name: &str) -> Result<(), Error>
Save this config as a named profile under folder.
Creates .ragrig/profiles/<name>.json. The workspace field of
the config is not written — profiles are portable across
machines; the caller’s folder argument (the workspace) is what
counts and is supplied again at load time.
Sourcepub fn load_from_profile(folder: &Path, name: &str) -> Result<Self, Error>
pub fn load_from_profile(folder: &Path, name: &str) -> Result<Self, Error>
Load a named profile from .ragrig/profiles/<name>.json.
The caller’s folder (the workspace) is authoritative: a workspace
value written into the file by an older version is ignored, so a
profile copied from another machine can never re-point the workspace.
Trait Implementations§
Source§impl Clone for RagrigConfig
impl Clone for RagrigConfig
Source§impl Debug for RagrigConfig
impl Debug for RagrigConfig
Source§impl Default for RagrigConfig
impl Default for RagrigConfig
Source§impl<'de> Deserialize<'de> for RagrigConfig
impl<'de> Deserialize<'de> for RagrigConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for RagrigConfig
impl RefUnwindSafe for RagrigConfig
impl Send for RagrigConfig
impl Sync for RagrigConfig
impl Unpin for RagrigConfig
impl UnsafeUnpin for RagrigConfig
impl UnwindSafe for RagrigConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more