From ad0faf72e1feedac3be2751ffcc9a26a1268bd23 Mon Sep 17 00:00:00 2001 From: Bongobutt Date: Mon, 16 Feb 2026 18:51:15 -0600 Subject: [PATCH] i sniffed the wrong week to quit picking glue. --- bot/commands/knowledge.py | 42 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/bot/commands/knowledge.py b/bot/commands/knowledge.py index a55113a..c9e47d4 100644 --- a/bot/commands/knowledge.py +++ b/bot/commands/knowledge.py @@ -271,9 +271,44 @@ async def handle_knowledge(message, session, parsed): except Exception as e: await message.channel.send(f"❌ Error processing query: {e}") + elif action == "dbt_evaluate_advice": + advice = parsed.get("advice", "") + if not advice: + await message.channel.send("Please provide the advice you want to evaluate.") + return + + await message.channel.send("Processing your request for DBT advice evaluation. This may take a minute...") + + system_prompt = """You are an expert in Dialectical Behavior Therapy (DBT). +Your task is to evaluate the provided advice against DBT principles. +Focus on whether the advice aligns with DBT skills, such as mindfulness, distress tolerance, emotion regulation, and interpersonal effectiveness. +Provide a clear "cleared" or "not cleared" judgment, followed by a brief explanation of why, referencing specific DBT principles where applicable. + +Example of good advice evaluation: +CLEARED: This advice encourages mindfulness by suggesting to observe thoughts without judgment, which is a core DBT skill. + +Example of bad advice evaluation: +NOT CLEARED: This advice promotes suppressing emotions, which is contrary to DBT's emphasis on emotion regulation through healthy expression and understanding. + +Evaluate the following advice: +""" + try: + response = client.chat.completions.create( + model=CHAT_MODEL, + messages=[ + {"role": "system", "content": system_prompt}, + {"role": "user", "content": advice}, + ], + temperature=0.2, # Slightly higher temperature for more varied explanations, but still grounded + ) + evaluation = response.choices[0].message.content + await message.channel.send(f"**DBT Advice Jury Says:**\n{evaluation}") + except Exception as e: + await message.channel.send(f"❌ Error evaluating advice: {e}") + else: await message.channel.send( - f"Unknown knowledge action: {action}. Try: list, select, or ask a question." + f"Unknown knowledge action: {action}. Try: list, select, query, or dbt_evaluate_advice." ) @@ -290,6 +325,11 @@ def validate_knowledge_json(data): if "action" not in data: errors.append("Missing required field: action") + action = data.get("action") + + if action == "dbt_evaluate_advice" and "advice" not in data: + errors.append("Missing required field for dbt_evaluate_advice: advice") + return errors