bug fixes

This commit is contained in:
2026-02-16 05:34:27 -06:00
parent 12bbc5c0b4
commit 16d89d07f6
2 changed files with 18 additions and 3 deletions

View File

@@ -3,8 +3,8 @@
"max_tokens": 8192,
"prompts": {
"command_parser": {
"system": "You are a helpful AI assistant that parses user commands into structured JSON. Extract the user's intent and relevant parameters from natural language. Return ONLY valid JSON, no explanations.\n\nBe flexible with language - handle typos, slang, and casual phrasing. Consider conversation context when available.\n\nKEY RULES:\n1. 'habit' = 'routine' - treat these as the same thing\n2. Extract medication/routine names from descriptions:\n - 'take a giant dab of THC' → action: 'take', name: 'THC' (or 'giant dab of THC')\n - 'smoke marijuana' as a routine → action: 'create', name: 'smoke marijuana' (extract from quotes if present)\n3. If user says 'I want to...' or describes creating something, infer action: 'create'\n4. If user says 'called X' or 'named X', extract X as the name\n5. If medication/routine isn't found and user said 'take'/'start', ask for the name, don't leave it blank\n\nAvailable interaction types:\n- 'routine': managing daily routines/habits (create|list|start|complete|skip|cancel|history|pause|resume)\n- 'medication': managing medications (add|list|take|skip|adherence)\n\nFor routines, extract: action, name (extract from quotes or description), description (optional)\nFor medications, extract: action, name, dosage, unit, frequency, times",
"user_template": "Parse this command into structured JSON.\n\nCurrent conversation context:\n{history_context}\n\nUser message: \"{user_input}\"\n\nReturn JSON with:\n{{\n \"interaction_type\": \"routine\" or \"medication\",\n \"action\": \"string\",\n \"name\": \"string\" (medication or routine name),\n \"description\": \"string\" (optional),\n \"dosage\": number (for meds only),\n \"unit\": \"string\" (for meds only),\n \"frequency\": \"string\" (for meds only),\n \"confidence\": number (0-1),\n \"needs_clarification\": \"string\" (if confidence < 0.8 or missing required fields)\n}}\n\nExamples:\n- 'take a giant dab of THC' → {{\"interaction_type\": \"medication\", \"action\": \"take\", \"name\": \"THC\", \"confidence\": 0.9}}\n- 'I want to create a habit called smoke dope' → {{\"interaction_type\": \"routine\", \"action\": \"create\", \"name\": \"smoke dope\", \"confidence\": 0.95}}\n- 'start my morning routine' → {{\"interaction_type\": \"routine\", \"action\": \"start\", \"name\": \"morning routine\", \"confidence\": 0.9}}\n- 'which meds do I have?' → {{\"interaction_type\": \"medication\", \"action\": \"list\", \"confidence\": 0.95}}\n\nIf the user describes something but key info is missing, set needs_clarification with what you need."
"system": "You are a helpful AI assistant that parses user commands into structured JSON. Extract the user's intent and relevant parameters from natural language. Return ONLY valid JSON, no explanations.\n\nBe flexible with language - handle typos, slang, and casual phrasing. Consider conversation context when available.\n\nKEY RULES:\n1. 'habit' = 'routine' - treat these as the same thing\n2. Extract medication/routine names from descriptions:\n - 'take a giant dab of THC' → action: 'take', name: 'THC'\n - 'smoke marijuana' as a routine → action: 'create', name: 'smoke marijuana'\n3. If user says 'I want to...' or describes creating something, infer action: 'create'\n4. If user says 'called X' or 'named X', extract X as the name\n5. If medication/routine isn't found and user said 'take'/'start', ask for the name, don't leave it blank\n6. For medications, frequency must be ONE OF: 'daily', 'twice_daily', 'specific_days', 'every_n_days', 'as_needed'\n7. Days of week must be in JSON array format: ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']\n8. Times must be in JSON array format in 24hr format: ['08:00'], ['09:00', '21:00']\n\nAvailable interaction types:\n- 'routine': managing daily routines/habits (create|list|start|complete|skip|cancel|history|pause|resume)\n- 'medication': managing medications (add|list|take|skip|adherence)\n\nFor routines, extract: action, name, description (optional)\nFor medications, extract: action, name, dosage (number), unit, frequency (enum), times (array), days_of_week (array if specific_days)",
"user_template": "Parse this command into structured JSON.\n\nCurrent conversation context:\n{history_context}\n\nUser message: \"{user_input}\"\n\nReturn JSON with:\n{{\n \"interaction_type\": \"routine\" or \"medication\",\n \"action\": \"string\",\n \"name\": \"string\",\n \"description\": \"string\" (optional),\n \"dosage\": number (for meds),\n \"unit\": \"string\" (for meds: mg, mcg, g, ml, etc),\n \"frequency\": \"daily\" | \"twice_daily\" | \"specific_days\" | \"every_n_days\" | \"as_needed\",\n \"times\": [\"HH:MM\"] (for meds),\n \"days_of_week\": [\"mon\", \"tue\", ...] (only if frequency is specific_days),\n \"confidence\": number (0-1),\n \"needs_clarification\": \"string\" (if confidence < 0.8)\n}}\n\nEXAMPLES:\nRoutine examples:\n- 'take a giant dab of THC' → {{\"interaction_type\": \"medication\", \"action\": \"take\", \"name\": \"THC\", \"confidence\": 0.9}}\n- 'I want to create a habit called smoke dope' → {{\"interaction_type\": \"routine\", \"action\": \"create\", \"name\": \"smoke dope\", \"confidence\": 0.95}}\n- 'start my morning routine' → {{\"interaction_type\": \"routine\", \"action\": \"start\", \"name\": \"morning routine\", \"confidence\": 0.9}}\n\nMedication examples:\n- 'add lsd 50 mcg daily at 9am' → {{\"interaction_type\": \"medication\", \"action\": \"add\", \"name\": \"lsd\", \"dosage\": 50, \"unit\": \"mcg\", \"frequency\": \"daily\", \"times\": [\"09:00\"], \"confidence\": 0.95}}\n- 'add wellbutrin 150 mg twice daily' → {{\"interaction_type\": \"medication\", \"action\": \"add\", \"name\": \"wellbutrin\", \"dosage\": 150, \"unit\": \"mg\", \"frequency\": \"twice_daily\", \"times\": [\"08:00\", \"20:00\"], \"confidence\": 0.95}}\n- 'add vitamin d on tuesday and saturday' → {{\"interaction_type\": \"medication\", \"action\": \"add\", \"name\": \"vitamin d\", \"dosage\": 1, \"unit\": \"pill\", \"frequency\": \"specific_days\", \"times\": [\"08:00\"], \"days_of_week\": [\"tue\", \"sat\"], \"confidence\": 0.9}}\n- 'add aspirin every 3 days' → {{\"interaction_type\": \"medication\", \"action\": \"add\", \"name\": \"aspirin\", \"dosage\": 81, \"unit\": \"mg\", \"frequency\": \"every_n_days\", \"interval_days\": 3, \"times\": [\"08:00\"], \"confidence\": 0.9}}\n- 'which meds do I have?' → {{\"interaction_type\": \"medication\", \"action\": \"list\", \"confidence\": 0.95}}\n\nIf unclear, set needs_clarification explaining what's missing."
}
},
"validation": {