Spaces:
Runtime error
Runtime error
Update reasoning_engine.py
Browse files- reasoning_engine.py +6 -2
reasoning_engine.py
CHANGED
|
@@ -380,7 +380,8 @@ def plan(query: str, history: List[Dict[str, str]]) -> Dict[str, Any]:
|
|
| 380 |
"content": (
|
| 381 |
f"CONVERSATION:\n{json.dumps(history[-8:], ensure_ascii=False)}\n\n"
|
| 382 |
f"USER QUESTION:\n{query}\n\n"
|
| 383 |
-
f"RELEVANT PRIOR EXPERIENCES:\n{memory_text or 'None'}"
|
|
|
|
| 384 |
),
|
| 385 |
},
|
| 386 |
]
|
|
@@ -433,7 +434,8 @@ def analyze(
|
|
| 433 |
f"QUESTION:\n{query}\n\n"
|
| 434 |
f"PLAN:\n{json.dumps(plan_data, indent=2)}\n\n"
|
| 435 |
f"EVIDENCE:\n{evidence[:20000]}\n\n"
|
| 436 |
-
f"HISTORY:\n{json.dumps(history[-6:], ensure_ascii=False)}"
|
|
|
|
| 437 |
),
|
| 438 |
},
|
| 439 |
]
|
|
@@ -491,6 +493,8 @@ def initialize():
|
|
| 491 |
initialize_model()
|
| 492 |
|
| 493 |
|
|
|
|
|
|
|
| 494 |
if __name__ == "__main__":
|
| 495 |
initialize()
|
| 496 |
print("Infinity GRM reasoning engine initialized.")
|
|
|
|
| 380 |
"content": (
|
| 381 |
f"CONVERSATION:\n{json.dumps(history[-8:], ensure_ascii=False)}\n\n"
|
| 382 |
f"USER QUESTION:\n{query}\n\n"
|
| 383 |
+
f"RELEVANT PRIOR EXPERIENCES:\n{memory_text or 'None'}\n\n"
|
| 384 |
+
f"RELEVANT REASONING DEMONSTRATIONS:\n{_format_reasoning_examples(query, top_k=8)}"
|
| 385 |
),
|
| 386 |
},
|
| 387 |
]
|
|
|
|
| 434 |
f"QUESTION:\n{query}\n\n"
|
| 435 |
f"PLAN:\n{json.dumps(plan_data, indent=2)}\n\n"
|
| 436 |
f"EVIDENCE:\n{evidence[:20000]}\n\n"
|
| 437 |
+
f"HISTORY:\n{json.dumps(history[-6:], ensure_ascii=False)}\n\n"
|
| 438 |
+
f"RELEVANT REASONING DEMONSTRATIONS:\n{_format_reasoning_examples(query, top_k=6)}"
|
| 439 |
),
|
| 440 |
},
|
| 441 |
]
|
|
|
|
| 493 |
initialize_model()
|
| 494 |
|
| 495 |
|
| 496 |
+
REASONING_EXAMPLES = REASONING_EXAMPLES
|
| 497 |
+
|
| 498 |
if __name__ == "__main__":
|
| 499 |
initialize()
|
| 500 |
print("Infinity GRM reasoning engine initialized.")
|