
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
import getpass # 모듈이나 패키지를 포함하는 기능 -> getpass 라는 모듈을 포함하는 작업 -> 비밀번호 같이 민감한 정보를 받을 때의 모듈
pw = getpass.getpass("비밀번호:") # pw 지명
!pip install openai # 오픈 ai 설치
import os # 가져옴
import openai # 가져옴
openai.api_key = pw
response = openai.Completion.create(
model="text-davinci-003",
prompt="반가워",
temperature=0,
max_tokens=400,
top_p=1,
frequency_penalty=0,
presence_penalty=0,
stop=["\"\"\""]
)
ERROR: Invalid requirement: '#'
---------------------------------------------------------------------------
APIRemovedInV1 Traceback (most recent call last)
Cell In[4], line 9
5 import openai # 가져옴
7 openai.api_key = pw
----> 9 response = openai.Completion.create(
10 model="text-davinci-003",
11 prompt="반가워",
12 temperature=0,
13 max_tokens=400,
14 top_p=1,
15 frequency_penalty=0,
16 presence_penalty=0,
17 stop=["\"\"\""]
18 )
File ~\anaconda3\Lib\site-packages\openai\lib\_old_api.py:39, in APIRemovedInV1Proxy.__call__(self, *_args, **_kwargs)
38 def __call__(self, *_args: Any, **_kwargs: Any) -> Any:
---> 39 raise APIRemovedInV1(symbol=self._symbol)
APIRemovedInV1:
You tried to access openai.Completion, 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

