Skip to main content

RagSettings

Struct RagSettings 

Source
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: String

Workspace folder holding the store and sessions.

§bibliography: String

Bibliography the library and @key resolution use.

Empty means the conventional <workspace>/.ragrig/references.bib.

§provider: ChatProvider

Active 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: f64

Sampling temperature.

§max_tokens: usize

Maximum generated tokens.

§context_tokens: usize

Chat context window in tokens.

§system_prompt: String

Inline system prompt, used when system_prompt_path is empty.

§system_prompt_path: String

Markdown file that overrides the inline prompt; empty uses system_prompt.

§built_in_prompt: String

The 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: bool

Stream tokens into the transcript.

§embed_model: String

Ollama embedding model.

§hybrid: bool

Hybrid retrieval (BM25 + embeddings). Off runs without an embedding model and skips vector search.

§top_k: usize

Chunks retrieved per query.

§similarity_threshold: f64

Minimum similarity for a chunk to enter the prompt.

§chunk_size: usize

Target chunk size in tokens.

§chunk_overlap: usize

Token overlap between chunks.

§pdf_backend: PdfBackend

PDF parser selected as primary.

§sloppy_pdf: bool

Keep the sloppy PDF fallback registered.

§memory: MemoryChoice

Conversation memory strategy.

§memory_model: String

Small model used for rewriting and summaries.

§grobid_source: GrobidSource

Where the GROBID server comes from.

§grobid_url: String

Base URL of the GROBID server.

§grobid_image: String

Docker image used when Self::grobid_source is GrobidSource::Managed.

§rename_pdfs: bool

Rename PDFs to their metadata name during reference extraction.

§openalex: bool

Complete extracted references against OpenAlex.

§resolve_citations: bool

Attach @key papers mentioned in a question as one-shot context.

§corpus_dirs: Vec<String>

Named folder corpora in name=path form.

§profile_name: String

Profile 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

Source

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.

Source

pub fn model_for(&self, provider: ChatProvider) -> &str

The model configured for provider, as stored.

Source

pub fn effective_model(&self) -> &str

The model configured for the active provider, or its default.

Source

pub fn effective_model_for(&self, provider: ChatProvider) -> &str

The model configured for provider, or its default when unset.

Source

pub fn set_model(&mut self, model: impl Into<String>)

Set the model of the active provider.

Source

pub fn set_model_for( &mut self, provider: ChatProvider, model: impl Into<String>, )

Set the model of provider.

Source

pub fn dirty_since(&self, applied: &Self) -> RagChanges

Compare the editable configuration fields with the configuration that is currently running. Profile bookkeeping is ignored.

Source

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

Source

pub fn from_config(config: &RagrigConfig) -> Self

Read the editable fields from a Ragrig configuration.

Source

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.

Source

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.

Source

pub fn to_config(&self) -> Result<RagrigConfig, String>

Validate and convert to a Ragrig configuration.

Source

pub fn prompt_path(&self) -> Option<PathBuf>

The custom prompt file, resolved against the workspace.

Source

pub fn effective_prompt(&self) -> Result<String, String>

The prompt in effect: the selected file, or the inline prompt.

Source

pub fn use_built_in_prompt(&mut self)

Clear the prompt file and restore the host’s compiled-in prompt.

Source

pub fn to_setup(&self) -> Result<RagSetup, String>

Validate and produce a build setup, including the prompt override.

Source

pub fn validate(&self) -> Result<(), String>

Check the editable values without touching the filesystem.

Source

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.

Source

pub fn save_profile(&mut self) -> Result<(), String>

Save these settings as a named profile in the workspace.

Source

pub fn load_profile(&mut self, name: &str) -> Result<(), String>

Load a named profile from the workspace, then from ~/.ragrig.

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RagSettings

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RagSettings

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for RagSettings

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RagSettings

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> NoneValue for T
where T: Default,

Source§

type NoneType = T

Source§

fn null_value() -> T

The none-equivalent value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WasmCompatSend for T
where T: Send,

Source§

impl<T> WasmCompatSync for T
where T: Sync,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more