File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change @@ -450,40 +450,6 @@ evaluators:
450450- ShortName # Instead of VeryLongDescriptiveEvaluatorName
451451` ` `
452452
453- ## Advanced: Custom Serialization
454-
455- Override serialization behavior for complex types:
456-
457- ` ` ` python
458- from dataclasses import dataclass
459- from typing import Any
460-
461- from pydantic_evals.evaluators import Evaluator, EvaluatorContext
462-
463-
464- @dataclass
465- class ComplexEvaluator(Evaluator) :
466- # Field with complex type
467- config : dict[str, Any]
468-
469- def build_serialization_arguments(self) -> dict[str, Any] :
470- " " " Customize how this evaluator is serialized." " "
471- # Only serialize non-default values
472- args = super().build_serialization_arguments()
473-
474- # Add custom logic
475- if 'config' in args :
476- args['config'] = {
477- k : v for k, v in args['config'].items()
478- if v is not None
479- }
480-
481- return args
482-
483- def evaluate(self, ctx : EvaluatorContext) -> bool:
484- return True
485- ` ` `
486-
487453## Troubleshooting
488454
489455### Schema Not Found in IDE
You can’t perform that action at this time.
0 commit comments