Which AI models support pre-defined instructions (system prompts, docs, links)?
#gen-ai#prompt-engineering
Answer
AI Models That Support Predefined Instructions (System Prompts)
System prompts let you give an AI model persistent instructions before any user message.
All Major Models Support System Prompts
| Model | Provider | How to Pass System Prompt |
|---|---|---|
| Claude | Anthropic | text |
| GPT-4o | OpenAI | text |
| Gemini 1.5 Pro | text | |
| Llama 3.1 | Meta | System role in messages array |
| Mistral | Mistral AI | System role in messages |
| DeepSeek | DeepSeek | OpenAI-compatible system role |
| Command R+ | Cohere | text |
Implementation Examples
python# Anthropic Claude import anthropic client = anthropic.Anthropic() response = client.messages.create( model="claude-opus-4-6", system="You are a senior Python engineer. Always use type hints and docstrings.", messages=[{"role": "user", "content": "Write a function to parse JSON safely"}] )
python# OpenAI GPT-4o from openai import OpenAI client = OpenAI() response = client.chat.completions.create( model="gpt-4o", messages=[ {"role": "system", "content": "You are a concise technical assistant."}, {"role": "user", "content": "Explain transformers in 3 lines"} ] )
python# Google Gemini import google.generativeai as genai model = genai.GenerativeModel( model_name="gemini-1.5-pro", system_instruction="You are a Python expert. Be concise and use type hints." ) response = model.generate_content("Write a binary search function")
Persistent Instructions via Config Files
Beyond API system prompts, tools support persistent per-project instructions:
| Tool | Config File | Scope |
|---|---|---|
| Claude Code | text | Project directory |
| Gemini CLI | text | Project directory |
| Cursor | text | Coding style rules |
| Aider | text | Coding conventions |
System Prompt Best Practices
- Define role: "You are a senior backend engineer specializing in FastAPI"
- Set output format: "Always respond with code examples and type hints"
- Add constraints: "Never suggest deprecated Python 2 syntax"
- Include context: "This project uses PostgreSQL 15 and SQLAlchemy 2.0"
- Keep it under 1000 tokens for most use cases