# Install dependencies:
# pip install ollama
# Install Ollama locally and run: ollama pull llama3.2
#
# Reflection loop for a travel plan: generate, critique, and improve.

import ollama

model = "llama3.2"
user_query = "Create a practical 2-day Hyderabad trip plan for a first-time visitor."

initial = ollama.chat(
    model=model,
    messages=[{"role": "user", "content": user_query}],
)["message"]["content"].strip()

print("=" * 60)
print("INITIAL TRIP PLAN")
print("=" * 60)
print(initial)

reflection_prompt = f"""
You are a travel-planning reflection agent.
Review this proposed plan:
{initial}

Provide:
1. Strengths
2. Weaknesses or missing details
3. Whether the timing is realistic
4. Whether the order of places is efficient
5. Missing information (transport, opening hours, cost, meals)
6. Concrete suggestions
7. An improved 2-day Hyderabad plan

Do not claim live opening hours or prices have been verified.
"""
improved = ollama.chat(
    model=model,
    messages=[{"role": "user", "content": reflection_prompt}],
)["message"]["content"].strip()

print("\n" + "=" * 60)
print("REFLECTION AND IMPROVED PLAN")
print("=" * 60)
print(improved)
