Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into devv
Browse files Browse the repository at this point in the history
  • Loading branch information
unaidedelf8777 committed Oct 20, 2023
2 parents e770bd0 + fdf0af3 commit df2a44f
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 486 deletions.
2 changes: 1 addition & 1 deletion interpreter/code_interpreters/language_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"html": HTML,
"applescript": AppleScript,
"r": R,
"powershell": PowerShell,
"powershell": PowerShell,
}
13 changes: 9 additions & 4 deletions interpreter/core/respond.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,22 @@ def respond(interpreter):
chunk_type = "code"
yield {"start_of_code": True}
if "code" in chunk and chunk_type != "code":
# (This shouldn't happen though — ^ "language" should be emitted first)
# (This shouldn't happen though — ^ "language" should be emitted first, but sometimes GPT-3.5 forgets this)
# (But I'm pretty sure we handle that? If it forgets we emit Python anyway?)
chunk_type = "code"
yield {"start_of_code": True}
elif "message" not in chunk and chunk_type == "message":
chunk_type = None
yield {"end_of_message": True}
elif "code" not in chunk and "language" not in chunk and chunk_type == "code":
chunk_type = None
yield {"end_of_code": True}

yield chunk

# We don't trigger the end_of_message or end_of_code flag if we actually end on either
if chunk_type == "message":
yield {"end_of_message": True}
elif chunk_type == "code":
yield {"end_of_code": True}

except litellm.exceptions.BudgetExceededError:
display_markdown_message(f"""> Max budget exceeded
Expand Down
2 changes: 1 addition & 1 deletion interpreter/llm/setup_text_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def base_llm(messages):
# Tell it how to run code.
# THIS MESSAGE IS DUPLICATED IN `setup_local_text_llm.py`
# (We should deduplicate it somehow soon)
system_message += "\nTo execute code on the user's machine, write a markdown code block *with the language*, i.e:\n\n```python\nprint('Hi!')\n```\n\nYou will recieve the output ('Hi!'). Use any language."
system_message += "\nTo execute code on the user's machine, write a markdown code block *with the language*, i.e:\n\n```python\nprint('Hi!')\n```\n\nYou will receive the output ('Hi!'). Use any language."

# TODO swap tt.trim for litellm util
messages = messages[1:]
Expand Down
2 changes: 1 addition & 1 deletion interpreter/terminal_interface/terminal_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def terminal_interface(interpreter, message):
]

if interpreter.safe_mode != "off":
interpreter_intro_message.append(f"**Safe Mode**: {interpreter.safe_mode}")
interpreter_intro_message.append(f"**Safe Mode**: {interpreter.safe_mode}\n\n>Note: **Safe Mode** requires `semgrep` (`pip install semgrep`)")
else:
interpreter_intro_message.append(
"Use `interpreter -y` to bypass this."
Expand Down
Loading

0 comments on commit df2a44f

Please sign in to comment.