Patronus Objects
client_async
AsyncPatronus
Source code in src/patronus/pat_client/client_async.py
evaluate
async
evaluate(
evaluators: Union[List[Evaluator], Evaluator],
*,
system_prompt: Optional[str] = None,
task_context: Union[list[str], str, None] = None,
task_input: Optional[str] = None,
task_output: Optional[str] = None,
gold_answer: Optional[str] = None,
task_metadata: Optional[dict] = None,
return_exceptions: bool = False,
) -> EvaluationContainer
Run multiple evaluators in parallel.
Source code in src/patronus/pat_client/client_async.py
evaluate_bg
evaluate_bg(
evaluators: Union[List[Evaluator], Evaluator],
*,
system_prompt: Optional[str] = None,
task_context: Union[list[str], str, None] = None,
task_input: Optional[str] = None,
task_output: Optional[str] = None,
gold_answer: Optional[str] = None,
task_metadata: Optional[dict] = None,
) -> Task[EvaluationContainer]
Run multiple evaluators in parallel. The returned task will be a background task.
Source code in src/patronus/pat_client/client_async.py
close
async
Gracefully close the client. This will wait for all background tasks to finish.
client_sync
Patronus
Source code in src/patronus/pat_client/client_sync.py
evaluate
evaluate(
evaluators: Union[list[Evaluator], Evaluator],
*,
system_prompt: Optional[str] = None,
task_context: Union[list[str], str, None] = None,
task_input: Optional[str] = None,
task_output: Optional[str] = None,
gold_answer: Optional[str] = None,
task_metadata: Optional[dict[str, Any]] = None,
return_exceptions: bool = False,
) -> EvaluationContainer
Run multiple evaluators in parallel.
Source code in src/patronus/pat_client/client_sync.py
evaluate_bg
evaluate_bg(
evaluators: list[StructuredEvaluator],
*,
system_prompt: Optional[str] = None,
task_context: Union[list[str], str, None] = None,
task_input: Optional[str] = None,
task_output: Optional[str] = None,
gold_answer: Optional[str] = None,
task_metadata: Optional[dict[str, Any]] = None,
) -> TypedAsyncResult[EvaluationContainer]
Run multiple evaluators in parallel. The returned task will be a background task.
Source code in src/patronus/pat_client/client_sync.py
close
Gracefully close the client. This will wait for all background tasks to finish.
container
EvaluationContainer
dataclass
format
Format the evaluation results into a readable summary.
Source code in src/patronus/pat_client/container.py
pretty_print
Formats and prints the current object in a human-readable form.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file
|
Optional[IO]
|
|
None
|
has_exception
raise_on_exception
Checks the results for any exceptions and raises them accordingly.
Source code in src/patronus/pat_client/container.py
all_succeeded
Check if all evaluations that were actually evaluated passed.
Evaluations are only considered if they: - Have a non-None pass_ flag set - Are not None (skipped) - Are not exceptions (unless ignore_exceptions=True)
Note: Returns True if no evaluations met the above criteria (empty case).
Source code in src/patronus/pat_client/container.py
any_failed
Check if any evaluation that was actually evaluated failed.
Evaluations are only considered if they: - Have a non-None pass_ flag set - Are not None (skipped) - Are not exceptions (unless ignore_exceptions=True)
Note: Returns False if no evaluations met the above criteria (empty case).
Source code in src/patronus/pat_client/container.py
failed_evaluations
Generates all failed evaluations from the results.
Source code in src/patronus/pat_client/container.py
succeeded_evaluations
Generates all successfully passed evaluations from the results
attribute.