Skip to main content

Config

Struct Config 

Source
pub struct Config {
Show 29 fields pub default_model: String, pub default_embedding_model: String, pub default_image_model: String, pub default_judgment_model: String, pub default_speech_model: String, pub default_transcription_model: String, pub default_moderation_model: String, pub default_ocr_model: String, pub default_video_model: String, pub video_generation_timeout: Duration, pub video_generation_poll_interval: Duration, pub request_timeout: Duration, pub max_retries: u32, pub retry_interval: f64, pub retry_backoff_factor: f64, pub retry_interval_randomness: f64, pub retry_max_interval: f64, pub http_proxy: Option<String>, pub tool_concurrency: bool, pub auto_upload_large_files: bool, pub instrumenter: Option<Arc<dyn Instrumenter>>, pub model_registry_file: Option<PathBuf>, pub model_registry_store: Option<Arc<dyn ModelRegistryStore>>, pub prompt_roots: Vec<PathBuf>, pub mcp_credential_store: Option<Arc<dyn CredentialStore>>, pub mcp_client_name: String, pub mcp_client_id: Option<String>, pub batch_store: Option<Arc<dyn BatchStore>>, pub usage_ledger: Option<Arc<dyn UsageLedger>>, /* private fields */
}
Expand description

RubyLLM::Configuration. Provider keys live in values under RubyLLM’s option names (openai_api_key, anthropic_api_base, …) so every provider reads its settings the same way.

Fields§

§default_model: String§default_embedding_model: String§default_image_model: String

default_image_model: the model rust_llm::paint uses when none is given.

§default_judgment_model: String

default_judgment_model: what judge uses; judges never fall back to the chat model.

§default_speech_model: String

default_speech_model: what rust_llm::speak uses when no model is given.

§default_transcription_model: String

default_transcription_model: what rust_llm::transcribe uses when no model is given.

§default_moderation_model: String

default_moderation_model: what rust_llm::moderate uses when no model is given.

§default_ocr_model: String

default_ocr_model: what rust_llm::ocr uses when no model is given.

§default_video_model: String

default_video_model: what rust_llm::animate uses when no model is given.

§video_generation_timeout: Duration

video_generation_timeout: how long VideoJob::wait polls before giving up.

§video_generation_poll_interval: Duration

video_generation_poll_interval: the pause between VideoJob::wait polls.

§request_timeout: Duration§max_retries: u32§retry_interval: f64§retry_backoff_factor: f64§retry_interval_randomness: f64§retry_max_interval: f64§http_proxy: Option<String>

http_proxy: proxy URL for every request (Connection.basic and provider connections).

§tool_concurrency: bool§auto_upload_large_files: bool

auto_upload_large_files: upload oversized local attachments to the provider’s Files API.

§instrumenter: Option<Arc<dyn Instrumenter>>

instrumenter: receives every *.rust_llm event (rust_llm::instrumentation).

§model_registry_file: Option<PathBuf>

model_registry_file: where Models::refresh saves the registry and where the registry loads from before falling back to the bundled copy. None keeps it in memory only.

§model_registry_store: Option<Arc<dyn ModelRegistryStore>>

model_registry_store: where the registry lives instead of model_registry_file, such as an application’s database (rust_llm::models::registry::ModelRegistryStore).

§prompt_roots: Vec<PathBuf>

Prompt.roots: the directories render_prompt searches after app/prompts, in order.

§mcp_credential_store: Option<Arc<dyn CredentialStore>>

mcp_credential_store: where MCP OAuth credentials live. None keeps them in memory; rust_llm_loco::McpCredentialStore keeps them in rust_llm_mcp_credentials.

§mcp_client_name: String

mcp_client_name: the client name given when registering with an MCP server’s authorization server. RubyLLM says "RubyLLM"; the port says "RustLLM".

§mcp_client_id: Option<String>

mcp_client_id: the HTTPS URL of your OAuth client metadata document, used instead of registering by authorization servers that support client ID metadata documents.

§batch_store: Option<Arc<dyn BatchStore>>

batch_store: where submitted chat batches are persisted, so Batch::find can hand one back without contacting the provider. None keeps nothing (crate::batch::BatchStore).

§usage_ledger: Option<Arc<dyn UsageLedger>>

Accounting::Usage.ledger: where attempts no chat records are persisted (one-shot operations, finished video jobs, chats without a record). None keeps them in memory (crate::accounting::UsageLedger).

Implementations§

Source§

impl Config

Source

pub fn from_env() -> Config

Defaults plus any OPENAI_API_KEY-style variables present in the environment.

Source

pub fn get(&self, option: &str) -> Option<&str>

Source

pub fn set( &mut self, option: impl Into<String>, value: impl Into<String>, ) -> &mut Self

Source

pub fn openai_api_key(&mut self, v: impl Into<String>) -> &mut Self

Source

pub fn anthropic_api_key(&mut self, v: impl Into<String>) -> &mut Self

Source

pub fn gemini_api_key(&mut self, v: impl Into<String>) -> &mut Self

Source

pub fn deepseek_api_key(&mut self, v: impl Into<String>) -> &mut Self

Source

pub fn openrouter_api_key(&mut self, v: impl Into<String>) -> &mut Self

Source

pub fn ollama_api_base(&mut self, v: impl Into<String>) -> &mut Self

Trait Implementations§

Source§

impl Clone for Config

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 Config

Configuration#inspect: credentials never reach logs or error output. Like RubyLLM, options ending in _id, _key, _secret, _token, or _credential_provider are left out entirely.

Source§

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

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

impl Default for Config

Source§

fn default() -> Self

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

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> 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> 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<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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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