Closed wangchao1230 closed 6 months ago
After updating the openai library to version 1.1.1,
invoke using the latest method.
from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
model="gpt-3.5-turbo-1106",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
]
)
Running will result in an error.
File "C:\ProgramData\miniconda3\Lib\site-packages\promptflow\_core\openai_injector.py", line 131, in inject_openai_api
openai.api_key_path = os.environ.get("OPENAI_API_KEY_PATH", openai.api_key_path)
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'openai' has no attribute 'api_key_path'
The following two lines in the openai_injector.py annotation can work properly.
openai.api_key_path = os.environ.get("OPENAI_API_KEY_PATH", openai.api_key_path)
openai.api_base = os.environ.get("OPENAI_API_BASE", openai.api_base)
@AreChen Thanks for reporting this, we opened a PR for this: https://github.com/microsoft/promptflow/pull/1072 Then the execution of python scripts will not be blocked.
@thy09 we shall also relax the version contraint in setup.py
@wangchao1230 Will do that when most stuffs are ready.
Is it possible for now to loosen it to even allow 0.28.1, the one right before 1.0? https://pypi.org/project/openai/0.28.1/ Currently your setup.py requires "openai<0.28.0" and I'm not sure why 0.28.0/0.28.1 wouldn't be okay.
Hi @pamelafox we are going to remove the constraint in the next release, is it OK for you?
That'd be fine as well. I ended up removing promptflow as a dependency entirely, as it also has upper version constraints on Flask that are incompatible with our app. It'd be great if you could relax as many upper version constraints as possible. See reasoning in: https://iscinumpy.dev/post/bound-version-constraints/
@pamelafox The reason we pin some package versions is that we met some issue when some dependency updates. If you have concern of the version of flask, you may create another issue for it so we can track this.
We have relaxed the OpenAI version constraint and supported the OpenAI V1 in promptflow 1.1.0 and promptflow-tools 1.0.0, closing this issue.
Is your feature request related to a problem? Please describe.
Describe the solution you'd like relax open ai version constraint
Additional context Add any other context or screenshots about the feature request here.