drop forbidden api_url key (HF Inference default)
Browse files
rag.py
CHANGED
|
@@ -111,14 +111,15 @@ def get_vectorstore() -> FAISS:
|
|
| 111 |
texts = get_texts()
|
| 112 |
|
| 113 |
# --- FINAL: use HF Inference Providers router (no disk) ---------------
|
|
|
|
| 114 |
from langchain_huggingface import HuggingFaceEndpointEmbeddings
|
| 115 |
embeddings = HuggingFaceEndpointEmbeddings(
|
| 116 |
model="sentence-transformers/all-MiniLM-L6-v2",
|
| 117 |
task="feature-extraction",
|
| 118 |
-
huggingfacehub_api_token=HF_TOKEN
|
| 119 |
-
api_url="https://router.huggingface.co/hf-inference" # new serverless
|
| 120 |
)
|
| 121 |
# ------------------------------------------------------------------------
|
|
|
|
| 122 |
|
| 123 |
if not texts: # no data → empty FAISS
|
| 124 |
return FAISS.from_texts([""], embeddings) # dummy
|
|
|
|
| 111 |
texts = get_texts()
|
| 112 |
|
| 113 |
# --- FINAL: use HF Inference Providers router (no disk) ---------------
|
| 114 |
+
# --- FINAL: HF Inference Providers (no disk, no cache) ----------------
|
| 115 |
from langchain_huggingface import HuggingFaceEndpointEmbeddings
|
| 116 |
embeddings = HuggingFaceEndpointEmbeddings(
|
| 117 |
model="sentence-transformers/all-MiniLM-L6-v2",
|
| 118 |
task="feature-extraction",
|
| 119 |
+
huggingfacehub_api_token=HF_TOKEN
|
|
|
|
| 120 |
)
|
| 121 |
# ------------------------------------------------------------------------
|
| 122 |
+
# ------------------------------------------------------------------------
|
| 123 |
|
| 124 |
if not texts: # no data → empty FAISS
|
| 125 |
return FAISS.from_texts([""], embeddings) # dummy
|