MulaiMulai sekarang secara gratis

Multi-step prompt to plan a trip

You noticed that the single-step prompt was not effective, because the answer was too vague for what you had in mind. You improve your prompt by specifying the steps to follow for planning. The plan should have four potential locations for your beach vacation, and each location should have some accommodation options, some activities, and an evaluation of the pros and cons.

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

The get_response() function in this exercise employs the max_tokens parameter to help this exercise run faster. This may truncate your solution.

Latihan ini adalah bagian dari kursus

Prompt Engineering with the OpenAI API

Lihat Kursus

Petunjuk latihan

  • Create a multi-step prompt asking the model to make a plan for a beach vacation, which should include: four potential locations, each with some accommodation options, some activities, and an evaluation of the pros and cons.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

client = OpenAI(api_key="")

# Create a prompt detailing steps to plan the trip
prompt = """____"""

response = get_response(prompt)
print(response)
Edit dan Jalankan Kode