"""Classify prompts with router-laya-v1 using the `laya` package (PyTorch). pip install laya huggingface_hub python predict.py "Write a Rust function that parses ISO 8601 dates" """ import json import sys import laya from huggingface_hub import hf_hub_download REPO = "[org]/router-laya-v1" agent = laya.load(REPO) questions = json.load(open(hf_hub_download(REPO, "questions.json"))) for prompt in sys.argv[1:] or ["hi there", "Prove that the square root of 2 is irrational"]: a = agent.predict(prompt, questions)["answers"] print(f"{a['category']['choice']:<18} complexity={a['complexity']['score']:.2f} {prompt[:60]}")