open-interpreter icon indicating copy to clipboard operation
open-interpreter copied to clipboard

Claude Sonnet won't write complete code

Open MikeBirdTech opened this issue 1 year ago • 4 comments

Describe the bug

When using a custom profile with claude-3-5-sonnet-20240620, the code generated is never complete and always results in an error. This usually occurs after a : or a number but not always. I updated the profile to use openai/gpt-4o and it was able to write code correctly, even when asked to make the code more robust to test for length limits.

Reproduce

Create a profile with:

from interpreter import interpreter


# LLM settings
interpreter.llm.model = "claude-3-5-sonnet-20240620"
interpreter.llm.supports_functions = False
interpreter.llm.execution_instructions = False
interpreter.llm.max_tokens = 4096
interpreter.llm.context_window = 10000

# Computer settings
interpreter.computer.import_computer_api = False

# Misc settings
interpreter.auto_run = False
interpreter.offline = False

# Custom Instructions
interpreter.custom_instructions=f"""
..."""

Run interpreter --profile <name of profile.py>

Ask it to do something that requires code, for example "Summarize this pdf: "

Expected behavior

Writes complete code

Screenshots

Screenshot 2024-07-31 at 10 12 37 AM Screenshot 2024-07-31 at 10 13 05 AM

Open Interpreter version

Open Interpreter 0.3.4 Local III

Python version

Python 3.11.7

Operating System name and version

MacOS

Additional context

No response

MikeBirdTech avatar Jul 31 '24 14:07 MikeBirdTech

I met similar issue. It seems that the last line of the code output will be discard. image

AllanJJJ avatar Aug 01 '24 02:08 AllanJJJ

Using verbose does it send a stop token?

Notnaton avatar Aug 01 '24 11:08 Notnaton

Interesting development. I set interpreter.llm.supports_functions to True.

Now it writes code like execute("bash", "ls ~/Desktop | wc -l") and then exits immediately. Doesn't run the code

MikeBirdTech avatar Aug 02 '24 19:08 MikeBirdTech

Using verbose does it send a stop token?

In my last couple tests, yes

"Chunk in terminal_interface: {'role': 'assistant', 'type': 'code', 'format': 'bash', 'end': True}"

MikeBirdTech avatar Aug 02 '24 19:08 MikeBirdTech