Skip to main content

LlmConfig

Struct LlmConfig 

Source
pub struct LlmConfig {
Show 14 fields pub enabled: bool, pub backend: BackendKind, pub endpoint: Option<String>, pub model: Option<String>, pub api_key: Option<String>, pub api_key_command: Option<Vec<String>>, pub headers: BTreeMap<String, String>, pub protocol: Option<String>, pub reasoning_effort: Option<ReasoningEffort>, pub temperature: Option<f32>, pub max_tokens: Option<u32>, pub timeout_secs: u64, pub max_retries: u32, pub max_concurrent: usize,
}
Expand description

One provider in the failover chain.

deny_unknown_fields because the alternative is what a misspelled key was doing until this attribute arrived: serde dropped it without a word, and a user who wrote [llm.headers] before drep could send one got a config that read as configured and sent nothing. That is the same silent-drop failure ConfigError::SiteOnlyField exists to refuse one file over, and there is no reason for drep.toml to be laxer than the policy file about it.

It is the one pass that does not honour “a disabled entry is inert”, because serde rejects at deserialization and there is no entry yet to skip. So a parked provider carrying a field from a newer drep refuses to load the file rather than being ignored. That is the wanted trade - a typo in a parked entry is still a typo, and the entry is one line from being re-enabled - but it is a deviation from a rule ${VAR} expansion, field validation and credential resolution all keep.

Fields§

§enabled: bool§backend: BackendKind§endpoint: Option<String>§model: Option<String>§api_key: Option<String>§api_key_command: Option<Vec<String>>

An argv - never a shell line - whose trimmed stdout is the credential.

Declared after api_key because the field order is the resolution order: an explicit key wins, then this, then the per-machine store.

§headers: BTreeMap<String, String>

Extra HTTP headers sent with every request to this provider.

For the gateway that identifies its clients by User-Agent, bills against a header, or authenticates outside its protocol’s default scheme. A name that collides with one the protocol sets replaces it, so this can carry an Authorization the SDK’s own scheme would not produce.

A value here can be a credential. A project or tenant token is the ordinary case, which is the whole reason Debug here, LlmClient’s Debug, doctor’s listing and ConfigError::UnusableHeaderValue all print the name and never the value. This is the one place that argument is made; the others cite it.

A BTreeMap rather than a list of pairs, so the rendered config and the doctor listing come out in a stable order. That alone does not make the set unambiguous: two spellings of one name are two map keys and one HTTP header, so ConfigError::DuplicateHeaderName refuses that pair at load rather than letting byte order decide which of them is sent. config::effective_headers overlays what survives on drep’s own defaults to get what is actually sent.

§protocol: Option<String>§reasoning_effort: Option<ReasoningEffort>§temperature: Option<f32>§max_tokens: Option<u32>§timeout_secs: u64§max_retries: u32§max_concurrent: usize

Trait Implementations§

Source§

impl Debug for LlmConfig

Hand-written so the API key cannot reach a log.

Source§

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

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

impl Default for LlmConfig

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for LlmConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. 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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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, 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, <T as TryFrom<U>>::Error>

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