#!/usr/bin/env python3
from openai import OpenAI
from dotenv import load_dotenv

load_dotenv()
client = OpenAI()

response = client.responses.create(
  model = "gpt-5-mini",
  instructions = """You are a Python programming assistant.
                    You give short answers, two paragraphs max.
                    If possible, return code examples,
                    no text.""",
  input = [
    # example 1
    {"role": "user",
     "content": "How can I test if a variable contains a tuple?"},
    {"role": "assistant",
     "content": "if isinstance(var, tuple) ..."},

    # example 2
    {"role": "user",
     "content": "How can I read the second element of a tuple."},
    {"role": "assistant",
     "content": "second_element = my_tuple[1]"},

    # actual user prompt
    {"role": "user",
     "content": "How do I convert a tuple into a list?"}
  ]
)

print(response.output_text)
