Skip to content

Fixed issue with 3.5 Models hallucinating a function called "python", causing empty returns #683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

Cobular
Copy link
Contributor

@Cobular Cobular commented Oct 23, 2023

Describe the changes you have made:

I've found 3.5-turbo to be consistently hallucinating a function with the name "python", which causes an ugly UX of an empty return. Here's what it looks like:

{'role': 'assistant', 'content': None, 'function_call': <OpenAIObject at 0x11efe7c50> JSON: {
  "name": "python",
  "arguments": "import sys\nsys.executable"
}}

It turns out this is reasonably well known: https://community.openai.com/t/function-calling-a-python-function-is-frequently-called-even-though-it-does-not-exist-in-the-functions-parameter/264481/1, and that there's not a ton to be done here, other than embrace it. I've added the ability to just process that function, if it's called.

  • I have performed a self-review of my code:

When working on raycast open-interpreter, I test with 3.5 turbo for cost reasons (I'm running the same question like 100 times to check UI stuff). I've found the issue to be problematic both on the command line and from the library form.

I no longer get empty replies in any of the test cases I've found that once triggered this. My main test case is: Check what python interpreter you have access to..

I have tested the code on the following OS:

  • Windows
  • MacOS
  • Linux

AI Language Model (if applicable)

  • GPT4
  • GPT3
  • Llama 7B
  • Llama 13B
  • Llama 34B
  • Huggingface model (Please specify which one)

I've found open-interpreter to be consistently running into the issue described here: https://community.openai.com/t/function-calling-a-python-function-is-frequently-called-even-though-it-does-not-exist-in-the-functions-parameter/264481/1, where 3.5 turbo frequently halucinates a fake funciton, and there's not much to do about that. I've added the ability to just process that function, if it's called.
Copy link
Collaborator

@ericrallen ericrallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solves a very interesting issue with the gpt-3.5-turbo model, Thanks for digging in and working it out!

I do think it adds a lot of noise to an already noisy debug_mode, but the overall noisiness isn't the fault of this PR and the codebase doesn't provide an alternative.

@ericrallen ericrallen added the Triaged Issue has been reviewed by maintainer label Oct 23, 2023
@Cobular
Copy link
Contributor Author

Cobular commented Oct 23, 2023

Great! I'm happy to reduce the noise if you'd like - it's just the prints I was using to debug this on my end, but if needed I could pair them back to just a few critical ones

@ericrallen
Copy link
Collaborator

Don't worry about the noise.

We'll need to address it at some point at a broader level in the codebase, but for now, it's still useful when trying to backtrack.

@ericrallen ericrallen removed the request for review from KillianLucas October 24, 2023 19:25
@KillianLucas
Copy link
Collaborator

Wow. @Cobular this is like, a top 5 weird issue I figured we'd never track down. Brilliantly diagnosed and fixed. Merging now.

@KillianLucas KillianLucas merged commit 288af12 into openinterpreter:main Oct 25, 2023
@Cobular
Copy link
Contributor Author

Cobular commented Nov 6, 2023

Sorry to poke this, but any idea when this'll get into a release? I just realized I was hitting it again on my new laptop which was running 0.1.10 instead of my fork.

joshuavial pushed a commit to joshuavial/open-interpreter that referenced this pull request Nov 16, 2023
…unction

Fixed issue with 3.5 Models hallucinating a function called "python", causing empty returns

Former-commit-id: 288af12
Former-commit-id: ab0cf1c5ebf2c612eb3a21a0d3b8c78de4805621
Former-commit-id: 17f061625e41fb9a18f1c0d04bf7beb7015d81f0 [formerly 238e65baa2abb686dd6aedc5de96f2e852a6522b]
Former-commit-id: a28d262b6ee6009e4c0c3bda5e17152b85402a28
joshuavial pushed a commit to joshuavial/open-interpreter that referenced this pull request Nov 16, 2023
…unction

Fixed issue with 3.5 Models hallucinating a function called "python", causing empty returns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triaged Issue has been reviewed by maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants