Final_Assignment_Template / test_agent.py
naclfish
Add tools/ folder, fix agent answer format and Wikipedia proxy
2628a0b
raw
history blame contribute delete
890 Bytes
"""
Quick test script to debug a single question without launching Gradio.
Usage: python test_agent.py
"""
import os
import json
from dotenv import load_dotenv
load_dotenv()
from app import BasicAgent
from tools.file_handler import prefetch_file
agent = BasicAgent()
# --- Edit these to test any question ---
task_id = "test-task-id" # replace with real task_id if needed
question = 'If we reverse the word "tfel", what is the antonym of the result?'
# ----------------------------------------
file_content = prefetch_file(task_id)
if file_content:
full_question = f"{question}\n\n[Attached file content]:\n{file_content}"
print(f"[File found and attached, length={len(file_content)}]")
else:
full_question = question
print("[No file attachment]")
print(f"\nQuestion: {full_question[:200]}\n")
answer = agent(full_question)
print(f"\n=== Final Answer ===\n{answer}")