Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1099,7 +1099,7 @@ def overall_planner_node(state: GameState):
|
|
| 1099 |
"Corrected JSON:\n"
|
| 1100 |
)
|
| 1101 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 1102 |
-
print(f"[JSON CORRECTOR RESPONSE AT OVERALLPLANNERNODE ]: {correction_response[
|
| 1103 |
overall_plan= extract_json_from_llm_response(correction_response["messages"][-1].content)#strip_noise(correction_response["messages"][-1].content))
|
| 1104 |
|
| 1105 |
state["action_plan"] = overall_plan
|
|
@@ -1488,7 +1488,7 @@ def plan_verification_node(state: GameState):
|
|
| 1488 |
"Corrected JSON:\n"
|
| 1489 |
)
|
| 1490 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 1491 |
-
print(f"[JSON CORRECTOR RESPONSE AT PLANVERIFICATIONNODE ]: {correction_response[
|
| 1492 |
validation_result = extract_json_from_llm_response(correction_response["messages"][-1].content) #strip_noise(correction_response["messages"][-1].content))
|
| 1493 |
|
| 1494 |
# Update state with feedback and improvement flag
|
|
@@ -1790,7 +1790,7 @@ def refined_planner_node(state: GameState):
|
|
| 1790 |
"Corrected JSON:\n"
|
| 1791 |
)
|
| 1792 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 1793 |
-
print(f"[JSON CORRECTOR RESPONSE AT REFINEPLANNER ]: {correction_response[
|
| 1794 |
refined_plan = extract_json_from_llm_response(correction_response["messages"][-1].content)#strip_noise(correction_response["messages"][-1].content))
|
| 1795 |
logger.info("Refined plan corrected by JSON resolver agent.")
|
| 1796 |
|
|
@@ -2651,7 +2651,7 @@ def overall_block_builder_node(state: dict):
|
|
| 2651 |
"```json\n"
|
| 2652 |
)
|
| 2653 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 2654 |
-
print(f"[JSON CORRECTOR RESPONSE AT OVERALLBLOCKBUILDER ]: {correction_response[
|
| 2655 |
generated_blocks = extract_json_from_llm_response(correction_response["messages"][-1].content)
|
| 2656 |
|
| 2657 |
if "blocks" in generated_blocks and isinstance(generated_blocks["blocks"], dict):
|
|
@@ -3162,7 +3162,7 @@ def block_verification_node(state: dict) -> dict:
|
|
| 3162 |
"Corrected JSON:\n"
|
| 3163 |
)
|
| 3164 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 3165 |
-
print(f"[JSON CORRECTOR RESPONSE AT BLOCKVERFIER ]: {correction_response[
|
| 3166 |
state["review_block_feedback"] = extract_json_from_llm_response(correction_response["messages"][-1].content)
|
| 3167 |
|
| 3168 |
logger.info("Agent review feedback added to the state.")
|
|
@@ -3549,7 +3549,7 @@ def improvement_block_builder_node(state: GameState):
|
|
| 3549 |
"```json\n"
|
| 3550 |
)
|
| 3551 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 3552 |
-
print(f"[JSON CORRECTOR RESPONSE AT IMPROVEMENTBLOCKBUILDER ]: {correction_response[
|
| 3553 |
generated_blocks = extract_json_from_llm_response(correction_response["messages"][-1].content)#strip_noise(correction_response["messages"][-1].content))
|
| 3554 |
|
| 3555 |
if "blocks" in generated_blocks and isinstance(generated_blocks["blocks"], dict):
|
|
|
|
| 1099 |
"Corrected JSON:\n"
|
| 1100 |
)
|
| 1101 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 1102 |
+
print(f"[JSON CORRECTOR RESPONSE AT OVERALLPLANNERNODE ]: {correction_response['messages'][-1].content}")
|
| 1103 |
overall_plan= extract_json_from_llm_response(correction_response["messages"][-1].content)#strip_noise(correction_response["messages"][-1].content))
|
| 1104 |
|
| 1105 |
state["action_plan"] = overall_plan
|
|
|
|
| 1488 |
"Corrected JSON:\n"
|
| 1489 |
)
|
| 1490 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 1491 |
+
print(f"[JSON CORRECTOR RESPONSE AT PLANVERIFICATIONNODE ]: {correction_response['messages'][-1].content}")
|
| 1492 |
validation_result = extract_json_from_llm_response(correction_response["messages"][-1].content) #strip_noise(correction_response["messages"][-1].content))
|
| 1493 |
|
| 1494 |
# Update state with feedback and improvement flag
|
|
|
|
| 1790 |
"Corrected JSON:\n"
|
| 1791 |
)
|
| 1792 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 1793 |
+
print(f"[JSON CORRECTOR RESPONSE AT REFINEPLANNER ]: {correction_response['messages'][-1].content}")
|
| 1794 |
refined_plan = extract_json_from_llm_response(correction_response["messages"][-1].content)#strip_noise(correction_response["messages"][-1].content))
|
| 1795 |
logger.info("Refined plan corrected by JSON resolver agent.")
|
| 1796 |
|
|
|
|
| 2651 |
"```json\n"
|
| 2652 |
)
|
| 2653 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 2654 |
+
print(f"[JSON CORRECTOR RESPONSE AT OVERALLBLOCKBUILDER ]: {correction_response['messages'][-1].content}")
|
| 2655 |
generated_blocks = extract_json_from_llm_response(correction_response["messages"][-1].content)
|
| 2656 |
|
| 2657 |
if "blocks" in generated_blocks and isinstance(generated_blocks["blocks"], dict):
|
|
|
|
| 3162 |
"Corrected JSON:\n"
|
| 3163 |
)
|
| 3164 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 3165 |
+
print(f"[JSON CORRECTOR RESPONSE AT BLOCKVERFIER ]: {correction_response['messages'][-1].content}")
|
| 3166 |
state["review_block_feedback"] = extract_json_from_llm_response(correction_response["messages"][-1].content)
|
| 3167 |
|
| 3168 |
logger.info("Agent review feedback added to the state.")
|
|
|
|
| 3549 |
"```json\n"
|
| 3550 |
)
|
| 3551 |
correction_response = agent_json_resolver.invoke({"messages": [{"role": "user", "content": correction_prompt}]})
|
| 3552 |
+
print(f"[JSON CORRECTOR RESPONSE AT IMPROVEMENTBLOCKBUILDER ]: {correction_response['messages'][-1].content}")
|
| 3553 |
generated_blocks = extract_json_from_llm_response(correction_response["messages"][-1].content)#strip_noise(correction_response["messages"][-1].content))
|
| 3554 |
|
| 3555 |
if "blocks" in generated_blocks and isinstance(generated_blocks["blocks"], dict):
|