Skip to main content

SignIn

Trait SignIn 

Source
pub trait SignIn:
    WasmCompatSend
    + WasmCompatSync
    + 'static {
    // Required methods
    fn handler(
        &self,
        spec: &ModelSpec,
        transport: &Transport,
    ) -> Option<Result<ErasedHandler, ConnectError>>;
    fn plan(&self, spec: &ModelSpec) -> Option<&'static str>;

    // Provided method
    fn offers(&self, _spec: &ModelSpec, _transport: &Transport) -> ModelStatus { ... }
}
Expand description

A way to reach catalog models no key is set for, such as a subscription plan signed in to. A Connector asks it for a model only when the provider registered for the model’s vendor, else the environment, has no key for it.

Required Methods§

Source

fn handler( &self, spec: &ModelSpec, transport: &Transport, ) -> Option<Result<ErasedHandler, ConnectError>>

The handler serving spec with the signed-in credential, or None when this sign-in does not serve spec now. A handler that sends HTTP sends through transport.

Source

fn plan(&self, spec: &ModelSpec) -> Option<&'static str>

The name of the subscription plan through which this sign-in would serve spec, such as "ChatGPT", whether or not the user is signed in; for model pickers.

Provided Methods§

Source

fn offers(&self, _spec: &ModelSpec, _transport: &Transport) -> ModelStatus

Whether the signed-in account offers spec. Asked only for a model this sign-in serves. Must answer at once without blocking; return ModelStatus::Checking while finding out.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§