Natural language generation produces human-readable text from an input. A large language model can turn a request and its context into an email, a set of names, or other text. The resulting output is often called a completion. section 1.3.2 section 2.8
An LLM generates a completion iteratively: it predicts the next token, converts the result back to text, and repeats. The prompt steers that process. State the task clearly, provide the content to work from, and specify requirements such as audience, tone, or output format. section 2.8 section 6.2
Draft a launch email
Ask for a subject line and body, then supply the product details, intended audience, and a friendly, exciting tone. The model uses those constraints to draft both pieces of text. Review the result before sending it. section 1.3.2 section 6.7
For an application, choose a model that supports the needed task: regular text completions suit text generation, while chat completions suit turn-by-turn dialogue. A completion API request can set the prompt, token limit, temperature, and number of completions. Inspect the response’s generated text and finish reason; track token usage because prompt and output tokens affect cost. section 3.1.2 section 3.2.1 section 3.5
Listing 3.4 API response from a completion API
{
"choices": [ #1
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"text": "\n\n1. Pawfect Professionals \n
2. Purrsonalized Pet Pampering\n
3. Friendly Fur Services",
"content_filter_results"={...}
}
],
"created": 1689007663, #2
"id": "cmpl-7aoL1MaUEf2j3ZLfSvsUOR7EFyjqC", #3
"model": "gpt-35-turbo", #4
"object": "text_completion",
"usage": { #5
"completion_tokens": 26,
"prompt_tokens": 32,
"total_tokens": 58
}
}
The sample completion response shows where to find generated text, the finish reason, and prompt and completion token counts. section 3.2.1
Do not treat a good-looking draft as a verified answer. Repeated requests can differ, especially at higher temperatures; outputs can also be inaccurate, biased, or inappropriate. Test prompts against the intended task, consider content filtering, and monitor data quality and performance in production. section 6.7 section 11.1



















