Spaces:
Sleeping
Sleeping
Commit ·
4c377a9
1
Parent(s): c5eee70
Fix Python 3.11 f-string syntax in prompt assembly
Browse files- backend/main.py +2 -1
backend/main.py
CHANGED
|
@@ -651,11 +651,12 @@ def grounded_answer(user_message: str, retrieved: list[dict[str, Any]]) -> str:
|
|
| 651 |
context_blocks.append(
|
| 652 |
f"[Chunk {idx} | source: {item['source']} | score: {item['score']:.3f}]\n{item['text']}"
|
| 653 |
)
|
|
|
|
| 654 |
|
| 655 |
prompt = (
|
| 656 |
"Use only the context below. If answer is not explicitly present, reply exactly: "
|
| 657 |
"I don't have that information yet.\n\n"
|
| 658 |
-
f"Context:\n{
|
| 659 |
f"User query: {user_message}"
|
| 660 |
)
|
| 661 |
|
|
|
|
| 651 |
context_blocks.append(
|
| 652 |
f"[Chunk {idx} | source: {item['source']} | score: {item['score']:.3f}]\n{item['text']}"
|
| 653 |
)
|
| 654 |
+
context_text = "\n\n".join(context_blocks)
|
| 655 |
|
| 656 |
prompt = (
|
| 657 |
"Use only the context below. If answer is not explicitly present, reply exactly: "
|
| 658 |
"I don't have that information yet.\n\n"
|
| 659 |
+
f"Context:\n{context_text}\n\n"
|
| 660 |
f"User query: {user_message}"
|
| 661 |
)
|
| 662 |
|