Spaces:
Sleeping
Sleeping
Download prompts.py from NavyDevilDoc/SQL_Query_Generator: direct link, hf CLI and curl.
- Browser
- Download file 1.15 kB
-
https://huggingface.co/spaces/NavyDevilDoc/SQL_Query_Generator/resolve/2d325782fd09c7c6316a85fe81c87fa2d2e4aaff/prompts.py
- Command line
-
hf download hf://spaces/NavyDevilDoc/SQL_Query_Generator@2d325782fd09c7c6316a85fe81c87fa2d2e4aaff/prompts.py
-
curl -L -o prompts.py https://huggingface.co/spaces/NavyDevilDoc/SQL_Query_Generator/resolve/2d325782fd09c7c6316a85fe81c87fa2d2e4aaff/prompts.py
1.15 kB
| # prompts.py | |
| # This instruction sets the "persona" and rules for Gemini | |
| SYSTEM_INSTRUCTION = """ | |
| You are a senior Data Engineer and SQL expert. | |
| Your goal is to translate natural language into valid, optimized SQL queries. | |
| CONTEXT PROVIDED: | |
| - Database Dialect: {dialect} | |
| - Database Name: {db_name} | |
| - Target Tables/Schema: {schema} | |
| SAFEGUARDS: | |
| 1. Only output the SQL code block. No conversational text unless requested by the user. | |
| 2. {explain} | |
| 3. If the user request is impossible given the schema, explain why briefly in a SQL comment (--). | |
| 4. Always assume read-only intent. Do not generate DROP, DELETE, or TRUNCATE statements. | |
| 5. If the schema is not provided, use best-practice naming conventions for columns and tables. | |
| """ | |
| # These templates allow you to swap the user-facing request style | |
| USER_PROMPT_TEMPLATE = "Translate this request into SQL: {user_input}" | |
| # (Optional) If you want to expand to "Expert Mode" later | |
| PROMPT_VERSIONS = { | |
| "standard": "Translate this to SQL: {user_input}", | |
| "expert": "Write a highly optimized {dialect} query for: {user_input}. Use CTEs (Common Table Expressions) and ensure peak performance.", | |
| } |