Get startedGet started for free

Customer support ticket analysis

The customer support team receive tickets through various channels, such as email, chat, and social media. The company wants to automatically extract key entities to categorize and prioritize the tickets appropriately. Your job is to craft a few-shot prompt that helps them achieve that.

You have three sample tickets (ticket_1, ticket_2, and ticket_3) and their corresponding entities (entities_1, entities_2, and entities_3) to inform the model on what to look for and how to display it. You need the model to extract entities from the new ticket_4 string.

The OpenAI package, the ticket_4 string, and the get_response() function have been pre-loaded for you, as well as the ticket and entity variables previously mentioned.

This exercise is part of the course

Prompt Engineering with the OpenAI API

View Course

Exercise instructions

  • Craft a few-shot prompt that uses three tickets and corresponding entities, to extract entities from the new ticket ticket_4.

Hands-on interactive exercise

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

client = OpenAI(api_key="")

# Craft a few-shot prompt to get the ticket's entities
prompt = ____

response = get_response(prompt)

print("Ticket: \n", ticket_4)
print("Entities: \n", response)
Edit and Run Code