pub struct ProxyRequestOptions {
pub model: Option<String>,
pub provider: Option<String>,
pub override_url: Option<String>,
pub api_key: Option<String>,
pub models: Vec<ModelAndProvider>,
pub random_choice: Option<bool>,
pub timeout: Option<Duration>,
pub retry: Option<RetryOptions>,
pub metadata: ProxyRequestMetadata,
pub internal_metadata: ProxyRequestInternalMetadata,
}
Fields§
§model: Option<String>
Override the model from the request body or select an alias. This can also be set by passing the x-chronicle-model HTTP header.
provider: Option<String>
Choose a specific provider to use. This can also be set by passing the x-chronicle-provider HTTP header.
override_url: Option<String>
Force the provider to use a specific URL instead of its default. This can also be set by passing the x-chronicle-override-url HTTP header.
api_key: Option<String>
An API key to pass to the provider. This can also be set by passing the x-chronicle-provider-api-key HTTP header.
models: Vec<ModelAndProvider>
Supply multiple provider/model choices, which will be tried in order.
If this is provided, the model
, provider
, and api_key
fields are ignored.
This field can not reference model aliases.
This can also be set by passing the x-chronicle-models HTTP header using JSON syntax.
random_choice: Option<bool>
When using models
to supply multiple choices, start at a random choice instead of the
first one.
This can also be set by passing the x-chronicle-random-choice HTTP header.
timeout: Option<Duration>
Customize the proxy’s timeout when waiting for the request. This can also be set by passing the x-chronicle-timeout HTTP header.
retry: Option<RetryOptions>
Customize the retry behavior. This can also be set by passing the x-chronicle-retry HTTP header.
metadata: ProxyRequestMetadata
Metadata to record for the request
internal_metadata: ProxyRequestInternalMetadata
Internal user authentication metadata for the request. This can be useful if you have a
different set of internal users and organizations than what gets recorded in metadata
.
Implementations§
Source§impl ProxyRequestOptions
impl ProxyRequestOptions
pub fn merge_request_headers( &mut self, headers: &HeaderMap, ) -> Result<(), Report<Error>>
Sourcepub fn merge_from(&mut self, other: &Self)
pub fn merge_from(&mut self, other: &Self)
Merge values from other
, when the values in the current object are not set.
Trait Implementations§
Source§impl Debug for ProxyRequestOptions
impl Debug for ProxyRequestOptions
Source§impl Default for ProxyRequestOptions
impl Default for ProxyRequestOptions
Source§fn default() -> ProxyRequestOptions
fn default() -> ProxyRequestOptions
Source§impl<'de> Deserialize<'de> for ProxyRequestOptions
impl<'de> Deserialize<'de> for ProxyRequestOptions
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 ProxyRequestOptions
impl RefUnwindSafe for ProxyRequestOptions
impl Send for ProxyRequestOptions
impl Sync for ProxyRequestOptions
impl Unpin for ProxyRequestOptions
impl UnwindSafe for ProxyRequestOptions
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> 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