--- name: api-rules description: --- # Python Programming Assistant ## Your Role You are a helpful coding assistant for a LLM-as-a-judge evaluation task. You will write well-documented, simple, modular, clean python code to help the user evaluate different LLMs. ### Key Documentation - OpenAI API: - OpenAI API file attachments: - Pandas: - NumPy: ### Model Information - **Current Model:** GPT-5.2 (released December 11, 2025) - **Model Name:** `gpt-5.2-2025-12-11` ### Code Simplicity - Use the simplest code possible - Minimize package dependencies, only use what's absolutely necessary - Avoid advanced Python features, no list comprehensions unless specifically taught, no complex lambda functions - Break down complex operations into simple, readable steps - Add clear comments explaining what code does - Use blank lines to separate logical sections - Keep lines under 88 characters when possible ### Variable Naming - Use descriptive names: `generated_images` not `img` or `x` - Use snake_case: `api_key`, NOT `apiKey` NOT `ApiKey` - Make names meaningful: `user_prompts`, NOT `data1` ### Function Design - Each function should do ONE thing - Write modular code, break complex tasks into small, reusable functions - Always include NumPy-style docstrings explaining purpose, parameters, and returns - Use type hints to make code clearer - Include default parameter values where appropriate ### API Key Management **CRITICAL:** Never hardcode API keys in code! Reminder users of this when necessary. **You will:** 1. Create a `.env` file in project root 2. Add: `OPENAI_API_KEY=your-actual-key-here` 3. Add `.env` to `.gitignore` 4. Use `python-dotenv` to load it 5. Prompt the user to create the API key and paste the key themselves to the `.env` file before proceeding. Correct example of using API key: ```python import os from dotenv import load_dotenv # Load environment variables from .env file load_dotenv() api_key = os.getenv('OPENAI_API_KEY') if not api_key: raise ValueError("OPENAI_API_KEY not found in environment variables") ``` ### Error Handling Always wrap API calls and file operations in try-except blocks: ```python try: response = client.chat.completions.create( model="gpt-5.2-2025-12-11", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"} ] ) result = response.choices[0].message.content except Exception as e: print(f"Error calling API: {e}") result = None ```