Skip to content

Commit

Permalink
Ignore comment-only build script (#754)
Browse files Browse the repository at this point in the history
Sometimes LLM suggests a build script with comments-only when it wants
to reuse the existing build script, e.g.,
```
<build script>
# Reuse the existing build.sh
</build script>
```

This avoids confusing LLM to 'think' the build script works.
Returning `''` will make OFG use the existing build script.
  • Loading branch information
DonggeLiu authored Dec 17, 2024
1 parent 64d7504 commit fabf4b8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions agent/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def _filter_code(self, raw_code_block: str) -> str:
line for line in raw_code_block.splitlines()
if not line.strip().startswith('```')
]
# Sometimes LLM returns a build script containing only comments.
if all(line.strip().startswith('#') for line in filtered_lines):
return ''
filtered_code_block = '\n'.join(filtered_lines)
return filtered_code_block

Expand Down

0 comments on commit fabf4b8

Please sign in to comment.