pub struct CapabilityMiddleware<C> { /* private fields */ }Expand description
Middleware created by capability_middleware.
Implementations§
Source§impl<C> CapabilityMiddleware<C>
impl<C> CapabilityMiddleware<C>
Sourcepub fn to_input(
self,
f: impl Fn(&CallOptions, &MiddlewareContext<'_>) -> JsonValue + Send + Sync + 'static,
) -> Self
pub fn to_input( self, f: impl Fn(&CallOptions, &MiddlewareContext<'_>) -> JsonValue + Send + Sync + 'static, ) -> Self
Replaces the default input document.
Sourcepub fn on_error(self, mode: FailureMode) -> Self
pub fn on_error(self, mode: FailureMode) -> Self
Sets the behaviour on evaluation errors (default: remove all tools).
Trait Implementations§
Source§impl<C> Debug for CapabilityMiddleware<C>
impl<C> Debug for CapabilityMiddleware<C>
Source§impl<C: PolicyClient> LanguageModelMiddleware for CapabilityMiddleware<C>
impl<C: PolicyClient> LanguageModelMiddleware for CapabilityMiddleware<C>
Source§fn transform_params<'a>(
&'a self,
options: CallOptions,
ctx: MiddlewareContext<'a>,
) -> BoxFuture<'a, Result<CallOptions, ProviderError>>
fn transform_params<'a>( &'a self, options: CallOptions, ctx: MiddlewareContext<'a>, ) -> BoxFuture<'a, Result<CallOptions, ProviderError>>
Rewrites the call options before the call.
Source§fn wrap_generate<'a>(
&'a self,
options: CallOptions,
next: Box<dyn FnOnce(CallOptions) -> Pin<Box<dyn Future<Output = Result<GenerateResult, ProviderError>> + Send + 'a>> + Send + 'a>,
_ctx: MiddlewareContext<'a>,
) -> Pin<Box<dyn Future<Output = Result<GenerateResult, ProviderError>> + Send + 'a>>
fn wrap_generate<'a>( &'a self, options: CallOptions, next: Box<dyn FnOnce(CallOptions) -> Pin<Box<dyn Future<Output = Result<GenerateResult, ProviderError>> + Send + 'a>> + Send + 'a>, _ctx: MiddlewareContext<'a>, ) -> Pin<Box<dyn Future<Output = Result<GenerateResult, ProviderError>> + Send + 'a>>
Wraps
do_generate.Source§fn wrap_stream<'a>(
&'a self,
options: CallOptions,
next: Box<dyn FnOnce(CallOptions) -> Pin<Box<dyn Future<Output = Result<StreamResult, ProviderError>> + Send + 'a>> + Send + 'a>,
_ctx: MiddlewareContext<'a>,
) -> Pin<Box<dyn Future<Output = Result<StreamResult, ProviderError>> + Send + 'a>>
fn wrap_stream<'a>( &'a self, options: CallOptions, next: Box<dyn FnOnce(CallOptions) -> Pin<Box<dyn Future<Output = Result<StreamResult, ProviderError>> + Send + 'a>> + Send + 'a>, _ctx: MiddlewareContext<'a>, ) -> Pin<Box<dyn Future<Output = Result<StreamResult, ProviderError>> + Send + 'a>>
Wraps
do_stream.Source§fn override_provider(
&self,
_model: &(dyn DynLanguageModel + 'static),
) -> Option<ProviderId>
fn override_provider( &self, _model: &(dyn DynLanguageModel + 'static), ) -> Option<ProviderId>
Overrides the provider id reported by the wrapped model.
Source§fn override_model_id(
&self,
_model: &(dyn DynLanguageModel + 'static),
) -> Option<ModelId>
fn override_model_id( &self, _model: &(dyn DynLanguageModel + 'static), ) -> Option<ModelId>
Overrides the model id reported by the wrapped model.
Source§fn override_supported_urls<'a>(
&'a self,
_model: &'a (dyn DynLanguageModel + 'static),
) -> Option<Pin<Box<dyn Future<Output = SupportedUrls> + Send + 'a>>>
fn override_supported_urls<'a>( &'a self, _model: &'a (dyn DynLanguageModel + 'static), ) -> Option<Pin<Box<dyn Future<Output = SupportedUrls> + Send + 'a>>>
Overrides the supported URLs of the wrapped model.
Auto Trait Implementations§
impl<C> !RefUnwindSafe for CapabilityMiddleware<C>
impl<C> !UnwindSafe for CapabilityMiddleware<C>
impl<C> Freeze for CapabilityMiddleware<C>where
C: Freeze,
impl<C> Send for CapabilityMiddleware<C>where
C: Send,
impl<C> Sync for CapabilityMiddleware<C>where
C: Sync,
impl<C> Unpin for CapabilityMiddleware<C>where
C: Unpin,
impl<C> UnsafeUnpin for CapabilityMiddleware<C>where
C: UnsafeUnpin,
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