#[non_exhaustive]pub struct ConnectOptions { /* private fields */ }Expand description
How Catalog::connect_with connects: an explicit key and the account
it belongs to, an HTTP client, a protocol family and a base URL. Each one
left unset takes its default: the key from the environment, the shared
reqwest client, the family the catalog row is reached by, and the
dialect’s base URL.
use rig_core::catalog::Catalog;
use rig_core::providers::registry::{ConnectOptions, Format};
let options = ConnectOptions::new().format(Format::Anthropic);
let model = Catalog::builtin().connect_with("zai/glm-5", options)?;Implementations§
Source§impl ConnectOptions
impl ConnectOptions
Sourcepub fn api_key(self, api_key: impl Into<Secret>) -> Self
pub fn api_key(self, api_key: impl Into<Secret>) -> Self
Credential with api_key instead of reading the environment. Only
the key is given: no other variable is read either.
Sourcepub fn account_id(self, account_id: impl Into<String>) -> Self
pub fn account_id(self, account_id: impl Into<String>) -> Self
Name account_id as the account the key belongs to, as a ChatGPT
subscription credential needs (the ChatGPT-Account-Id header).
Only the OpenAI family sends it; the others ignore it.
use rig_core::catalog::Catalog;
use rig_core::providers::registry::ConnectOptions;
let options = ConnectOptions::new().api_key("access-token").account_id("account");
let model = Catalog::builtin().connect_with("chatgpt/gpt-5.5", options)?;Sourcepub fn http(self, http: impl HttpClientExt + 'static) -> Self
pub fn http(self, http: impl HttpClientExt + 'static) -> Self
Send through http instead of the shared reqwest client.
Trait Implementations§
Source§impl Clone for ConnectOptions
impl Clone for ConnectOptions
Source§impl Debug for ConnectOptions
Never shows the key.
impl Debug for ConnectOptions
Never shows the key.
Source§impl Default for ConnectOptions
impl Default for ConnectOptions
Source§impl Provide for ConnectOptions
The vendor’s models connect as Catalog::connect_with connects them
with these options, on their HTTP client, else the shared one, wrapped
by the transport.
impl Provide for ConnectOptions
The vendor’s models connect as Catalog::connect_with connects them
with these options, on their HTTP client, else the shared one, wrapped
by the transport.
Source§fn handler(
&self,
spec: &ModelSpec,
catalog: &Catalog,
transport: &Transport,
) -> Result<ErasedHandler, ConnectError>
fn handler( &self, spec: &ModelSpec, catalog: &Catalog, transport: &Transport, ) -> Result<ErasedHandler, ConnectError>
spec, a model of catalog. A handler that
sends HTTP sends through transport: its shared client, or a client
of its own that it wraps.Auto Trait Implementations§
impl !RefUnwindSafe for ConnectOptions
impl !UnwindSafe for ConnectOptions
impl Freeze for ConnectOptions
impl Send for ConnectOptions
impl Sync for ConnectOptions
impl Unpin for ConnectOptions
impl UnsafeUnpin for ConnectOptions
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,
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