pub struct CustomProviderConfig {
pub name: String,
pub label: Option<String>,
pub url: String,
pub api_key: Option<String>,
pub api_key_source: Option<String>,
pub format: ProviderRequestFormat,
pub headers: BTreeMap<String, String>,
pub prefix: Option<String>,
}Expand description
A declarative definition of a model provider
Fields§
§name: StringThe name of the provider, as referenced in proxy requests
label: Option<String>A human-readable name for the provider
url: StringThe url to use
api_key: Option<String>The API token to pass along
api_key_source: Option<String>Where to retrieve the value for api_key.
If api_key_source is “env” then api_key is an environment variable.
If it is empty, then api_key is assumed to be the token itself, if provided.
In the future the key sources will be pluggable, to support external secret sources.
format: ProviderRequestFormatWhat kind of request format this provider uses. Defaults to OpenAI-compatible
headers: BTreeMap<String, String>Extra headers to pass with the request
prefix: Option<String>Models starting with this prefix will use this provider by default.
Implementations§
Source§impl CustomProviderConfig
impl CustomProviderConfig
Sourcepub fn into_provider(self, client: Client) -> CustomProvider
pub fn into_provider(self, client: Client) -> CustomProvider
Generate a CustomProvider object from the configuration
Sourcepub fn with_token_or_env(self, token: Option<String>, env: &str) -> Self
pub fn with_token_or_env(self, token: Option<String>, env: &str) -> Self
Add an API token to the CustomProviderConfig, or if one is not provided, then configure it to read from the given environment variable.
Trait Implementations§
Source§impl Clone for CustomProviderConfig
impl Clone for CustomProviderConfig
Source§fn clone(&self) -> CustomProviderConfig
fn clone(&self) -> CustomProviderConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CustomProviderConfig
impl Debug for CustomProviderConfig
Source§impl<'de> Deserialize<'de> for CustomProviderConfig
impl<'de> Deserialize<'de> for CustomProviderConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for CustomProviderConfig
impl RefUnwindSafe for CustomProviderConfig
impl Send for CustomProviderConfig
impl Sync for CustomProviderConfig
impl Unpin for CustomProviderConfig
impl UnwindSafe for CustomProviderConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request