INNER CODE UNIT · Python

prepare_instructions

KodCode-AI/kodcode · pipeline/step1.3_process_and_sanitize.py:259

def prepare_instructions(input_file, output_file, language):
    """
    Prepares instructions by formatting them with prompts for response generation.
    """
    print(f"Preparing instructions from {input_file}")
    with open(input_file, 'r') as f, open(output_file, 'w') as outf:
        for line in tqdm(f, desc="Preparing Instructions"):
            data = json.loads(line)
            result = {
                "messages": [
                    {
                        "role": "user", 
                        "content": get_prompt(data["instruction"], language)
                    }
                ],
                "metadata": {
                    **data["metadata"],
                    "instruction": data["instruction"]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…