Guidelines for Prompting
In this lesson, you'll practice two prompting principles and their related tactics in order to write effective prompts for large language models.
Setup
Load the API key and relevant Python libraries.
In this course, we've provided some code that loads the OpenAI API key for you.
import openai
import os
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())
openai.api_key = os.getenv('OPENAI_API_KEY')
helper function
Throughout this course, we will use OpenAI's gpt-3.5-turbo model and the chat completions endpoint.
This helper function will make it easier to use prompts and look at the generated outputs: