BaşlayınÜcretsiz Başlayın

Using delimited prompts with f-strings

You are a junior developer at a dynamic startup that generates content with the help of AI. The company believes this technology can revolutionize storytelling, and you are excited to be a part of it. Today, your task is to generate a continuation of a story with a delimited prompt using an f-string.

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

Bu egzersiz

Prompt Engineering with the OpenAI API

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Create a prompt asking to complete the variable story (provided to you as a string): use f-string, and delimit the story with triple backticks (```) to pass its content to the prompt.
  • Get the generated response.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

client = OpenAI(api_key="")

# Create a prompt that completes the story
prompt = ____

# Get the generated response 
response = ____

print("\n Original story: \n", story)
print("\n Generated story: \n", response)
Kodu Düzenle ve Çalıştır