pub struct RagSettings {Show 31 fields
pub workspace: String,
pub bibliography: String,
pub provider: ChatProvider,
pub models: BTreeMap<ChatProvider, String>,
pub temperature: f64,
pub max_tokens: usize,
pub context_tokens: usize,
pub system_prompt: String,
pub system_prompt_path: String,
pub built_in_prompt: String,
pub stream: bool,
pub embed_model: String,
pub hybrid: bool,
pub top_k: usize,
pub similarity_threshold: f64,
pub chunk_size: usize,
pub chunk_overlap: usize,
pub pdf_backend: PdfBackend,
pub sloppy_pdf: bool,
pub memory: MemoryChoice,
pub memory_model: String,
pub grobid_source: GrobidSource,
pub grobid_url: String,
pub grobid_image: String,
pub rename_pdfs: bool,
pub openalex: bool,
pub resolve_citations: bool,
pub corpus_dirs: Vec<String>,
pub profile_name: String,
pub profiles: Vec<String>,
pub status: Option<String>,
}Expand description
Editable configuration shown by the settings page.
This mirrors the Ragrig fields a chat surface exposes. Secrets never enter this struct: cloud API keys are read from the environment by the worker.
Fields§
§workspace: StringWorkspace folder holding the store and sessions.
bibliography: StringBibliography the library and @key resolution use.
Empty means the conventional <workspace>/.ragrig/references.bib.
provider: ChatProviderActive chat backend.
models: BTreeMap<ChatProvider, String>Chat model per provider.
Every provider keeps its own model, so switching backends does not
carry a model name into an incompatible API. Missing entries use
ChatProvider::default_model when the configuration is built.
temperature: f64Sampling temperature.
max_tokens: usizeMaximum generated tokens.
context_tokens: usizeChat context window in tokens.
system_prompt: StringInline system prompt, used when system_prompt_path is empty.
system_prompt_path: StringMarkdown file that overrides the inline prompt; empty uses
system_prompt.
built_in_prompt: StringThe prompt the host compiles in.
Hosts set this after loading their settings; Use built-in and profile defaults restore it. It is not written to profiles and is ignored by dirty tracking.
stream: boolStream tokens into the transcript.
embed_model: StringOllama embedding model.
hybrid: boolHybrid retrieval (BM25 + embeddings). Off runs without an embedding model and skips vector search.
top_k: usizeChunks retrieved per query.
similarity_threshold: f64Minimum similarity for a chunk to enter the prompt.
chunk_size: usizeTarget chunk size in tokens.
chunk_overlap: usizeToken overlap between chunks.
pdf_backend: PdfBackendPDF parser selected as primary.
sloppy_pdf: boolKeep the sloppy PDF fallback registered.
memory: MemoryChoiceConversation memory strategy.
memory_model: StringSmall model used for rewriting and summaries.
grobid_source: GrobidSourceWhere the GROBID server comes from.
grobid_url: StringBase URL of the GROBID server.
grobid_image: StringDocker image used when Self::grobid_source is GrobidSource::Managed.
rename_pdfs: boolRename PDFs to their metadata name during reference extraction.
openalex: boolComplete extracted references against OpenAlex.
resolve_citations: boolAttach @key papers mentioned in a question as one-shot context.
corpus_dirs: Vec<String>Named folder corpora in name=path form.
profile_name: StringProfile name typed by the user.
profiles: Vec<String>Profiles found in the workspace.
status: Option<String>Last settings action result, shown under the Apply row.
Implementations§
Source§impl RagSettings
impl RagSettings
Sourcepub fn model(&self) -> &str
pub fn model(&self) -> &str
The model configured for the active provider.
The value is returned as stored, so an edited field can be empty while
the user types. Self::effective_model applies the provider default.
Sourcepub fn model_for(&self, provider: ChatProvider) -> &str
pub fn model_for(&self, provider: ChatProvider) -> &str
The model configured for provider, as stored.
Sourcepub fn effective_model(&self) -> &str
pub fn effective_model(&self) -> &str
The model configured for the active provider, or its default.
Sourcepub fn effective_model_for(&self, provider: ChatProvider) -> &str
pub fn effective_model_for(&self, provider: ChatProvider) -> &str
The model configured for provider, or its default when unset.
Sourcepub fn set_model_for(
&mut self,
provider: ChatProvider,
model: impl Into<String>,
)
pub fn set_model_for( &mut self, provider: ChatProvider, model: impl Into<String>, )
Set the model of provider.
Sourcepub fn dirty_since(&self, applied: &Self) -> RagChanges
pub fn dirty_since(&self, applied: &Self) -> RagChanges
Compare the editable configuration fields with the configuration that is currently running. Profile bookkeeping is ignored.
Sourcepub fn reset_to_profile_defaults(&mut self) -> Result<(), String>
pub fn reset_to_profile_defaults(&mut self) -> Result<(), String>
Reset the editable fields to the defaults of the last chosen profile.
With no profile selected, the compiled defaults are used while keeping the workspace, bibliography, and profile bookkeeping so the library location is not lost.
Source§impl RagSettings
impl RagSettings
Sourcepub fn from_config(config: &RagrigConfig) -> Self
pub fn from_config(config: &RagrigConfig) -> Self
Read the editable fields from a Ragrig configuration.
Sourcepub fn from_layers(workspace: &Path) -> Option<Self>
pub fn from_layers(workspace: &Path) -> Option<Self>
Read ~/.ragrig/config.json and <workspace>/.ragrig/config.json as
partial configurations and merge them over the built-in defaults.
The merge is per setting: a key missing from a higher layer keeps the
value from the layer below, so a workspace only states what it
changes. Returns None when neither file exists.
Sourcepub fn from_layers_over(workspace: &Path, base: &Self) -> Option<Self>
pub fn from_layers_over(workspace: &Path, base: &Self) -> Option<Self>
Like Self::from_layers, but keeps the runtime memory and hybrid
switches from base when no layer mentions them.
The status-bar switches live in settings.json as well as the
workspace layer; this prevents a layer that only sets, say, the chat
model from resetting them to their defaults.
Sourcepub fn to_config(&self) -> Result<RagrigConfig, String>
pub fn to_config(&self) -> Result<RagrigConfig, String>
Validate and convert to a Ragrig configuration.
Sourcepub fn prompt_path(&self) -> Option<PathBuf>
pub fn prompt_path(&self) -> Option<PathBuf>
The custom prompt file, resolved against the workspace.
Sourcepub fn effective_prompt(&self) -> Result<String, String>
pub fn effective_prompt(&self) -> Result<String, String>
The prompt in effect: the selected file, or the inline prompt.
Sourcepub fn use_built_in_prompt(&mut self)
pub fn use_built_in_prompt(&mut self)
Clear the prompt file and restore the host’s compiled-in prompt.
Sourcepub fn to_setup(&self) -> Result<RagSetup, String>
pub fn to_setup(&self) -> Result<RagSetup, String>
Validate and produce a build setup, including the prompt override.
Sourcepub fn validate(&self) -> Result<(), String>
pub fn validate(&self) -> Result<(), String>
Check the editable values without touching the filesystem.
Sourcepub fn refresh_profiles(&mut self)
pub fn refresh_profiles(&mut self)
Re-read the profile list from the workspace and ~/.ragrig.
Workspace profiles shadow global profiles with the same name.
Sourcepub fn save_profile(&mut self) -> Result<(), String>
pub fn save_profile(&mut self) -> Result<(), String>
Save these settings as a named profile in the workspace.
Sourcepub fn load_profile(&mut self, name: &str) -> Result<(), String>
pub fn load_profile(&mut self, name: &str) -> Result<(), String>
Load a named profile from the workspace, then from ~/.ragrig.
Sourcepub fn add_corpus(&mut self, name: &str, folder: &Path)
pub fn add_corpus(&mut self, name: &str, folder: &Path)
Remember a folder corpus so later applies keep it.
Trait Implementations§
Source§impl Clone for RagSettings
impl Clone for RagSettings
Source§impl Debug for RagSettings
impl Debug for RagSettings
Source§impl Default for RagSettings
impl Default for RagSettings
Source§impl PartialEq for RagSettings
impl PartialEq for RagSettings
impl StructuralPartialEq for RagSettings
Auto Trait Implementations§
impl Freeze for RagSettings
impl RefUnwindSafe for RagSettings
impl Send for RagSettings
impl Sync for RagSettings
impl Unpin for RagSettings
impl UnsafeUnpin for RagSettings
impl UnwindSafe for RagSettings
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().