pub struct ModelRef {
pub provider: String,
pub model: String,
pub max_tokens: Option<u32>,
pub max_input_tokens: Option<u32>,
pub reasoning_effort: Option<ReasoningEffort>,
pub reasoning_summary: bool,
pub compaction: Option<Compaction>,
pub pricing: Option<Pricing>,
}Expand description
One model, named the way a provider names it.
Fields§
§provider: StringThe driver: anthropic, openai, or whatever an embedder registered.
Not an enum. This crate does not own the set of providers, and a closed enum here would make adding a driver a breaking change to the manifest format for everyone who never used it.
model: StringThe provider’s own model identifier, pinned exactly.
max_tokens: Option<u32>A per-call output ceiling, if this role needs one.
max_input_tokens: Option<u32>A per-call input ceiling: the most tokens one call may send, cached ones included.
Output is bounded before the call, because max_tokens is sent to the
provider; input is not — it grows with the conversation — so this is
checked against what the provider reports, and a call that sent more
fails. With max_tokens and pricing it states what one call can
cost, which is what a tenant’s spend quota reserves beside the run’s
ceiling: under a quota a role without it leaves that figure unbounded
and the run is refused.
reasoning_effort: Option<ReasoningEffort>Explicit reasoning depth. Omitted uses the selected model’s default.
reasoning_summary: boolAsk for a readable summary of the model’s reasoning beside each answer.
Shown on the completion and in the live stream; never the provider’s
signed or encrypted reasoning. A driver whose wire cannot ask —
chat-completions, bedrock — sends nothing and returns none.
compaction: Option<Compaction>Ask the provider to compact the conversation once a call’s input
reaches trigger_tokens, optionally under summary instructions.
anthropic (at least 50 000) and openai (no instructions) compact;
every other driver refuses the call. Must be below max_input_tokens
when both are declared.
pricing: Option<Pricing>What this model’s tokens cost, in minor units per million tokens.
Required on every declared role when budgets.max_minor_units is set:
an unpriced call reports no money, and a money ceiling beside one is a
control that never binds. There is no built-in price table — rates
change, and the deployment is the party that knows its contract.
Implementations§
Source§impl ModelRef
impl ModelRef
Sourcepub fn new(provider: impl Into<String>, model: impl Into<String>) -> Self
pub fn new(provider: impl Into<String>, model: impl Into<String>) -> Self
A role naming only its driver and model, as YAML gives one that names only those.
Sourcepub fn call_bound(&self) -> Option<Spend>
pub fn call_bound(&self) -> Option<Spend>
The most one call through this role can report, when the declaration
bounds it: max_input_tokens plus the output ceiling in tokens, and
those tokens at the declared price in money.
The output ceiling is max_tokens, or the default every call is sent
with when the role names none — either way the figure the provider is
told. Input is priced at the dearest of the input, cache-read and
cache-write rates, because which of them a call’s input lands in is the
provider’s decision, not the declaration’s. An unpriced role reports no
money, so its money figure is zero.
None when max_input_tokens is absent: input grows with the
conversation, and nothing else bounds it.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ModelRef
impl<'de> Deserialize<'de> for ModelRef
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ModelRef
Source§impl JsonSchema for ModelRef
impl JsonSchema for ModelRef
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for ModelRef
Auto Trait Implementations§
impl Freeze for ModelRef
impl RefUnwindSafe for ModelRef
impl Send for ModelRef
impl Sync for ModelRef
impl Unpin for ModelRef
impl UnsafeUnpin for ModelRef
impl UnwindSafe for ModelRef
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more