pub struct GuardrailPipeline { /* private fields */ }Expand description
前処理および後処理ガードレールパイプライン。
Implementations§
Source§impl GuardrailPipeline
impl GuardrailPipeline
Sourcepub fn new(config: GuardrailConfig) -> Self
pub fn new(config: GuardrailConfig) -> Self
新規 GuardrailPipeline を生成する。
Sourcepub fn config(&self) -> &GuardrailConfig
pub fn config(&self) -> &GuardrailConfig
設定への参照を取得する。
Sourcepub fn process(
&self,
req: &mut SystemOneRequest,
ref_time: Option<DateTime<Utc>>,
) -> Result<PreprocessReport, ServerError>
pub fn process( &self, req: &mut SystemOneRequest, ref_time: Option<DateTime<Utc>>, ) -> Result<PreprocessReport, ServerError>
Sourcepub fn post_process(
&self,
answers: &mut IndexMap<String, Answer>,
original_questions: &IndexMap<String, Question>,
)
pub fn post_process( &self, answers: &mut IndexMap<String, Answer>, original_questions: &IndexMap<String, Question>, )
推論完了後のレスポンス (Answer 群) に対し、後処理ガードレールを適用する。
§処理内容
- 二峰性 (バイモーダル) 分布検出: Score 型の回答において意見二極化を検知した場合、Gating を
ConfirmOrEscalateへ強制降格する。 - Score 型レスポンスキーの非破壊復元: 前処理サニタイズで剥離されたプレフィックスを持つ元のラベル名に
probabilitiesのマップキーを復元し、クライアント API 破壊を防止する。
Trait Implementations§
Source§impl Clone for GuardrailPipeline
impl Clone for GuardrailPipeline
Source§fn clone(&self) -> GuardrailPipeline
fn clone(&self) -> GuardrailPipeline
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GuardrailPipeline
impl RefUnwindSafe for GuardrailPipeline
impl Send for GuardrailPipeline
impl Sync for GuardrailPipeline
impl Unpin for GuardrailPipeline
impl UnsafeUnpin for GuardrailPipeline
impl UnwindSafe for GuardrailPipeline
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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