MulaiMulai sekarang secara gratis

Exploring prompt engineering

Prompt engineering refers to crafting effective prompts to guide the language model towards the intended response. By refining your prompts, you can achieve better results and guide the model towards generating more accurate and useful responses. Your task in this exercise is to modify the prompt you used in the previous exercise.

The OpenAI package and the get_response() function have been pre-loaded for you.

Latihan ini adalah bagian dari kursus

Prompt Engineering with the OpenAI API

Lihat Kursus

Petunjuk latihan

  • Craft a prompt that asks the model to generate a poem about ChatGPT while ensuring that it is written in basic English that a child can understand.
  • Get the response using the get_response() function.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

client = OpenAI(api_key="")

# Craft a prompt that follows the instructions
prompt = "____"

# Get the response
response = ____

print(response)
Edit dan Jalankan Kode