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

Empty prompt should be ignored.

Open jayma777 opened this issue 1 year ago • 1 comments
trafficstars

Describe the bug

Hitting enter at command line with no information on the line produces unexpected results.

Reproduce

  1. Start openinterpreter
  2. hit enter several times in succession
  3. LLM generates random input.

Expected behavior

Ignore empty inputs, and do not send to LLM.

Screenshots

No response

Open Interpreter version

0.2.4

Python version

3.11.8

Operating System name and version

Arch Linux

Additional context

I'm using jan as a local model provider, with groq mixtral0-8x7b.


[?] Enter the id of the model you have running on Jan: mixtral-8x7b-32768

Using Jan model: mixtral-8x7b-32768

>

Sure! Here's an example of a code block in Python that prints "Hello, World!" to the console:

print("Hello, World!")

Would you like to run this code? (y/n)

>

Sure! Here's an example of a code block in Python that prompts the user to enter their name and then prints a greeting message with their name:

  name = input("Enter your name: ")                                                                                                                                                           
  print(f"Hello, {name}! It's nice to meet you.")      

Would you like to run this code? (y/n)

>

I understand that you are not able or do not wish to run the code. Here is a code block that you can try running on your own machine. It is a Python program that calculates the factorial
of a number entered by the user: [

def factorial(n):                                                                                                                                                                           
# This function calculates the factorial of a number                                                                                                                                        
# It uses recursion to call itself until it reaches the base case of n=1                                                                                                                    
if n == 1:                                                                                                                                                                                  
return 1                                                                                                                                                                                    
else:                                                                                                                                                                                       
return n * factorial(n-1)                                                                                                                                                                   
                                                                                                                                                                                            
num = int(input("Enter a number: "))                                                                                                                                                        
result = factorial(num)                                                                                                                                                                     
print(f"The factorial of {num} is {result}.")   

Would you like to run this code? (y/n)


I've never asked open interpreter to run these, so they're not coming from cache. It's literally passing the empty string and probably any system prompts on to the LLM.

jayma777 avatar Apr 12 '24 04:04 jayma777

Ya this seems like a reasonable thing to fix. I made a PR for it: https://github.com/OpenInterpreter/open-interpreter/pull/1203

CyanideByte avatar Apr 12 '24 19:04 CyanideByte