Back to Generative AI Notes
Topic #51

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.

Want to go beyond the notes?

Join Coding Now Tech Institute's Generative AI course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

User Prompt – FAQs

Quick answers about learning User Prompt in Generative AI.

This free note from Coding Now Tech Institute explains User Prompt in Generative AI — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Generative AI topic on Coding Now Tech Institute, including User Prompt, is 100% free with no signup required.
With focused practice, most students grasp User Prompt in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now