StringTask¶
evotoolkit.task.string_optimization.StringTask
¶
Bases: BaseTask
Abstract base class for string-based evolutionary optimization tasks.
Unlike PythonTask or CudaTask which evaluate code, StringTask directly evaluates string solutions (e.g., prompts, templates, configurations).
Source code in src/evotoolkit/task/string_optimization/string_task.py
__init__
¶
Initialize the string task with input data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Any
|
Task-specific input data |
required |
timeout_seconds
|
float
|
Execution timeout for evaluation |
30.0
|
Source code in src/evotoolkit/task/string_optimization/string_task.py
get_task_type
¶
evaluate_code
¶
Evaluate a candidate string solution.
Note: For compatibility with the framework, we keep the method name 'evaluate_code', but it actually evaluates strings, not code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
candidate_string
|
str
|
String solution to evaluate |
required |
Returns:
| Name | Type | Description |
|---|---|---|
EvaluationResult |
EvaluationResult
|
Result of the evaluation |