# define prompt template
prompt_template = """Write a Python function to execute the following task: {task} 
Return only valid Python code. Do not give any explanation.
Never start with ```python.
Always start with def {name}(. 
"""
```

- Step 2: Decide how we evaluate the code generation

Next, we can use `code_eval.compute` to evaluate whether the generated code passes the pre-defined unit tests. `predictions` is a list of generated code outputs from the LLM and `references` is a list of unit tests for each prediction. 

:::warning[ ]
 This code is designed to run code that’s been generated by a model, which may not be entirely reliable. While it's unlikely that the model-generated code will intentionally cause harm, it's strongly recommended to run this evaluation suite in a sandbox environment, isolating it from your main system and network.
:::


```py
from evaluate import load

os.environ["HF_ALLOW_CODE_EVAL"] = "1"
code_eval = load("code_eval")