def toy_sentiment_model(prompt: str) -> str:
    """A deliberately simple rule-based stand-in for a real LLM
    call, so this example runs offline without any API key --
    it looks for a few sentiment-bearing words, correctly
    classifying most examples but making realistic mistakes on
    ambiguous ones, similar to a real model's error pattern."""
    text = prompt.split("Input:")[-1].lower()
    positive_words = ["great", "love", "excellent", "amazing", "good"]
    negative_words = ["bad", "terrible", "hate", "awful", "poor"]
    pos_hits = sum(w in text for w in positive_words)
    neg_hits = sum(w in text for w in negative_words)
    if pos_hits > neg_hits:
        return "positive"
    if neg_hits > pos_hits:
        return "negative"
    return "neutral"


if __name__ == "__main__":
    examples = [
        EvalExample("This movie was great and I loved it.", "positive"),
        EvalExample("Terrible service, would not recommend.", "negative"),
        EvalExample("It was okay, nothing special.", "neutral"),
        EvalExample("Amazing performance, truly excellent!", "positive"),
        EvalExample("Poor quality, very disappointed.", "negative"),
    ]

    zero_shot_template = (
        "Classify the sentiment as positive, negative, or "
        "neutral.\nInput: {input}\nSentiment:"
    )
    few_shot_template = (
        "Classify sentiment as positive, negative, or neutral.\n"
        "Input: I really enjoyed this.\nSentiment: positive\n"
        "Input: This was a waste of time.\nSentiment: negative\n"
        "Input: {input}\nSentiment:"
    )

    zero_shot_results = evaluate_prompt_template(
        zero_shot_template, examples, toy_sentiment_model
    )
    few_shot_results = evaluate_prompt_template(
        few_shot_template, examples, toy_sentiment_model
    )

    print("Zero-shot mean score:", zero_shot_results["mean_score"])
    print("Few-shot mean score: ", few_shot_results["mean_score"])

    schema_check = validate_json_schema(
        '{"sentiment": "positive", "confidence": 0.9}',
        required_keys=["sentiment", "confidence"],
    )
    print("Structured output valid:", schema_check)
