Prompt design

Introduction to Prompt Design

Claude is trained to be a helpful assistant. It is used to speaking in dialogue and you can instruct it in regular English.

Think of Claude as a newly-hired contractor. It doesn’t have any context about you, your task, or your organization. Give it very specific instructions about exactly what you’d like it to do.

There are certain techniques we recommend you use in order to encourage Claude to respond in certain ways. The following pages contain guidance and examples for using these techniques.


What is a prompt?

The text that you give Claude is designed to elicit, or "prompt", a relevant response. A prompt is usually in the form of a question or instruction. For example:


Human: Why is the sky blue?

Assistant:

Prompts sent via the API must contain \n\nHuman: and \n\nAssistant: as the signals of who's speaking. In Slack and our web interface we automatically add these for you.

Why?

Claude has been trained and fine-tuned using RLHF (reinforcement learning with human feedback) methods on Human: and Assistant: data like this, so you will need to use these prompts in the API in order to stay “on-distribution” and get the expected results.

What's a response?

The text that Claude responds with is called a "response".

The sky appears blue to us due to how the molecules in the air scatter light from the sun. The shorter wavelength light (blue) scatters more easily than the longer wavelength light (like reds and yellows), so when we look up at the sky, what we see is all the scattered blue light. This is known as Rayleigh scattering. The color of the sky varies based on conditions like the angle of the sun and amount of dust/water in the air, but during the day with a clear sky, the blue wavelength of light is most responsible for the color we perceive.

"Putting words in Claude's mouth"

The Human: / Assistant: prompt style has a couple of useful features. First, it allows ongoing conversations by sending Claude things it has said in the past. For example:


Human: Please select a random fruit.

Assistant: Here is a random fruit I've selected for you:

Papaya.

Human: What color is the fruit?

Assistant:

This is how Claude is able to have long conversations and remember the context: history is fed in with each successive prompt.

Additionally, you can use this as a technique to "put words in Claude's mouth", giving it context that it didn't actually say, but we're making it think it has said. You'll see this in future sections as an advanced prompting technique: it allows us to prime Claude with examples, set the tone of conversations, and generally direct the conversation.

Prompt length

The maximum length of prompt that Claude can see is its context window. Claude's context window is currently ~6500 words / ~8000 tokens / ~28000 Unicode characters.

Right now when this context window is exceeded in the API Claude is likely to return an incoherent response. We apologize for this “sharp edge”, it will be fixed in the near future.

Was this page helpful?
Previous
Glossary