From a7315b46df1ecf7a59b1b8c80dd7cf2adc8552ad Mon Sep 17 00:00:00 2001 From: Tax <213691625+taxman20000@users.noreply.github.com> Date: Fri, 13 Jun 2025 19:13:30 -0700 Subject: [PATCH] fix: solves the malformed json output and pydantic validation error produced by the 'planner' node by forcing the llm response to strictly comply with the pydantic 'Plan' model (#322) --- src/graph/nodes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/graph/nodes.py b/src/graph/nodes.py index ec2c31b..ec85929 100644 --- a/src/graph/nodes.py +++ b/src/graph/nodes.py @@ -104,7 +104,8 @@ def planner_node( if AGENT_LLM_MAP["planner"] == "basic": llm = get_llm_by_type(AGENT_LLM_MAP["planner"]).with_structured_output( Plan, - method="json_mode", + method="json_schema", + strict=True, ) else: llm = get_llm_by_type(AGENT_LLM_MAP["planner"])