dragonllm-finance-models / testing /run_context_tests.py
jeanbaptdzd's picture
feat: Clean deployment to HuggingFace Space with model config test endpoint
8c0b652
#!/usr/bin/env python3
"""
Simple runner for financial context length performance tests.
"""
import asyncio
import sys
from pathlib import Path
# Add the parent directory to the path to import the test module
sys.path.append(str(Path(__file__).parent.parent))
from context_performance_tests import FinancialContextTester
async def main():
"""Run the context length performance tests."""
print("πŸ§ͺ Financial AI Context Length Performance Testing")
print("=" * 50)
# Initialize tester
tester = FinancialContextTester()
try:
# Run tests
analysis = await tester.run_context_length_tests()
# Generate report
report = tester.generate_report(analysis)
# Save report
report_path = Path("testing/results/context_performance_report.md")
report_path.parent.mkdir(parents=True, exist_ok=True)
with open(report_path, 'w') as f:
f.write(report)
print(f"\nβœ… Tests completed successfully!")
print(f"πŸ“„ Report saved to: {report_path}")
# Print key insights
print(f"\nπŸ“Š Key Insights:")
print(f" β€’ 128K context provides {analysis['summary']['average_business_value']:.1%} business value")
print(f" β€’ Average response time: {analysis['summary']['average_response_time']:.2f}s")
print(f" β€’ Analysis completeness: {analysis['summary']['average_completeness']:.1%}")
except Exception as e:
print(f"❌ Test execution failed: {e}")
return 1
return 0
if __name__ == "__main__":
exit_code = asyncio.run(main())
sys.exit(exit_code)