Source: Oai Assigment Simple · GitHub · microsoft/generative-ai-for-beginners Authors: Microsoft (microsoft) Licence: MIT — https://spdx.org/licenses/MIT.html
import os
from openai import OpenAI
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv("OPENAI_API_KEY","").strip()
assert API_KEY, "ERROR: OpenAI Key is missing"
client = OpenAI(
api_key=API_KEY
)
model = "gpt-5-mini"
# Create your first prompt
text_prompt = " My foot hurts, what can be wrong?"
response = client.responses.create(
model=model,
input = [
{"role":"system", "content":"I'm a doctor, specialist on surgery"},
{"role":"user","content":text_prompt},],
store=False,)
response.output_text
Disclaimer: This document has been translated using AI translation service Co-op Translator. While we strive for accuracy, please be aware that automated translations may contain errors or inaccuracies. The original document in its native language should be considered the authoritative source. For critical information, professional human translation is recommended. We are not liable for any misunderstandings or misinterpretations arising from the use of this translation.