"""Test the GAIA agent on a single question.""" import os import argparse from dotenv import load_dotenv from gaia_agent import GAIAAgent def test_single_question(question: str, provider: str = "groq"): """Test the GAIA agent on a single question. Args: question: The question to test provider: The model provider to use """ # Load environment variables load_dotenv() # Check for required API keys if provider == "groq" and not os.getenv("GROQ_API_KEY"): print("Warning: GROQ_API_KEY not found, defaulting to Google provider") provider = "google" if provider == "google" and not os.getenv("GOOGLE_API_KEY"): print("Warning: GOOGLE_API_KEY not found, please set it in the .env file") return # Initialize the agent try: agent = GAIAAgent(provider=provider) print(f"Initialized agent with provider: {provider}") except Exception as e: print(f"Error initializing agent: {e}") return # Run the agent on the question print(f"Testing question: {question}") try: answer = agent.run(question) print(f"Answer: {answer}") except Exception as e: print(f"Error running agent: {e}") def main(): """Main function.""" parser = argparse.ArgumentParser(description="Test the GAIA agent on a single question") parser.add_argument("question", type=str, help="The question to test") parser.add_argument("--provider", type=str, default="groq", choices=["groq", "google", "anthropic", "openai"], help="The model provider to use") args = parser.parse_args() test_single_question(args.question, args.provider) if __name__ == "__main__": main()