Get startedGet started for free

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.

This exercise is part of the course

Prompt Engineering with the OpenAI API

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

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)
Edit and Run Code