Skip to content

Customer call routing

Automatically route customer calls to the right department.

Call routing

import marvin
from enum import Enum

class Department(Enum):
    SALES = "sales"
    SUPPORT = "support"
    BILLING = "billing"

# define a convenience function
def route_call(transcript: str) -> Department:
    return marvin.classify(
        instructions="Select the best department for the customer request",

💳 Update payment method

department = route_call("I need to update my payment method")
assert department == Department.BILLING

💵 Price matching

department = route_call("Well FooCo offered me a better deal")
assert department == Department.SALES

🤬 Angry noises

department = route_call("*angry noises*")
assert department == Department.SUPPORT