From 432ddca1cc811dff9074d45e2bb73c6cf0facd47 Mon Sep 17 00:00:00 2001 From: Dillon Laird Date: Mon, 12 Aug 2024 08:45:27 -0700 Subject: [PATCH] fixed tabulate issue (#197) * fixed tabulate issue * fixed type error --- vision_agent/agent/vision_agent_coder.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vision_agent/agent/vision_agent_coder.py b/vision_agent/agent/vision_agent_coder.py index 4ef6b07e..352697d7 100644 --- a/vision_agent/agent/vision_agent_coder.py +++ b/vision_agent/agent/vision_agent_coder.py @@ -735,8 +735,17 @@ def chat_with_workflow( if self.verbosity >= 1: for p in plans: + # tabulate will fail if the keys are not the same for all elements + p_fixed = [ + { + "instructions": ( + e["instructions"] if "instructions" in e else "" + ) + } + for e in plans[p] + ] _LOGGER.info( - f"\n{tabulate(tabular_data=plans[p], headers='keys', tablefmt='mixed_grid', maxcolwidths=_MAX_TABULATE_COL_WIDTH)}" + f"\n{tabulate(tabular_data=p_fixed, headers='keys', tablefmt='mixed_grid', maxcolwidths=_MAX_TABULATE_COL_WIDTH)}" ) tool_infos = retrieve_tools(