Spaces:
Sleeping
Sleeping
| """Smoke test for Modal-backed LLM.""" | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).parent.parent)) | |
| from models.llm import MiniCPMLLM | |
| def main(): | |
| print("Calling Modal LLM (first call may take ~1 min for cold start)...") | |
| llm = MiniCPMLLM() | |
| tokens = list( | |
| llm.stream_answer( | |
| "What is EBITDA?", | |
| "EBITDA stands for Earnings Before Interest, Taxes, Depreciation, and Amortization.", | |
| ) | |
| ) | |
| answer = "".join(tokens) | |
| print(f"Answer: {answer[:200]}...") | |
| assert len(answer) > 0, "LLM returned empty response" | |
| print("Modal LLM test passed.") | |
| if __name__ == "__main__": | |
| main() | |