def build_prompt()

in prompts/web_samples/build_web_prompts.py [0:0]


def build_prompt(x, style="textbook_academic"):
    """Build the prompt based on the generation type"""
    # web extract and topic
    web_sample = x["examples"]
    web_sample = web_sample[:min(EXTRACT_SIZE, len(web_sample))]
    topic = x["category"]
    add_topic = f', within the context of "{topic}"' if random.random() < 0.5 else ""
    # requested generation style
    prompt = STYLES[style].replace("<ADD_TOPIC>", add_topic).replace("<INSERT_EXTRACT>", web_sample)
    return {f"prompt_{style}": prompt}