Class swarmauri_core.evaluator_pools.IEvaluatorPool.IEvaluatorPool
swarmauri_core.evaluator_pools.IEvaluatorPool.IEvaluatorPool
Bases: ABC
Interface for evaluator pools that manage sets of evaluators.
This abstract class defines the contract for evaluator pools, providing methods for dynamic registration, execution, and aggregation of evaluators. Pools are responsible for coordinating the evaluation of programs across multiple evaluators and aggregating their results.
initialize
abstractmethod
initialize()
Initialize the evaluator pool and its resources.
This method should be called before using the pool to set up any necessary resources, connections, or state.
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If initialization fails |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
19 20 21 22 23 24 25 26 27 28 29 30 |
|
shutdown
abstractmethod
shutdown()
Shut down the evaluator pool and release its resources.
This method should be called when the pool is no longer needed to clean up resources and ensure proper termination.
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If shutdown fails |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
32 33 34 35 36 37 38 39 40 41 42 43 |
|
add_evaluator
abstractmethod
add_evaluator(evaluator, name=None)
Add an evaluator to the pool.
PARAMETER | DESCRIPTION |
---|---|
evaluator
|
The evaluator to add to the pool
TYPE:
|
name
|
Optional name for the evaluator, if not provided a name will be generated
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The name assigned to the evaluator |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If an evaluator with the same name already exists |
TypeError
|
If the evaluator doesn't implement IEvaluate |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
remove_evaluator
abstractmethod
remove_evaluator(name)
Remove an evaluator from the pool by name.
PARAMETER | DESCRIPTION |
---|---|
name
|
The name of the evaluator to remove
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
bool
|
True if the evaluator was removed, False if it wasn't found |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
63 64 65 66 67 68 69 70 71 72 73 74 |
|
evaluate
abstractmethod
evaluate(programs, **kwargs)
Evaluate all programs with all registered evaluators.
This method runs each program through each evaluator and collects the results.
PARAMETER | DESCRIPTION |
---|---|
programs
|
The programs to evaluate
TYPE:
|
**kwargs
|
Additional parameters to pass to evaluators
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Sequence[IEvalResult]
|
A sequence of evaluation results, one for each program |
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If evaluation fails |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
evaluate_async
abstractmethod
async
evaluate_async(programs, **kwargs)
Asynchronously evaluate all programs with all registered evaluators.
This method runs each program through each evaluator concurrently and collects the results.
PARAMETER | DESCRIPTION |
---|---|
programs
|
The programs to evaluate
TYPE:
|
**kwargs
|
Additional parameters to pass to evaluators
DEFAULT:
|
RETURNS | DESCRIPTION |
---|---|
Sequence[IEvalResult]
|
A sequence of evaluation results, one for each program |
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
If evaluation fails |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
aggregate
abstractmethod
aggregate(scores)
Aggregate multiple scores into a single score.
This method combines multiple evaluation scores into a single scalar value according to the pool's aggregation strategy.
PARAMETER | DESCRIPTION |
---|---|
scores
|
The scores to aggregate
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
float
|
The aggregated score |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If scores is empty or contains invalid values |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
set_aggregation_function
abstractmethod
set_aggregation_function(func)
Set the function used to aggregate scores.
PARAMETER | DESCRIPTION |
---|---|
func
|
A function that takes a sequence of scores and returns an aggregated score
TYPE:
|
RAISES | DESCRIPTION |
---|---|
TypeError
|
If func is not callable or has an invalid signature |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
get_evaluator
abstractmethod
get_evaluator(name)
Get an evaluator by name.
PARAMETER | DESCRIPTION |
---|---|
name
|
The name of the evaluator to retrieve
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[IEvaluate]
|
The evaluator if found, None otherwise |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
150 151 152 153 154 155 156 157 158 159 160 161 |
|
get_evaluator_names
abstractmethod
get_evaluator_names()
Get the names of all registered evaluators.
RETURNS | DESCRIPTION |
---|---|
List[str]
|
A list of evaluator names |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
163 164 165 166 167 168 169 170 171 |
|
get_evaluator_count
abstractmethod
get_evaluator_count()
Get the number of registered evaluators.
RETURNS | DESCRIPTION |
---|---|
int
|
The count of evaluators in the pool |
Source code in swarmauri_core/evaluator_pools/IEvaluatorPool.py
173 174 175 176 177 178 179 180 181 |
|