MCPcopy Create free account
hub / github.com/FareedKhan-dev/ai-long-task / evolve_code

Function evolve_code

api.py:410–428  ·  view source on GitHub ↗

A general-purpose function to evolve an arbitrary code string with a custom evaluator. Args: initial_code: The initial code string to evolve. evaluator: A function that takes a program path and returns a metrics dictionary. iterations: The number of evolution iterat

(
    initial_code: str, evaluator: Callable[[str], Dict[str, Any]], iterations: int = 100, **kwargs
)

Source from the content-addressed store, hash-verified

408
409
410def evolve_code(
411 initial_code: str, evaluator: Callable[[str], Dict[str, Any]], iterations: int = 100, **kwargs
412) -> EvolutionResult:
413 """
414 A general-purpose function to evolve an arbitrary code string with a custom evaluator.
415
416 Args:
417 initial_code: The initial code string to evolve.
418 evaluator: A function that takes a program path and returns a metrics dictionary.
419 iterations: The number of evolution iterations.
420 **kwargs: Additional arguments for `run_evolution`.
421
422 Returns:
423 An EvolutionResult with the optimized code.
424 """
425 # This is a direct wrapper around the main run_evolution function.
426 return run_evolution(
427 initial_program=initial_code, evaluator=evaluator, iterations=iterations, **kwargs
428 )

Callers

nothing calls this directly

Calls 1

run_evolutionFunction · 0.85

Tested by

no test coverage detected