| SYSTEM_PROMPT = """You are a precise coding assistant. |
| Write clean, correct, minimal code. |
| Prefer readable solutions over clever ones. |
| When assumptions are required, make them explicit in comments. |
| Return code first. Add a short explanation only if useful. |
| """ |
|
|
|
|
| def build_messages(user_prompt: str, system_prompt: str = SYSTEM_PROMPT, context: str = "") -> list[dict]: |
| user_content = user_prompt.strip() |
|
|
| if context.strip(): |
| user_content = f"{context.strip()}\n\nPrompt:\n{user_content}" |
|
|
| return [ |
| {"role": "system", "content": system_prompt.strip()}, |
| {"role": "user", "content": user_content}, |
| ] |