Spaces:
Sleeping
Sleeping
| """π§ͺ Quick Agent Test - Verify build_graph function works""" | |
| import os | |
| os.environ["GOOGLE_API_KEY"] = "AIzaSyDZX6kuggMpFDlMSzCw2bq3hIuQq1bLXe4" | |
| try: | |
| from agent import build_graph, test_agent | |
| from langchain_core.messages import HumanMessage | |
| print("π§ͺ Testing Agent Initialization...") | |
| # Test 1: Build graph with Google provider | |
| print("\n1οΈβ£ Testing build_graph with Google provider...") | |
| try: | |
| graph = build_graph("google") | |
| if graph: | |
| print("β Graph built successfully!") | |
| # Test 2: Simple question | |
| print("\n2οΈβ£ Testing simple question...") | |
| test_question = "What is 15 + 27?" | |
| messages = [HumanMessage(content=test_question)] | |
| result = graph.invoke({"messages": messages}) | |
| if result and "messages" in result and result["messages"]: | |
| answer = result["messages"][-1].content | |
| print(f"Question: {test_question}") | |
| print(f"Answer: {answer}") | |
| print("β Agent working correctly!") | |
| else: | |
| print("β No valid response from agent") | |
| else: | |
| print("β Graph is None - build_graph failed") | |
| except Exception as e: | |
| print(f"β Error during testing: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| print("\nπ― If you see 'β Agent working correctly!' above, the fix is successful!") | |
| print("π€ Deploy this fix to HF Space to resolve the 0% score issue.") | |
| except ImportError as e: | |
| print(f"β Import error: {e}") | |
| print("This might indicate missing dependencies or import issues.") | |