IniziaInizia gratis

Explaining code step by step

As a financial analyst at a consulting firm, you're tasked with analyzing investment portfolios and providing insights to clients. While reviewing a set of financial data files, you come across a Python function that seems related to analyzing portfolios, but you're unsure of its exact purpose. You decide to use chain-of-thought prompting to let the language model decipher it step by step.

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

Questo esercizio fa parte del corso

Prompt Engineering with the OpenAI API

Visualizza il corso

Istruzioni dell'esercizio

  • Craft a chain-of-thought prompt that asks the model to explain the provided function.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

client = OpenAI(api_key="")

# Craft a chain-of-thought prompt that asks the model to explain what the function does
prompt = ____
 
response = get_response(prompt)
print(response)
Modifica ed esegui il codice