# Jessica Shieh - Best practices for prompt engineering with OpenAI API (Highlights) ![rw-book-cover|256](https://static.intercomassets.com/assets/educate/educate-favicon-64x64-at-2x-52016a3500a250d0b118c0a04ddd13b1a7364a27759483536dd1940bccdefc20.png) ## Metadata **Review**:: [readwise.io](https://readwise.io/bookreview/25579993) **Source**:: #from/readwise **Zettel**:: #zettel/fleeting **Status**:: #x **Authors**:: [[Jessica Shieh]] **Full Title**:: Best practices for prompt engineering with OpenAI API **Category**:: #articles #readwise/articles **Category Icon**:: 📰 **URL**:: [help.openai.com](https://help.openai.com/en/articles/6654000-best-practices-for-prompt-engineering-with-openai-api) **Host**:: [[help.openai.com]] **Highlighted**:: [[2023-03-22]] **Created**:: [[2023-03-28]] ## Highlights - Put instructions at the beginning of the prompt and use ### or """ to separate the instruction and context ([View Highlight](https://read.readwise.io/read/01gw3mft2qbdkata9t57cspdxv)) ^495524230 - Articulate the desired output format through examples ([View Highlight](https://read.readwise.io/read/01gw3n2wenskfbk88qed3f4010)) ^495526563 Example: ``` Desired format: Company names: <comma_separated_list_of_company_names> People names: -||- Specific topics: -||- ``` ▮ - Code Generation Specific - Use “leading words” to nudge the model toward a particular pattern ([View Highlight](https://read.readwise.io/read/01gw3mrg28bqzem6bm7aec8wq7)) ^495525179 For example,use `import` for Python. - **`temperature` -** A measure of how often the model outputs a less likely token. The higher the `temperature`, the more random (and usually creative) the output. This, however, is not the same as “truthfulness”. For most factual use cases such as data extraction, and truthful Q&A, the `temperature` of 0 is best. ([View Highlight](https://read.readwise.io/read/01gw3mw1dnw4k6qpnnk259d7bv)) ^495525866