Category: fruit
Item: apple
Answer: Yes, apple is a fruit.
Now you try:
Category: {category}
Item: {item}
Answer:"""
print("\n--- ONE-SHOT LEARNING ---")
print(f"Response: {generate_response(one_shot, temperature=0.3, max_tokens=1024)}")
# Few-shot example (kept same as your original prompt format)
few_shot = f"""Example 1:
Category: fruit
Item: apple
Answer: Yes, apple is a fruit.
Now you try:
Category: {category}
Item: {item}
Answer:"""
print("\n--- FEW-SHOT LEARNING ---")
print(f"Response: {generate_response(few_shot, temperature=0.3, max_tokens=1024)}")
# Creative task
creative_prompt = f"""Write a one-sentence story about the given word.
Example 1: Word: moon
Story: The moon winked at the lovers as they shared their first kiss.
Word: {item}
Story:"""
print("\n--- CREATIVE FEW-SHOT EXAMPLE ---")
print(f"Response: {generate_response(creative_prompt, temperature=0.7, max_tokens=1024)}")
# Reflection questions
print("\n--- REFLECTION QUESTIONS ---")
print("1. How did the responses differ between zero-shot, one-shot, and few-shot?")
print("2. Which approach gave the most helpful response?")
print("3. How did the examples influence the model's output?")
if __name__ == "__main__":
run_activity()
To embed this project on your website, copy the following code and paste it into your website's HTML: