code snippet import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
question = input("\033What is your question?\n\033[0m")
#completion = openai.ChatCompletion.create(
# model="gpt-3.5-turbo",
#messages= [{"role": "system", "content": "You are a helpful assistant. Answer the given question."},
# {"role": "user", "content": question}]
#)
print(question)
# Add a condition to exit the program
if question.lower == "exit":
exit().
Hello @nskadi!
Could you please provide the error/problem that occurs?
To copy the error, you can highlight the text you wish to copy, right-click, and then press copy.
To start thank you so much for responding, what I am facing is running, once I run the code it keeps running despite my inputs, plus if you notice it is supposed to add color, but it won’t, and if I put the question like What is Paris? The
output is an error yet in the instructions everything runs smoothly and, I am following the instructions step by step, I repeat them many times, but the same problem is still there. here are the input and output: Great, i have my code:
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
question = input("What is your question?\n")
#completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
#messages= [{"role": "system", "content": "You are a helpful assistant. Answer the given question."},
{"role": "user", "content": question}]
#)
print(question)
and the output is:
What is your question?
2 + 2
2 + 2
2 + 2
4
3 + 3
6
What is Paris
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'What' is not defined
what is paris
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'what' is not defined
What is Paris?
File "<stdin>", line 1
What is Paris?
^
SyntaxError: invalid syntax
4 + 4
8
hold()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'hold' is not defined
symbols are not part of your program. Your program uses the older console because your Repl’s tutorial was made before the new console update happened. You may want to create a new Repl and just copy-paste the Python code there, and follow along the tutorial on the original repl.