Skip to content

Instantly share code, notes, and snippets.

@itrobotics
Last active November 21, 2023 01:59
Show Gist options
  • Save itrobotics/4839a002eb514285a82453aa1815de57 to your computer and use it in GitHub Desktop.
Save itrobotics/4839a002eb514285a82453aa1815de57 to your computer and use it in GitHub Desktop.
os.environ['OPENAI_API_KEY'] = "your_openai_api_key"
from openai import OpenAI
client = OpenAI()
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
{"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."}
]
)
print(completion.choices[0].message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment