Skip to main content

ProviderChoice

Struct ProviderChoice 

Source
pub struct ProviderChoice {
    pub tag: String,
    pub pick: Pick,
}
Expand description

The provider and what a profile of AccountKind::Provider runs on: the person’s own tag from the Providers page, and either one of that provider’s models or one of its lineups.

The tag is kept as the text it was written with rather than a checked crate::provider::Tag: a profile is read long after the provider it names may have been removed, and a tag the file cannot make sense of any more is still worth showing back to the person as the reason nothing starts, not a reason to lose the rest of the profile.

Fields§

§tag: String

The provider’s tag, as the Providers page names it.

§pick: Pick

What the tab asks for: a model, or a lineup of the provider’s own models.

Implementations§

Source§

impl ProviderChoice

Source

pub fn model(tag: impl Into<String>, id: impl Into<String>) -> Self

A profile that runs on one model of tag, the way every profile before a lineup existed is written.

Source

pub fn lineup(tag: impl Into<String>, name: impl Into<String>) -> Self

A profile that runs on the lineup name of tag, whose steps the relay asks in order.

Source

pub fn asked(&self) -> &str

The name a harness is told to ask for: the model’s own, or the lineup’s, which the relay turns into that lineup’s steps. A harness is told one name whatever it runs on, so the name is the choice the person made rather than a step of it they never saw.

Source

pub fn environment( &self, harness: HarnessKind, token: &str, window: Option<u64>, ) -> Vec<(String, String)>

The environment a tab of harness on this provider is started with, so the harness speaks to the workspace’s relay at http://127.0.0.1:<crate::provider::relay::PORT> instead of the provider’s own address, asking for ProviderChoice::asked. Empty for a harness that is not offered a provider of one’s own.

window is what QCode measured this server really gives for that model, when it has been measured: the harness is told that rather than left to assume its own models’ room.

token is the tab’s own bridge token, carried again rather than a second one minted for it: the relay resolves a tab’s provider entry by the very token crate::bridge::TOKEN_VARIABLE already carries, and the harness needs some non-empty value here to send a request at all, never the provider’s real key — that never leaves this machine’s own process.

Source

pub fn arguments(&self, harness: HarnessKind) -> Vec<String>

The arguments a tab of harness on this provider is started with, right after the program, for a harness that is told of a provider on its command line rather than in its environment. Empty for every other harness.

Codex is the one: it reads a provider of one’s own only from its configuration, which -c sets for one run, and nothing of it is a secret. The provider is named qcode, asked at the relay’s /v1 in the Responses shape, and sends as its key the variable that already holds the tab’s token (crate::bridge::TOKEN_VARIABLE). Its web search is turned off: that tool is one OpenAI’s own servers run, and a provider that is not OpenAI refuses the whole request for naming it (MiMo, measured: “tool type ‘web_search’ is not supported”).

Source

pub fn endpoint(wire: Wire) -> String

The address a harness inside the container is given for this provider in shape wire: always the workspace’s relay, written the way a client of that shape expects its base — the bare address for the Anthropic shape, which clients follow with /v1/messages, and /v1 for the OpenAI one, which clients follow with /chat/completions. Where the provider really answers that shape, and which header its key goes in, is the relay’s to know; a harness is only ever told this address.

Trait Implementations§

Source§

impl Clone for ProviderChoice

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 ProviderChoice

Source§

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

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

impl Eq for ProviderChoice

Source§

impl PartialEq for ProviderChoice

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ProviderChoice

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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