Open Original-Iluster opened 7 months ago
The error is probably due to a new openAI API interface.
I di try to debug the following function def get_openAI_models():
global openAI_models
if (openAI_models != None):
return openAI_models
install_openai()
import openai
# Set the API key for the OpenAI module
openai.api_key = get_api_key()
print(openai.api_key)
try:
models = openai.Model.list() # Get the list of models
print(models)
except Exception as e:
print(e)
print("Error: (models) OpenAI API key is invalid OpenAI features wont work for you")
return []
openAI_models = [] # Create a list for the chat models
for model in models["data"]: # Loop through the models
openAI_models.append(model["id"]) # Add the model to the list
return openAI_models # Return the list of chat models
And i found out the exception stating: "_You tried to access openai.Model, but this is no longer supported in openai>=1.0.0 - see the README at https://github.com/openai/openai-python for the API.
You can run openai migrate
to automatically upgrade your codebase to use the 1.0.0 interface.
Alternatively, you can pin your installation to the old version, e.g. pip install openai==0.28
A detailed migration guide is available here: https://github.com/openai/openai-python/discussions/742_"
While waiting for the codebase to be fixed you can do this starting from ComfyUI folder
cd python_embeded
python.exe Scripts\pip.exe install openai==0.28.0
Thank you for your effort and the tip, I tried your work around but no change.
Then try to substitute the original
except
with
except Exception as e:
print(e)
in the above mentioned code to discover the error you get. Be carefull, there are two places in the code where the message "Error: OpenAI API key is invalid OpenAI features wont work for you" is emitted .
Since a few days I get the following message.
"Error: OpenAI API key is invalid OpenAI features wont work for you"
I have already uninstalled and reinstalled the QoL Suit and generated a new API key but no change.