Spaces:
Runtime error
Runtime error
| #!/usr/bin/env python3 | |
| """ | |
| Example usage of the model testing framework. | |
| """ | |
| import os | |
| import sys | |
| from run_tests import TestRunner | |
| def main(): | |
| """Example of how to use the testing framework.""" | |
| # Example 1: Test instruction following | |
| print("🧪 Example 1: Testing Instruction Following") | |
| print("=" * 50) | |
| runner = TestRunner() | |
| # Test against HuggingFace endpoint | |
| hf_endpoint = "https://huggingface.co/spaces/jeanbaptdzd/linguacustodia-financial-api" | |
| # Run instruction tests | |
| results = runner.run_suite( | |
| tester_class=InstructionTester, | |
| suite_name="Instruction Following", | |
| endpoint=hf_endpoint, | |
| model="llama3.1-8b", | |
| use_streaming=False | |
| ) | |
| print(f"Results: {results}") | |
| # Example 2: Test streaming chat completion | |
| print("\n🧪 Example 2: Testing Chat Completion with Streaming") | |
| print("=" * 50) | |
| from suites.chat_completion_test import ChatCompletionTester | |
| chat_results = runner.run_suite( | |
| tester_class=ChatCompletionTester, | |
| suite_name="Chat Completion", | |
| endpoint=hf_endpoint, | |
| model="qwen3-8b", | |
| use_streaming=True | |
| ) | |
| print(f"Chat Results: {chat_results}") | |
| # Example 3: Test JSON structured output | |
| print("\n🧪 Example 3: Testing Structured JSON Output") | |
| print("=" * 50) | |
| from suites.json_structured_test import JSONStructuredTester | |
| json_results = runner.run_suite( | |
| tester_class=JSONStructuredTester, | |
| suite_name="Structured JSON", | |
| endpoint=hf_endpoint, | |
| model="llama3.1-8b", | |
| use_streaming=False | |
| ) | |
| print(f"JSON Results: {json_results}") | |
| # Example 4: Test tool usage | |
| print("\n🧪 Example 4: Testing Tool Usage") | |
| print("=" * 50) | |
| from suites.tool_usage_test import ToolUsageTester | |
| tool_results = runner.run_suite( | |
| tester_class=ToolUsageTester, | |
| suite_name="Tool Usage", | |
| endpoint=hf_endpoint, | |
| model="llama3.1-8b", | |
| use_streaming=False | |
| ) | |
| print(f"Tool Results: {tool_results}") | |
| if __name__ == "__main__": | |
| main() | |