Coding Now – Best AI & Full Stack Courses in Delhi NCR | 100% Placement
Limited Offer: Get 50% OFF on AI & Full Stack Courses
📞 Call Now: +91 9667708830
Back to Generative AI Notes
Topic #504

User Prompt

The user prompt is the specific request or question for this turn — where the system prompt sets standing rules, the user prompt is the actual task the model needs to act on right now.

System vs User — Division of Responsibility

System PromptUser Prompt
ScopePersists across the whole conversationSpecific to this one turn
Typical contentPersona, constraints, format rulesThe actual question, task, or request
Who writes itThe application developer, fixedOften the end user (or dynamically constructed with retrieved context)

Example

system: "You are a coding assistant. Only answer Python questions.
         Always include a brief explanation with code examples."

user:   "How do I reverse a list in Python?"

The system prompt never changes across the conversation; each new user message is a new specific request within those standing rules.

Constructing User Prompts Dynamically

In real applications, the "user prompt" sent to the API is often not the literal text the user typed — it's typically been augmented with retrieved context (RAG), formatting instructions, or conversation history summaries before being sent:

raw_user_input = "What's the refund policy for damaged items?"

# Application constructs the actual user message sent to the API:
augmented_user_message = f"""
Context from documentation:
{retrieved_chunks}

Customer question: {raw_user_input}

Answer using only the context above.
"""

Practical Use Case

Understanding this separation is what makes RAG, conversation memory, and multi-turn applications possible — the "user prompt" the model sees is often a constructed, richer version of what the person actually typed, assembled by application code.

Common Mistakes

  • Putting standing behavioral rules in every user message instead of the system prompt — wastes tokens repeating the same instructions turn after turn
  • Forgetting that the "user prompt" your code sends to the API isn't always literally what the user typed — debugging issues requires inspecting the actual constructed prompt, not just the raw user input

Interview Relevance

"If a user's question isn't being answered correctly in a RAG chatbot, what would you check first?" — inspecting the actual constructed user prompt (with retrieved context) sent to the model, not just the user's raw input, is the practical first debugging step.

Practice Question

Write the code (pseudocode is fine) that constructs a user prompt combining a raw user question with 2 retrieved document chunks and a formatting instruction.

Related Notes

Want to go beyond the notes?

Join CodingNow's Generative AI course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available
💬 Talk to Advisor
1
WhatsApp

Latest from Our Blog

Insights on AI, Data Science, Full Stack & Career

View All Articles →