CoolFace
Apppublic

SolusOps/Study-with-ChampAI

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
quest_agent.py20 linesDownload Raw Back to agents
1from __future__ import annotations2import json3from typing import List, Any4from quiz.models import Quest5from services.model_router import ModelRouter6from services.json_parser import extract_json7from config.prompts import QUEST_AGENT_SYSTEM8 9class QuestAgent:10    def __init__(self, router: ModelRouter): self._router = router11 12    def generate(self, concepts: Any) -> List[Quest]:13        raw = self._router.reason(f"Generate quests from:\n{json.dumps(concepts)}", QUEST_AGENT_SYSTEM)14        try:15            data = extract_json(raw)16        except ValueError as exc:17            raise ValueError(f"QuestAgent: {exc}") from exc18        return [Quest(name=q["name"], topics=q.get("topics",[]), boss_topic=q.get("boss_topic",""),19                      difficulty=q.get("difficulty","medium")) for q in data.get("quests",[])]20