# ==========================================
# CELL 11: QUICK TEST INFERENCE
# ==========================================
# Run this AFTER cell_09 (or cell_10). Tests if your trained model works.

# Pick a test question
test_question = "What does Charaka say about the qualities of a good physician in Sutrasthana?"

# Alternative questions to try:
# test_question = "Translate this shloka: अथातो दीर्घञ्जीवितीयमध्यायं व्याख्यास्यामः"
# test_question = "What are the heat-alleviating herbs mentioned in Sutrasthana chapter 3?"
# test_question = "What is the chapter on longevity about?"

messages = [
    {"role": "user", "content": test_question}
]

print(f"Question: {test_question}\n")
print("Generating answer...")

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    return_tensors="pt",
    add_generation_prompt=True
).to("cuda")

outputs = model.generate(
    inputs,
    max_new_tokens=512,
    temperature=0.7,
    top_p=0.9,
    do_sample=True,
)

response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print("=" * 60)
print("RESPONSE:")
print("=" * 60)
print(response)
print("=" * 60)
