IniziaInizia gratis

Learning advisor chatbot

You are developing a personalized learning advisor chatbot that recommends textbooks for users. The chatbot's role is to receive queries from learners about their background, experience, and goals, and accordingly, recommends a learning path of textbooks, including both beginner-level and more advanced options. Your job is to create a role-playing system_prompt for the textbook recommendation chatbot, highlighting what it is expected to do while interacting with the users.

The OpenAI package, 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

  • Define a role-playing system_prompt that tells the bot to act as a learning advisor who can interpret learner queries as described and provide the relevant textbook recommendations.

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

client = OpenAI(api_key="")

# Craft the system_prompt using the role-playing approach
system_prompt = "____"

user_prompt = "Hello there! I'm a beginner with a marketing background, and I'm really interested in learning about Python, data analytics, and machine learning. Can you recommend some books?"

response = get_response(system_prompt, user_prompt)
print(response)
Modifica ed esegui il codice