Spaces:
Sleeping
Sleeping
fixed steps_string to show product only if product is there in retrieval
Browse files- app/chatbot/demo_rag.py +5 -1
app/chatbot/demo_rag.py
CHANGED
|
@@ -169,7 +169,11 @@ def generate_answer(state: GraphState):
|
|
| 169 |
steps_string = "\n".join(
|
| 170 |
f"{tool_name} Results:\n" +
|
| 171 |
"\n".join(
|
| 172 |
-
f"- Product: {entry
|
|
|
|
|
|
|
|
|
|
|
|
|
| 173 |
for entry in results
|
| 174 |
)
|
| 175 |
for tool_name, results in intermediate_steps.items() if results
|
|
|
|
| 169 |
steps_string = "\n".join(
|
| 170 |
f"{tool_name} Results:\n" +
|
| 171 |
"\n".join(
|
| 172 |
+
(f"- Product: {entry['metadata']['product_name']}\n {entry['content']}"
|
| 173 |
+
if entry.get("metadata", {}).get("product_name")
|
| 174 |
+
else f"- {entry['content']}"
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
for entry in results
|
| 178 |
)
|
| 179 |
for tool_name, results in intermediate_steps.items() if results
|