Spaces:
Paused
Paused
| """Minimal test to verify the agent can load and generate text.""" | |
| from __future__ import annotations | |
| import sys | |
| from pathlib import Path | |
| # Add project root to Python path | |
| project_root = Path(__file__).resolve().parents[1] | |
| if str(project_root) not in sys.path: | |
| sys.path.insert(0, str(project_root)) | |
| from agent.client_llm import Message, NexaSciModelClient | |
| def main() -> None: | |
| """Run a minimal generation test.""" | |
| print("Loading NexaSci model...") | |
| try: | |
| client = NexaSciModelClient() | |
| print("β Model loaded successfully") | |
| except Exception as e: | |
| print(f"β Failed to load model: {e}") | |
| return | |
| print("\nTesting generation with a simple prompt...") | |
| messages = [ | |
| Message(role="user", content="What is 2+2? Answer briefly.") | |
| ] | |
| try: | |
| response = client.generate(messages, max_new_tokens=50) | |
| print(f"β Generation successful!") | |
| print(f"\nResponse: {response}") | |
| except Exception as e: | |
| print(f"β Generation failed: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| if __name__ == "__main__": | |
| main() | |