16 lines
390 B
Python
16 lines
390 B
Python
from dotenv import load_dotenv
|
|
from openai import OpenAI
|
|
|
|
load_dotenv()
|
|
|
|
client = OpenAI()
|
|
|
|
response = client.chat.completions.create(
|
|
model = 'gpt-4-1106-preview',
|
|
messages = [
|
|
{'role': 'system', 'content': 'You are a helpful Python coding assistant.'},
|
|
{'role': 'user', 'content': 'Please code the game of life using pygame.'}
|
|
]
|
|
)
|
|
|
|
print(response.choices[0].message.content) |