mechark
commited on
Commit
·
54d4035
1
Parent(s):
df42d83
feat: add HF_TOKEN check
Browse files- src/rag/llm.py +16 -1
src/rag/llm.py
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
|
| 2 |
from langchain_core.prompts import ChatPromptTemplate
|
| 3 |
-
import logging
|
| 4 |
|
| 5 |
from src.prompts import SYSTEM_PROMPT
|
| 6 |
from src.core.config import settings
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import logging
|
| 3 |
+
|
| 4 |
+
# Check what the OS actually sees
|
| 5 |
+
raw_token = os.getenv("HF_TOKEN")
|
| 6 |
+
|
| 7 |
+
print("--- DEBUG START ---")
|
| 8 |
+
if raw_token:
|
| 9 |
+
print(f"OS found HF_TOKEN! Length: {len(raw_token)}")
|
| 10 |
+
print(f"First 3 chars: {raw_token[:3]}...") # Safety check
|
| 11 |
+
else:
|
| 12 |
+
print("OS did NOT find HF_TOKEN. It is None/Empty.")
|
| 13 |
+
# Print all keys available (masked) to see if there is a typo
|
| 14 |
+
print("Available Env Vars:", [k for k in os.environ.keys() if 'TOKEN' in k])
|
| 15 |
+
print("--- DEBUG END ---")
|
| 16 |
+
|
| 17 |
from langchain_huggingface import ChatHuggingFace, HuggingFaceEndpoint
|
| 18 |
from langchain_core.prompts import ChatPromptTemplate
|
|
|
|
| 19 |
|
| 20 |
from src.prompts import SYSTEM_PROMPT
|
| 21 |
from src.core.config import settings
|