Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typos in codeact_agent.py #524

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions examples/conversation_with_codeact_agent/codeact_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def search(question: str):
)
code_exec_msg = self.handle_code_result(
code_execution_result,
"Example Code excuted: ",
"Example Code executed: ",
)
self.memory.add(example_msg)
self.memory.add(code_exec_msg)
Expand All @@ -109,9 +109,9 @@ def handle_code_result(
"""return the message from code result"""
code_exec_content = content_pre_sring
if code_execution_result.status == ServiceExecStatus.SUCCESS:
code_exec_content += "Excution Successful:\n"
code_exec_content += "Execution Successful:\n"
else:
code_exec_content += "Excution Failed:\n"
code_exec_content += "Execution Failed:\n"
code_exec_content += "Execution Output:\n" + str(
code_execution_result.content,
)
Expand All @@ -122,10 +122,10 @@ def reply(self, x: Msg = None) -> Msg:

self.memory.add(x)

excution_count = 0
execution_count = 0
while (
self.memory.get_memory(1)[-1].role == "user"
and excution_count < self.n_max_executions
and execution_count < self.n_max_executions
):
prompt = self.model.format(self.memory.get_memory())
model_res = self.model(prompt)
Expand All @@ -143,15 +143,15 @@ def reply(self, x: Msg = None) -> Msg:
code_execution_result = (
self.code_executor.run_code_on_notebook(code)
)
excution_count += 1
execution_count += 1
code_exec_msg = self.handle_code_result(code_execution_result)
self.memory.add(code_exec_msg)
self.speak(code_exec_msg)

if excution_count == self.n_max_executions:
if execution_count == self.n_max_executions:
assert self.memory.get_memory(1)[-1].role == "user"
code_max_exec_msg = Msg(
name="assitant",
name="assistant",
role="assistant",
content=(
"I have reached the maximum number "
Expand Down