Skip to content

Commit

Permalink
fix generate_init_message return type
Browse files Browse the repository at this point in the history
  • Loading branch information
yenif committed Dec 28, 2023
1 parent 0ae4051 commit 645ba8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion autogen/agentchat/conversable_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ async def a_execute_function(self, func_call):
"content": str(content),
}

def generate_init_message(self, **context) -> Union[str, Dict]:
def generate_init_message(self, **context) -> Dict:
"""Generate the initial message for the agent.
Override this function to customize the initial message based on user's request.
Expand Down
7 changes: 4 additions & 3 deletions notebook/agentchat_auto_feedback_from_code_execution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,10 @@
" super().__init__(name, **kwargs)\n",
" self._ipython = get_ipython()\n",
"\n",
" def generate_init_message(self, *args, **kwargs) -> Union[str, Dict]:\n",
" return super().generate_init_message(*args, **kwargs) + \"\"\"\n",
"If you suggest code, the code will be executed in IPython.\"\"\"\n",
" def generate_init_message(self, *args, **kwargs) -> Dict:\n",
" message = super().generate_init_message(*args, **kwargs)\n",
" message[\"content\"] += \"\\nIf you suggest code, the code will be executed in IPython.\"\n",
" return message\n",
"\n",
" def run_code(self, code, **kwargs):\n",
" result = self._ipython.run_cell(\"%%capture --no-display cap\\n\" + code)\n",
Expand Down

0 comments on commit 645ba8b

Please sign in to comment.