nip.code_validation.dataset_generation._generate_buggy_solutions

nip.code_validation.dataset_generation._generate_buggy_solutions#

nip.code_validation.dataset_generation._generate_buggy_solutions(results: ListProxy, datum: list[str, Any], model: str, system_prompt: str, max_modifications: int, max_attempts: int | None = None) ListProxy[source]#

Generate buggy solutions for a given datum and append them to the result list.

If an exception is raised during the process, a list containing None is appended to the result list.

Parameters:
  • results (ListProxy[list[str | None]]) – A list proxy to store the buggy solutions.

  • datum (list[str, Any]) – The corresponding datum from the original APPS dataset.

  • model (str) – The model to use for generating buggy solutions.

  • system_prompt (str) – The system prompt to provide context to the model.

  • max_modifications (int) – The maximum number of solutions to modify.

  • max_attempts (int, optional) – The maximum number of attempts to generate a valid buggy solution, default is None.

Returns:

results (ListProxy[list[str | None]]) – The list proxy with the buggy solutions appended.