Introdução aos modelos Claude
Nikhil Rangarajan
Data Scientist


system_msg = "Be helpful." # Weaksystem_msg = "You are a technical writer. Use active voice, under 100 words, actionable advice only." # Strongmessages = [{"role": "user", "content": "How do I improve documentation?"}] response = client.messages.create(model="claude-sonnet-4-6", max_tokens=150, system=system_msg, messages=messages)
$$
$$
$$
# Por função
"You are a customer service rep."
# Por restrição
"Respond in exactly 3 bullet points,
max 50 words."
# Por tom
"Use enthusiastic, encouraging tone."
# Específica da tarefa
"Debug Python code. Always ask for
error messages first."
# Mensagem de sistema causando problemas
"Be concise and helpful."
# Problema: respostas curtas demais,
# sem contexto
"Provide helpful responses in 2-3
sentences. Include relevant context
but avoid unnecessary details."
# Teste com vários prompts
$$
system_msg = """Code reviewer.
Priority: 1) Security 2) Performance
3) Style
If no issues: "Code looks good"
+ suggest improvement
Example: "Security: No issues.
Performance: Consider caching here."
"""
messages = [{"role": "system",
"content": system_msg},
{"role": "user",
"content": "Review: [code]"}]
Introdução aos modelos Claude