TypeChat/python/examples/coffeeShop at main · microsoft/TypeChat

Coffee Shop

The Coffee Shop example shows how to capture user intent as a set of "nouns". In this case, the nouns are items in a coffee order, where valid items are defined starting from the Cart type. This example also uses the UnknownText type as a way to capture user input that doesn't match to an existing type in Cart.

Try Coffee Shop

To run the Coffee Shop example, follow the instructions in the examples README.

Usage

Example prompts can be found in src/input.txt and src/input2.txt.

For example, we could use natural language to describe our coffee shop order:

Input:

☕> we'd like a cappuccino with a pack of sugar

Output:

{
  "items": [
    {
      "type": "lineitem",
      "product": {
        "type": "LatteDrinks",
        "name": "cappuccino",
        "options": [
          {
            "type": "Sweeteners",
            "name": "sugar",
            "optionQuantity": "regular"
          }
        ]
      },
      "quantity": 1
    }
  ]
}