pub struct Endpoint {
pub base_url: String,
pub model: String,
pub api_key: Option<String>,
}Expand description
What the environment says to talk to.
BASE_URL_ENV wins outright. Failing that, QWEN_BASE_URL_ENV picks
Qwen Cloud, with its own key and model variables. Failing both, the
default endpoint, which needs a key.
Fields§
§base_url: StringWhere /chat/completions is appended.
model: StringThe model id.
api_key: Option<String>The bearer token, when the endpoint needs one.
Implementations§
Source§impl Endpoint
impl Endpoint
Sourcepub fn from_env() -> Result<Self, MissingApiKey>
pub fn from_env() -> Result<Self, MissingApiKey>
Reads the endpoint, model and key from the environment.
§Errors
MissingApiKey when the endpoint chosen is a hosted one and no key
was set for it. A custom BASE_URL_ENV is taken to mean a server the
caller runs, so a missing key there is not an error.
Trait Implementations§
impl Eq for Endpoint
impl StructuralPartialEq for Endpoint
Auto Trait Implementations§
impl Freeze for Endpoint
impl RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnsafeUnpin for Endpoint
impl UnwindSafe for Endpoint
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.