Skip to content

Commit

Permalink
Only count executable code blocks for tool usage
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudotensor committed Oct 24, 2024
1 parent 04fc086 commit 5ea362c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion openai_server/autogen_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ def is_in_container() -> bool:

def _execute_code_dont_check_setup(self, code_blocks: List[CodeBlock]) -> CommandLineCodeResult:
multiple_executable_code_detected = False
code_blocks_exec = code_blocks
try:
# skip code blocks with # execution: false
code_blocks_len0 = len(code_blocks)
Expand Down Expand Up @@ -433,7 +434,7 @@ def _execute_code_dont_check_setup(self, code_blocks: List[CodeBlock]) -> Comman
raise

# Update agent tool usage if there is any
self.update_agent_tool_usages(code_blocks)
self.update_agent_tool_usages(code_blocks_exec)
# Truncate output if it is too long
ret = self.truncate_output(ret)
# Add executed code note if needed
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0f9ea9f3ba711cbaa5b97adac2f1e48190e343bf"
__version__ = "04fc086ef4c0c1ff155c5213d4ee4f41ba79f784"

0 comments on commit 5ea362c

Please sign in to comment.