Skip to main content

Prompt formatting

The following code gives an example of automatically formatting a prompt during inference to match the expected format for the given model. Note, not all models include a prompt_format; make sure you validate that a prompt format is present in your code.
python

Grammar correction

Try RedPajama-INCITE-Chat-3B to correct sentences to standard English.
  1. For example, begin the prompt by asking to correct the grammar of a sentence:
Correct this to standard English: I no Sandwich want.
  1. Sample response
I don’t want a sandwich.
  1. Send the prompt to the API with any appropriate parameters. The code below shows an example in Python using the requests package.
python

Further reading

Prompt engineering is a relatively new discipline for developing and optimizing prompts to efficiently use language models (LMs) for a wide variety of applications and research topics. The Prompt Engineering Guide is a great introduction to the subject. Updated 22 days ago