Skip to main content

ModelEntry

Enum ModelEntry 

Source
pub enum ModelEntry {
    Id(String),
    Detailed {
        id: String,
        name: Option<String>,
        context_window: Option<u64>,
        max_output_tokens: Option<u64>,
        thinking_format: Option<ThinkingFormat>,
    },
}
Expand description

A model candidate configuration declaration.

TOML supports two forms (accepted via Deserialize with untagged):

  • Plain string "gpt-5.5": only the id is given; the UI display name falls back to the id.
  • Table { id = "...", name = "Opus 4.8" }: pairs a long id with a short display name.

name is mapped to defect_agent::llm::ModelInfo::display_name; the ACP uses it as the label for model selector options. When None, the wire layer falls back to the id.

context_window / max_output_tokens let the user declare model metadata that the provider cannot discover at runtime — most importantly for Bedrock, whose SDK does not return model limits, so without this the compaction watermarks have no window to key off and the context can grow unbounded. Both are optional; when absent the provider’s own value (if any) or the compaction fallback applies.

Variants§

§

Id(String)

A plain ID (legacy format).

§

Detailed

A detailed entry with a display name and optional limits.

Fields

§context_window: Option<u64>
§max_output_tokens: Option<u64>
§thinking_format: Option<ThinkingFormat>

How extended thinking is serialized on the Anthropic Messages wire for this model. Defaults to ThinkingFormat::Adaptive — the format newer models (Opus 4.6+, Sonnet 4.6, Fable) require. Set to ThinkingFormat::Legacy for older models (Sonnet 4.5, Haiku 4.5, …) that only accept the thinking.type=enabled + budget_tokens shape and reject adaptive / output_config.effort. Ignored by the OpenAI-compatible protocol.

Implementations§

Source§

impl ModelEntry

Source

pub fn id(&self) -> &str

The model ID (present in both variants).

Source

pub fn name(&self) -> Option<&str>

Optional display name (only available in table form).

Source

pub fn context_window(&self) -> Option<u64>

Optional context-window size (tokens), only from the table form.

Source

pub fn max_output_tokens(&self) -> Option<u64>

Optional max output tokens, only from the table form.

Source

pub fn thinking_format(&self) -> Option<ThinkingFormat>

Optional thinking wire format override, only from the table form.

Trait Implementations§

Source§

impl Clone for ModelEntry

Source§

fn clone(&self) -> ModelEntry

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 ModelEntry

Source§

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

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

impl<'de> Deserialize<'de> for ModelEntry

Source§

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

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for ModelEntry

Source§

fn eq(&self, other: &ModelEntry) -> 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 ModelEntry

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

Source§

impl<T> IntoOption<T> for T

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