Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -73,8 +73,9 @@ cleaned_chunks = preprocess_text(knowledge_base)
|
|
| 73 |
client = InferenceClient("Qwen/Qwen2.5-7B-Instruct")
|
| 74 |
|
| 75 |
def respond(message, history):
|
| 76 |
-
|
| 77 |
-
|
|
|
|
| 78 |
|
| 79 |
if history:
|
| 80 |
messages.extend(history)
|
|
|
|
| 73 |
client = InferenceClient("Qwen/Qwen2.5-7B-Instruct")
|
| 74 |
|
| 75 |
def respond(message, history):
|
| 76 |
+
top_chunks = get_top_chunks(message, chunk_embeddings, cleaned_chunks)
|
| 77 |
+
context = "\n".join(top_chunks)
|
| 78 |
+
messages = [{"role": "system","content": f"You are a friendly chatbot. Use this context to answer:\n{context}"
|
| 79 |
|
| 80 |
if history:
|
| 81 |
messages.extend(history)
|