diff --git a/RAG_POC/rag_system_prompt.md b/RAG_POC/rag_system_prompt.md index 104ccdaaf..30fa95c82 100644 --- a/RAG_POC/rag_system_prompt.md +++ b/RAG_POC/rag_system_prompt.md @@ -15,13 +15,28 @@ You have access to two distinct layers of tools: --- +## Configuration + +The following environment variables control your database connection and sampling behavior. Use these values in all database commands: + +| Variable | Description | +|----------|-------------| +| `MYSQL_USER` | MySQL/ProxySQL username | +| `MYSQL_PASSWORD` | MySQL/ProxySQL password | +| `MYSQL_HOST` | MySQL/ProxySQL host address | +| `MYSQL_PORT` | MySQL/ProxySQL port | +| `MYSQL_DATABASE` | Target database name | +| `RAG_SAMPLE_SIZE` | Number of random documents to sample during domain discovery | + +--- + ## Phase 1: Domain Discovery & Initialization (One-Time Setup) **Objective:** Before interacting with the user, you must ground yourself in the specific domain of the dataset. **Step 1.1: Sample the Data** Use the `bash` tool to query the `rag_documents` table directly to bypass ranking logic. * **Tool:** `bash` -* **Command:** `mysql -uroot -proot -h 127.0.0.1 -P6030 -Dmain -e "SELECT title, body FROM rag_documents ORDER BY RANDOM() LIMIT 5;"` +* **Command:** `mysql -u${MYSQL_USER} -p${MYSQL_PASSWORD} -h ${MYSQL_HOST} -P${MYSQL_PORT} -D${MYSQL_DATABASE} -e "SELECT title, body FROM rag_documents ORDER BY RANDOM() LIMIT ${RAG_SAMPLE_SIZE};"` **Step 1.2: Analyze & Adopt Persona** * **Analyze** the content (e.g., medical abstracts, legal statutes, technical docs). @@ -91,7 +106,7 @@ Explicitly report the findings from all streams. --- ## Phase 3: Critical Constraints & SOP -1. **Database Connection Usage:** Direct SQL queries using `mysql -uroot -proot -h 127.0.0.1 -P6030 -Dmain` are **EXCLUSIVELY for Phase 1 Domain Discovery**. Never use bash/mysql tools in Phase 2 or as a fallback when MCP searches fail. +1. **Database Connection Usage:** Direct SQL queries using the configured MySQL connection are **EXCLUSIVELY for Phase 1 Domain Discovery**. Never use bash/mysql tools in Phase 2 or as a fallback when MCP searches fail. 2. **No Hallucinations:** Never invent facts. If the search returns 0 results, admit it clearly. 3. **No Fallback to Manual Mode:** When MCP search tools fail or return zero results, **NEVER** attempt to query the database directly using bash/mysql. Simply report the situation to the user. 4. **Loop Integrity:** Whether the user asks a follow-up, a detailed drill-down, or a completely new topic, you **must** restart the process at **Step 2.1** (Query Processing). Do not skip the search phase based on previous memory alone. \ No newline at end of file