from jev import ask NOTES = ("Rohit Ghumare's essays and guides: AI agents and harnesses, coding agents, MCP and A2A, " "LLM inference engines and hardware, model guides (DeepSeek, Qwen, GLM, Kimi, Llama, Gemma, " "Mistral), evals, AI engineering careers, and AI industry news analysis. Written through " "October 2026, including hands-on tests of new models, APIs, and launches.") QUESTIONS = { "intent": { "type": "choice", "instructions": "What should the assistant do with `message`, given that it can search `notes`?", "criteria": { "answer_from_my_notes": "A question about AI models, APIs, agents, tools, benchmarks, prices, protocols, or hardware that the notes could cover, even if the topic is recent.", "small_talk": "A greeting, thanks, or chit-chat that needs no information.", "needs_live_web": "Needs real-time data that changes by the hour or day and has nothing to do with the notes: weather, stock or crypto prices, sports scores, traffic.", "ambiguous_ask_back": "Too vague to answer without asking the user what they mean.", }, }, "needs_retrieval": { "type": "noul", "instructions": "Does answering `message` require looking up facts in `notes`?", "criteria": {"true": "The answer depends on specific content from the notes.", "false": "The message can be answered without reading any notes."}, }, } def route(query): answers = ask({"message": query, "notes": NOTES}, QUESTIONS, stage="route") intent = answers["intent"] return {"intent": intent["choice"], "confidence": intent["confidence"], "needs_retrieval": answers["needs_retrieval"]["noul"]}