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

Input-output examples for code generation

You work as a project manager and need to estimate the time it will take to complete different projects. Your task is to develop a Python function that can predict the estimated completion time for a project based on historical data. You are given a set of examples in the examples string where different factors are associated with project completion time. Each example includes the factors' numerical values and the corresponding estimated completion time.

The OpenAI package and the get_response() function have been pre-loaded for you, as well as the examples string.

Bu egzersiz

Prompt Engineering with the OpenAI API

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

Egzersiz talimatları

  • Craft a prompt that asks the model to infer the Python function that maps the inputs to the outputs in the provided examples.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

client = OpenAI(api_key="")

examples="""input = [10, 5, 8] -> output = 23
input = [5, 2, 4] -> output = 11
input = [2, 1, 3] -> output = 6
input = [8, 4, 6] -> output = 18
"""

# Craft a prompt that asks the model for the function
prompt = ____

response = get_response(prompt)
print(response)
Kodu Düzenle ve Çalıştır