Spaces:
Sleeping
Sleeping
use public token
Browse files
app.py
CHANGED
|
@@ -138,20 +138,15 @@ def augment_user_message(user_msg: str, context: str) -> str:
|
|
| 138 |
f"{context}\n\n"
|
| 139 |
f"User question: {user_msg}"
|
| 140 |
)
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
max_tokens,
|
| 147 |
-
temperature,
|
| 148 |
-
top_p,
|
| 149 |
-
hf_token: gr.OAuthToken,
|
| 150 |
-
):
|
| 151 |
"""
|
| 152 |
Augments the conversation with CSV-derived context as SYSTEM messages before calling the model.
|
| 153 |
"""
|
| 154 |
-
client = InferenceClient(token=
|
| 155 |
|
| 156 |
# 1) Retrieve CSV context for the latest user message
|
| 157 |
retrieved = RAG.retrieve(message, k=10)
|
|
|
|
| 138 |
f"{context}\n\n"
|
| 139 |
f"User question: {user_msg}"
|
| 140 |
)
|
| 141 |
+
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
| 142 |
+
token = os.getenv("HF_TOKEN") # Space Secret or env var
|
| 143 |
+
if not token:
|
| 144 |
+
yield "⚠️ No HF token found on the server. Please set HF_TOKEN in the Space secrets."
|
| 145 |
+
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
"""
|
| 147 |
Augments the conversation with CSV-derived context as SYSTEM messages before calling the model.
|
| 148 |
"""
|
| 149 |
+
client = InferenceClient(token=token, model="openai/gpt-oss-20b")
|
| 150 |
|
| 151 |
# 1) Retrieve CSV context for the latest user message
|
| 152 |
retrieved = RAG.retrieve(message, k=10)
|