From d481aebb9bfcf677bf3a7038d88bb3df2109647b Mon Sep 17 00:00:00 2001 From: Manuel Saelices Date: Wed, 11 Oct 2023 19:27:54 +0200 Subject: [PATCH] Fix edge cases extracting code when the message's content is None (#205) --- autogen/agentchat/conversable_agent.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/autogen/agentchat/conversable_agent.py b/autogen/agentchat/conversable_agent.py index 1c875da84694..87845f910d17 100644 --- a/autogen/agentchat/conversable_agent.py +++ b/autogen/agentchat/conversable_agent.py @@ -627,6 +627,8 @@ def generate_code_execution_reply( # if no code blocks are found, continue for i in range(min(len(messages), last_n_messages)): message = messages[-(i + 1)] + if not message["content"]: + continue code_blocks = extract_code(message["content"]) if len(code_blocks) == 1 and code_blocks[0][0] == UNKNOWN: continue