first commit
This commit is contained in:
14
archive/openai.py
Normal file
14
archive/openai.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import openai
|
||||
|
||||
# API 키 설정 (환경 변수 등에서 가져옴)
|
||||
openai.api_key = "YOUR_API_KEY"
|
||||
|
||||
response = openai.ChatCompletion.create(
|
||||
model="gpt-3.5-turbo", # 또는 "gpt-4"
|
||||
messages=[
|
||||
{"role": "system", "content": "You are a helpful assistant."}, # 역할 설정
|
||||
{"role": "user", "content": "Hello!"} # 사용자 입력
|
||||
]
|
||||
)
|
||||
|
||||
print(response.choices[0].message.content)
|
||||
Reference in New Issue
Block a user