Struct chronicle_proxy::Proxy 
source · pub struct Proxy { /* private fields */ }Implementations§
source§impl Proxy
 
impl Proxy
pub fn builder() -> ProxyBuilder
sourcepub async fn send(
    &self,
    options: ProxyRequestOptions,
    body: ChatRequest
) -> Result<ProxiedChatResponse, Report<Error>>
 
pub async fn send( &self, options: ProxyRequestOptions, body: ChatRequest ) -> Result<ProxiedChatResponse, Report<Error>>
Send a request, choosing the provider based on the requested model and provider.
options.models can be used to specify a list of models and providers to use.
options.model will be used next to choose a model to use. This and body[“model”] can be
an alias name.
options.provider can be used to choose a specific provider if the model is not an alias.
body["model"] is used if options.model is empty.
sourcepub fn set_provider(&self, provider: Arc<dyn ChatModelProvider>)
 
pub fn set_provider(&self, provider: Arc<dyn ChatModelProvider>)
Add a provider to the system. This will replace any existing provider with the same name.
sourcepub fn remove_provider(&self, name: &str)
 
pub fn remove_provider(&self, name: &str)
Remove a provider. Any aliases that reference this provider’s name will stop working.
sourcepub fn set_alias(&self, alias: AliasConfig)
 
pub fn set_alias(&self, alias: AliasConfig)
Add an alias to the system. This will replace any existing alias with the same name.
sourcepub fn remove_alias(&self, name: &str)
 
pub fn remove_alias(&self, name: &str)
Remove an alias
sourcepub fn set_api_key(&self, api_key: ApiKeyConfig)
 
pub fn set_api_key(&self, api_key: ApiKeyConfig)
Add an API key to the system. This will replace any existing API key with the same name.
sourcepub fn remove_api_key(&self, name: &str)
 
pub fn remove_api_key(&self, name: &str)
Remove an API key. Any aliases that reference this API key’s name will stop working.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Proxy
impl !RefUnwindSafe for Proxy
impl Send for Proxy
impl Sync for Proxy
impl Unpin for Proxy
impl !UnwindSafe for Proxy
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> 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