Skip to main content

SamplingLayers

Struct SamplingLayers 

Source
pub struct SamplingLayers {
    pub cli_override: Option<InferenceConfig>,
    pub profile: Option<InferenceConfig>,
    pub global: Option<InferenceConfig>,
    pub trust_client_sampling: bool,
}
Expand description

The sampling layers that sit below the client’s own request parameters.

Grouped because they are only ever used together, at the single point where resolve_sampling folds them through InferenceConfig::resolve_layers.

The per-model layer is deliberately absent: it arrives with the rest of the per-model facts, as ModelContext::inference_defaults, so no caller has to look the model up twice. The client’s own parameters are absent for a different reason — they are read back out of the request body itself, which is what lets one function serve a proxy forwarding an arbitrary client payload and an adapter that built the body from a typed config.

Fields§

§cli_override: Option<InferenceConfig>

Operator-supplied overrides from the process’s own command line (gglib proxy --temperature …), applied above the client’s request parameters.

Above the client deliberately: this is the person running the server stating what the server does, which cannot be true if any client can silently outrank it. These previously merged into Self::global, which sits below the per-model layer — so on any model with stored inference_defaults the flags did nothing at all.

§profile: Option<InferenceConfig>

The profile the request selected via {model}:{profile}, if any. Sparse — see crate::domain::inference_profile.

§global: Option<InferenceConfig>

Global defaults from settings.

§trust_client_sampling: bool

Whether the client’s own sampling parameters are honoured at all. From Settings.trust_client_sampling. false (the default) drops everything the client sent except max_tokens — see the field doc on Settings for why. This is read from the same settings snapshot as Self::global, which is why it lives here rather than as a separate parameter threaded through every caller.

Trait Implementations§

Source§

impl Clone for SamplingLayers

Source§

fn clone(&self) -> SamplingLayers

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 SamplingLayers

Source§

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

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

impl Default for SamplingLayers

Source§

fn default() -> SamplingLayers

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

impl PartialEq for SamplingLayers

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SamplingLayers

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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