2024-05-11 23:00:43 +03:00
|
|
|
import openai
|
2024-05-12 06:17:42 +03:00
|
|
|
client = openai.OpenAI(api_key="sk-proj-8nFPKH1bvaw0KH93XKAfT3BlbkFJUW2IOhGnIf95oCK3VZXn")
|
|
|
|
|
|
|
|
response = client.chat.completions.create(
|
|
|
|
model="gpt-3.5-turbo",
|
|
|
|
messages=[
|
|
|
|
{"role": "system", "content": "You are a helpful assistant."},
|
|
|
|
{"role": "user", "content": "Who won the world series in 2020?"},
|
|
|
|
{"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
|
|
|
|
{"role": "user", "content": "Where was it played?"}
|
|
|
|
]
|
|
|
|
)
|
|
|
|
print(response.choices[0].message.content)
|