fix: type check

Signed-off-by: Stream <Stream_2@qq.com>
This commit is contained in:
Stream
2026-01-30 21:17:19 +08:00
parent c1de8f75ca
commit 0265cc0403

View File

@ -2527,8 +2527,15 @@ class LLMNode(Node[LLMNodeData]):
key=lambda item: trace_state.tool_call_index_map.get(item.id or "", len(trace_state.tool_call_index_map))
)
text_content: str
if aggregate.text:
text_content = aggregate.text
elif aggregate.structured_output:
text_content = json.dumps(aggregate.structured_output.structured_output)
else:
raise ValueError("Aggregate must have either text or structured output.")
return LLMGenerationData(
text=aggregate.text or json.dumps(aggregate.structured_output.structured_output),
text=text_content,
reasoning_contents=buffers.reasoning_per_turn,
tool_calls=tool_calls_for_generation,
sequence=sequence,