Created
May 22, 2025 21:34
-
-
Save donnfelker/851aa44cb9259b7f846d63dff130eec1 to your computer and use it in GitHub Desktop.
ChatGPT Prompt Engineering for Developers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openai | |
import os | |
from openai import OpenAI | |
client = OpenAI(api_key='<your-open-ai-key>') | |
def get_completion(prompt, model="gpt-4.1"): | |
completion = client.chat.completions.create( | |
model=model, | |
messages=[ | |
{"role": "user", "content": prompt}, | |
], | |
temperature=0 | |
) | |
return completion.choices[0].message.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment