#!/usr/bin/env python3
from google import genai
from dotenv import load_dotenv
import os

load_dotenv()
client = genai.Client(api_key=os.environ["GEMINI_API_KEY"])

print("Welcome to your programming assistant!")
print("Type 'exit' to quit.")

chat = client.chats.create(
    model="gemini-2.5-flash",
    config={
        "system_instruction": """Respond code only if possible. Keep
                                 explanations to a minimum (2 paragraphs
                                 max). Don't use markdown formatting,
                                 output plain text."""
    }
)

while True:
    prompt = input("You: ")
    if prompt.lower() == 'exit':
        print("Goodbye!")
        break
    
    response = chat.send_message(prompt)
    print("AI:")
    print(response.text)
    print()
