Skip to content

Instantly share code, notes, and snippets.

@sunilkumardash9
Created April 28, 2023 18:59
Show Gist options
  • Save sunilkumardash9/f2d366fdf213242c1f67434fa9266bd6 to your computer and use it in GitHub Desktop.
Save sunilkumardash9/f2d366fdf213242c1f67434fa9266bd6 to your computer and use it in GitHub Desktop.
#API_ENDPOINT = "https://api.openai.com/v1/chat/completions"
# Note: you need to be using OpenAI Python v0.27.0 for the code below to work
import openai
openai.ChatCompletion.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?"}
]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment