Skip to content

Commit 7e96b82

Browse files
authored
Merge pull request #1217 from CyanideByte/llama3-hallucation-fix
Fix Llama3 backtick hallucination in code blocks
2 parents b000bee + 02bfd20 commit 7e96b82

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

interpreter/core/computer/terminal/terminal.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def run(self, language, code, stream=False, display=False):
5151
self.computer._has_imported_skills = True
5252
self.computer.skills.import_skills()
5353

54+
# Llama 3 likes to hallucinate this tick new line thing at the start of code blocks
55+
if code.startswith("`\n"):
56+
code = code[2:].strip()
57+
5458
if stream == False:
5559
# If stream == False, *pull* from _streaming_run.
5660
output_messages = []

0 commit comments

Comments
 (0)