Generative AIby Dhruv Narang

1. What Is a Prompt?

Definition

A prompt is the input you give to a large language model to get the response you want.

Weak prompt
"Tell me about tokens."
  • No clear task
  • No context: who is asking?
  • No format: the answer can be any length
→
Strong prompt
Explain what a token is to a student who already knows Python in 2 lines, with one example.
Instructionwhat to do Contextwhat it needs to know Formathow the answer should look

2. The System Prompt

Definition

A system prompt is an instruction you give the model before the conversation. It sets the model's role, behaviour and rules.

Every production chatbot, from a finance assistant to a health bot or a support agent, is configured with a system prompt first. Real products stack more layers on top, and we build those later. At its core, a system prompt fixes the model's role, its behaviour and its rules. A strong one spells out five things, and you add only the ones your app needs.

One system prompt from a finance chatbot, split into its parts
RoleYou are a personal finance chatbot. ToneBe polite and use simple language. TaskHelp users make a monthly budget. LimitsGive no stock advice. Answer only finance questions. FormatUse a maximum of 3 bullet points.

3. Three Types of Messages

The system prompt is sent as a message. In fact, the model does not get one plain string. It gets a list of messages, and each message has a role. You send System and Human messages. The model sends back an AI message.

System message
"Answer in one word."
Rules for the model. Written by you, the developer.SystemMessage
Human message
"Capital of Rajasthan?"
The question. It comes from the user.HumanMessage
you send→
LLMreads the messages
replies→
AI message
"Jaipur"
The reply from the model.AIMessage

System sets the rules. Human asks. AI answers.