Spaces:
Sleeping
Sleeping
Update src/sql_generator.py
Browse files- src/sql_generator.py +3 -2
src/sql_generator.py
CHANGED
|
@@ -9,13 +9,14 @@ class SQLGenerator:
|
|
| 9 |
load_dotenv()
|
| 10 |
|
| 11 |
# 1. ROBUSTLY FETCH & CLEAN THE KEY
|
| 12 |
-
# We use .strip() to remove the accidental '\n' (newline) causing your error
|
| 13 |
raw_key = os.getenv("HF_API_KEY") or os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
| 14 |
self.api_key = raw_key.strip() if raw_key else None
|
| 15 |
|
| 16 |
# 2. Use Qwen 2.5 Coder
|
| 17 |
self.repo_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
|
| 20 |
def generate_followup_questions(self, question, sql_query):
|
| 21 |
return ["Visualize this result", "Export as CSV", "Compare with last year"]
|
|
|
|
| 9 |
load_dotenv()
|
| 10 |
|
| 11 |
# 1. ROBUSTLY FETCH & CLEAN THE KEY
|
|
|
|
| 12 |
raw_key = os.getenv("HF_API_KEY") or os.getenv("HUGGINGFACEHUB_API_TOKEN")
|
| 13 |
self.api_key = raw_key.strip() if raw_key else None
|
| 14 |
|
| 15 |
# 2. Use Qwen 2.5 Coder
|
| 16 |
self.repo_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
|
| 17 |
+
|
| 18 |
+
# ✅ FIX: Updated to the new Hugging Face Router URL
|
| 19 |
+
self.api_url = f"https://router.huggingface.co/models/{self.repo_id}"
|
| 20 |
|
| 21 |
def generate_followup_questions(self, question, sql_query):
|
| 22 |
return ["Visualize this result", "Export as CSV", "Compare with last year"]
|