pub struct PluginV2Chain { /* private fields */ }Expand description
Ordered list of Plugins executed sequentially on each request/response.
Plugins run in insertion order. If any on_request hook returns
Err(PluginError::RequestRejected), the chain stops and the error is
propagated. on_response errors are collected but do not short-circuit
the remaining response plugins.
Implementations§
Source§impl PluginV2Chain
impl PluginV2Chain
Sourcepub fn run_request(&self, req: &mut PromptRequest) -> Result<(), PluginError>
pub fn run_request(&self, req: &mut PromptRequest) -> Result<(), PluginError>
Run on_request for all plugins in order.
Stops at the first RequestRejected error.
Sourcepub fn run_response(&self, resp: &mut Vec<String>) -> Result<(), PluginError>
pub fn run_response(&self, resp: &mut Vec<String>) -> Result<(), PluginError>
Run on_response for all plugins in order.
Continues even if individual plugins return an error (errors are returned at the end as the last encountered error).
Trait Implementations§
Source§impl Default for PluginV2Chain
impl Default for PluginV2Chain
Source§fn default() -> PluginV2Chain
fn default() -> PluginV2Chain
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for PluginV2Chain
impl !UnwindSafe for PluginV2Chain
impl Freeze for PluginV2Chain
impl Send for PluginV2Chain
impl Sync for PluginV2Chain
impl Unpin for PluginV2Chain
impl UnsafeUnpin for PluginV2Chain
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§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>
Wrap the input message
T in a tonic::Request