# Topic 26: Groq Reasoning Implementation **Audit Date**: 2026-02-01 **Auditor**: Agent Antigravity **Scope**: Advanced Cognitive Capabilities --- ## 1. Native Reasoning Integration The system leverages Groq's support for "Reasoning Models" (like DeepSeek-R1, Qwen 2.5, GPT-OSS) to perform complex forensic analysis *before* generating a response. ### 1.1 Supported Models The `ModelRegistry` tags specific models with `Capability.REASONING`: * `openai/gpt-oss-20b` (DeepSeek-R1 Distill) * `qwen/qwen3-32b` (QwQ) ### 1.2 Reasoning Formats The `GroqClient` in `llm_client.py` supports all three modes documented by Groq: | Format | Implementation | Usage | | :--- | :--- | :--- | | **`raw`** | Returns `...` tags in content. | Used for "Glass Box" debugging logs. | | **`parsed`** | Separates reasoning into `message.reasoning`. | **DEFAULT**. Used for storing thought process in DB. | | **`hidden`** | Discards reasoning. | Used for user-facing responses (when speed matters). | **Code Evidence**: ```python # app/core/llm_client.py if reasoning_format: payload["reasoning_format"] = reasoning_format elif include_reasoning is not None: payload["include_reasoning"] = include_reasoning ``` *Note: The code explicitly handles the mutual exclusivity of `reasoning_format` and `include_reasoning`.* --- ## 2. Reasoning Effort Configuration For models that support variable compute (like `qwen3-32b`), the client allows setting `reasoning_effort`: * **`low`**: For quick scam classification. * **`high`**: For complex "Math Forensics" (checking suspicious investment returns). --- ## 3. The "Glass Box" Audit Unlike standard LLMs that are "Black Boxes", Sentinel captures the **Chain of Thought (CoT)**. * The `_native_reasoning` field is extracted and saved to the `Intelligence` table in the database. * This allows auditors to see *exactly* why the AI classified a message as a threat. **Status**: **FULLY IMPLEMENTED**. The system treats Reasoning as a first-class citizen embedded in the forensic pipeline.