Use GPT-3 to seed MURAL

Sarah Packowski
5 min readDec 31, 2022

--

OpenAI’s API is unbelievably easy to use! See how to use a GPT model to generate sticky notes to seed creative activity in MURAL.

Samples: https://github.com/spackows/MURAL-API-Samples

Using the MURAL API to post sticky notes generated by GPT-3

OpenAI API

OpenAI is an AI research and development company known for developing large language models, such as Generative Pre-trained Transformer (GPT) models, and most recently: ChatGPT. OpenAI provides an API for using their models.

MURAL

Mural is an online tool that is like a virtual whiteboard: you can draw shapes, stick notes, and move things around. It’s a fabulous tool for visually organizing ideas, designing solutions, and collaborating with teammates — in real time or asynchronously. I love using MURAL for team collaboration!

Prospective hindsight

Prospective hindsight is the act of projecting yourself into the future and then reflecting back on events that (might have) happened between now and then.

For example, if I plan to open a lemonade stand business, I don’t just ask myself: “What risks should we consider?” Instead, I ask: “It’s 6 months from now and our lemonade stand has failed! What went wrong?”

It might seem like a small difference, but there is evidence this mental shift can help you more successfully identify those risk factors:

prospective hindsight — imagining that an event has already occurred — increases the ability to correctly identify reasons for future outcomes by 30%

Exercise

My fellow lemonade stand founders and I want to perform a prospective hindsight activity to identify potential business risks. We want to perform this activity collaboratively in MURAL. Before we begin, we want to seed the mural with sample failure scenarios generated by GPT-3.

The following video walks through the steps listed below:

Prerequisites

Step 1: Create a mural for the activity

  1. Create a new mural with a “Resizable blank canvas”
  2. [Optional] Put a nice title and imagery in the blank mural
A blank mural for our prospective hindsight exercise
A blank mural for our prospective hindsight exercise

Step 2: Generate failure scenarios

To get a list of 10 ways our lemonade stand might fail, prompt the GPT model: “List 10 ways a lemonade stand might fail. Be concise.”

The following Python code sends a prompt in a POST request to OpenAI’s /completions endpoint.

Note: You can get your OpenAI API key here: API keys

import os
import requests
import json

def sendPrompt( prompt_txt ):
# https://beta.openai.com/docs/api-reference/completions/create
url = "https://api.openai.com/v1/completions"
headers = { "Content-Type" : "application/json",
"Authorization" : "Bearer " + os.environ[ "OPENAI_APIKEY" ] }
data = json.dumps( { "model" : "text-davinci-003",
"prompt" : prompt_txt,
"max_tokens" : 150 } )
response = requests.request( "POST", url, headers=headers, data=data )
print( json.dumps( response.json(), indent=3 ) )


g_prompt_txt = "List 10 ways a lemonade stand might fail. Be concise."

sendPrompt( g_prompt_txt )

Here is a sample of results:

Example result from OpenAI API GPT-3 /completions endpoint for the prompt to list failure reasons
Example result from OpenAI API GPT-3 /completions endpoint for the prompt to list failure reasons

Step 3: Write stories for the failure scenarios

For each failure reason, we need to generate a short story, written in past tense, to flesh out the failure scenario. To generate such a story, prompt the GPT model: “In 100 words or less, describe how our lemonade stand failed because of: <reason>”

import os
import requests
import json

def sendPrompt( prompt_txt ):
# https://beta.openai.com/docs/api-reference/completions/create
url = "https://api.openai.com/v1/completions"
headers = { "Content-Type" : "application/json",
"Authorization" : "Bearer " + os.environ[ "OPENAI_APIKEY" ] }
data = json.dumps( { "model" : "text-davinci-003",
"prompt" : prompt_txt,
"max_tokens" : 150 } )
response = requests.request( "POST", url, headers=headers, data=data )
print( json.dumps( response.json(), indent=3 ) )


g_prompt_txt = """
In 100 words or less, describe how our lemonade
stand failed because of: bad location
"""

sendPrompt( g_prompt_txt )

Here is a sample of results:

Example result from OpenAI API GPT-3 /completions endpoint for the prompt to tell a story about a failure
Example result from OpenAI API GPT-3 /completions endpoint for the prompt to tell a story about a failure

Note: When you generate a story for the same reason multiple times, it’s interestingly different each time. Here’s the result when I run the same prompt again:

Another result from OpenAI API GPT-3 /completions endpoint for the same prompt
Another result from OpenAI API GPT-3 /completions endpoint for the same prompt

There might be value for this exercise in generating the list of reasons multiple times and in generating multiple stories for a given reason, just to spark more discussion and creativity.

Step 4: Post failure scenarios in the mural

For each reason and corresponding story, post the content in your mural. You could do this by hand, or you could use the MURAL API.

This GitHub repo contains sample Python code for the OpenAI API and the MURAL API: Seed a mural with GPT-3 using the OpenAI API

Note: To use the MURAL API, you need to generate an OAuth 2.0 token. You can do that by setting up OAuth 2.0 in Postman or by deploying an OAuth 2.0 application.

A mural for a prospective hindsight exercise, seeded with example failure scenarios from GPT-3
A mural for a prospective hindsight exercise, seeded with example failure scenarios from GPT-3

Now, our lemonade team can use the GPT-generated failure scenarios to jump-start discussion and inspire our own ideas for ways our lemonade stand could have failed.

Conclusion

What can you do with a tool that generates text as coherent as a human might write, but that doesn’t understand what it’s writing? One that doesn’t know true from false, fact from fiction, or right from wrong? You could fine-tune the model, build guardrails to avoid egregious errors, and add fact-checking functionality to wrangle output. But the simplest, best-fitting use cases would be ones that require creative story-telling that is informed by common knowledge, where factual accuracy isn’t required, and where indeterminate or wacky content is a feature not a bug.

--

--

Sarah Packowski
Sarah Packowski

Written by Sarah Packowski

Design, build AI solutions by day. Experiment with input devices, drones, IoT, smart farming by night.

No responses yet