Skip to content

Instantly share code, notes, and snippets.

@abhi-io
Created April 28, 2024 03:56
Show Gist options
  • Save abhi-io/56f084d11201469a6973b0205b62cc0f to your computer and use it in GitHub Desktop.
Save abhi-io/56f084d11201469a6973b0205b62cc0f to your computer and use it in GitHub Desktop.
ChatGPT test file
import os
from openai import OpenAI
client = OpenAI(
api_key = os.getenv("OPENAI_API_KEY"),
)
completion = client.chat.completions.create( # Change the method
model = "gpt-3.5-turbo",
messages = [ # Change the prompt parameter to messages parameter
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"},
]
)
print(completion.choices[0].message.content) # Change message content retrieval
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment