Nexa_Labs / examples /simple_test.py
Allanatrix's picture
Upload 57 files
d8328bf verified
"""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()