pub struct CodeInjectionEvaluator { /* private fields */ }Expand description
Code-injection detector evaluated against the user prompt (prompt:
code_injection_v0).
Implementations§
Source§impl CodeInjectionEvaluator
impl CodeInjectionEvaluator
Sourcepub fn new(config: JudgeEvaluatorConfig) -> Self
pub fn new(config: JudgeEvaluatorConfig) -> Self
Construct with the supplied judge config, explicitly
defaulting the aggregator to crate::AllPass when no
override is configured (data-model §3 safety family).
Sourcepub fn with_prompt(self, template: Arc<dyn JudgePromptTemplate>) -> Self
pub fn with_prompt(self, template: Arc<dyn JudgePromptTemplate>) -> Self
Override the prompt template used by this evaluator.
Sourcepub fn with_few_shot(self, examples: Vec<FewShotExample>) -> Self
pub fn with_few_shot(self, examples: Vec<FewShotExample>) -> Self
Attach evaluator-level few-shot examples that render before any case-level examples.
Sourcepub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_system_prompt(self, prompt: impl Into<String>) -> Self
Override the system prompt visible to the template render.
Sourcepub fn with_output_schema(self, schema: Value) -> Self
pub fn with_output_schema(self, schema: Value) -> Self
Attach an output schema for custom prompt templates.
Sourcepub fn with_use_reasoning(self, flag: bool) -> Self
pub fn with_use_reasoning(self, flag: bool) -> Self
Toggle judge reasoning capture.
Sourcepub fn with_feedback_key(self, key: impl Into<String>) -> Self
pub fn with_feedback_key(self, key: impl Into<String>) -> Self
Override the feedback key used by downstream exporters.
Sourcepub const fn config(&self) -> &JudgeEvaluatorConfig
pub const fn config(&self) -> &JudgeEvaluatorConfig
Borrow the underlying config.
Trait Implementations§
Source§impl Evaluator for CodeInjectionEvaluator
impl Evaluator for CodeInjectionEvaluator
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
Unique name for this evaluator, used in
EvalCase::evaluators filters.Source§fn evaluate(
&self,
case: &EvalCase,
invocation: &Invocation,
) -> Option<EvalMetricResult>
fn evaluate( &self, case: &EvalCase, invocation: &Invocation, ) -> Option<EvalMetricResult>
Score the actual invocation against the expected case. Read more
Source§impl JudgeEvaluatorBuilder for CodeInjectionEvaluator
impl JudgeEvaluatorBuilder for CodeInjectionEvaluator
Source§fn judge_config_mut(&mut self) -> &mut JudgeEvaluatorConfig
fn judge_config_mut(&mut self) -> &mut JudgeEvaluatorConfig
Borrow the evaluator’s underlying
JudgeEvaluatorConfig for
mutation by the default builder methods.Source§fn with_prompt(self, template: Arc<dyn JudgePromptTemplate>) -> Self
fn with_prompt(self, template: Arc<dyn JudgePromptTemplate>) -> Self
Override the built-in prompt template.
Source§fn with_few_shot(self, examples: Vec<FewShotExample>) -> Self
fn with_few_shot(self, examples: Vec<FewShotExample>) -> Self
Attach few-shot examples.
Source§fn with_system_prompt(self, prompt: impl Into<String>) -> Self
fn with_system_prompt(self, prompt: impl Into<String>) -> Self
Override the system prompt applied ahead of the rendered prompt.
Source§fn with_output_schema(self, schema: Value) -> Self
fn with_output_schema(self, schema: Value) -> Self
Override the output-schema identifier used by structured-output
evaluators.
Source§fn with_use_reasoning(self, flag: bool) -> Self
fn with_use_reasoning(self, flag: bool) -> Self
Toggle the
use_reasoning flag.Source§fn with_feedback_key(self, key: impl Into<String>) -> Self
fn with_feedback_key(self, key: impl Into<String>) -> Self
Override the feedback key forwarded to telemetry / reporter backends.
Source§fn with_aggregator(self, aggregator: Arc<dyn Aggregator>) -> Self
fn with_aggregator(self, aggregator: Arc<dyn Aggregator>) -> Self
Override the aggregator applied to per-sample judge scores.
Auto Trait Implementations§
impl Freeze for CodeInjectionEvaluator
impl !RefUnwindSafe for CodeInjectionEvaluator
impl Send for CodeInjectionEvaluator
impl Sync for CodeInjectionEvaluator
impl Unpin for CodeInjectionEvaluator
impl UnsafeUnpin for CodeInjectionEvaluator
impl !UnwindSafe for CodeInjectionEvaluator
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