Is there a way to let gpt-3 output actions?

Let’s say my chat bot is going to use on a restaurant Facebook messenger.
First I can build a QA bot like this example
Quick explain is that using embedding to choose the relative context and add it in the prompt, by doing this gpt-3 can know my restaurant information (like phone, address…)

This works great, but my question is that can I have a reply text and an action?
Example:

# example1
user: where's your location?
gpt-3: Our address is {address}
gpt-3: {the link of my restaurant in google map}
# Example1 knows user are asking for location, so do sending google map link action

#example2
user: I need your menu
gpt-3: Sure here's our menu
gpt-3: {send menu image}
# Example2 knows user are asking about menu, so after replying the user will do a send menu action

Is adding the action need to do to the original context a good idea? Or doing a fuzzy search to the reply of gpt-3 to choose a suitable action?
Anyone have an idea?

2 Likes

I’ve seen this be done by defining the possible actions in the prompt, usually with the names of the actions in all UPPERCASE, and requesting that the model selects one of those actions in its output.

This recent video shows an example using the ChatGPT API First look at ChatGPT API - the age of Autonomous AI begins TODAY! Cognitive Architectures ahoy! - YouTube

And this is an earlier but significant example: natbot/natbot.py at main · nat/natbot · GitHub

1 Like