Building a Simple Chatbot With Python or Bubble

Matthew Berman walks through a historical OpenAI API demo using Colab and Gradio, then a Bubble no-code workflow.

MBMatthew BermanSpeaker · Forward Future
Channel
Matthew Berman
Published
Mar 8, 2023
Video
14:55
Read
2 min
Slides
3
Original
English
Open on YouTube
Scroll to read and the video shrinks to the bottom-right corner. Captions follow your reading language.
Reading languageAvailable in 2 languages
You're reading the original English.
SUMMARY

In 30 seconds

Matthew Berman demonstrates two basic chatbot interfaces: a Python notebook using Gradio and a Bubble app using an API connector. The video uses older API and SDK conventions, so readers should check current documentation and protect their API credentials.

  1. 1Python setupA Colab notebook installs the OpenAI and Gradio libraries.
  2. 2Request and responseThe example sends a user message and extracts the returned message content.
  3. 3No-code connectorBubble’s API Connector provides a POST action with private authentication.
  4. 4Workflow and displayThe button sends the input, stores the response and displays it in a text element.

Takeaways

  1. The Python example wraps an API call in a Gradio text interface.
  2. The Bubble example connects a button workflow to an API action and a response display.
  3. The original tutorial uses historical model names and SDK syntax that may need updating.
  4. API keys must remain private and should not be embedded in shared notebooks or client-side code.
  5. The demo is a basic prompt-and-response interface rather than a full conversation-history implementation.
FULL TEXT

Read the edited text by chapter

Transcript only
01

Python and Gradio

Berman sets up a notebook and wraps a chat-completion call in a simple interface. The demonstration uses historical API syntax.

I demonstrate two ways to build a simple chatbot using the OpenAI API: a Python notebook with Gradio and a no-code interface in Bubble. This is a historical tutorial using the API and libraries available at the time; current interfaces, model names and SDK syntax may differ.

For the Python example I use an OpenAI API key and a Google account for Colab. I create a notebook and install the OpenAI and Gradio libraries. Colab runs notebook cells and makes it easy to experiment without setting up a local Python environment.

The example imports the libraries and configures API access, then defines a function that sends the user’s prompt to the chat-completion endpoint. The demonstrated model is GPT-3.5 Turbo. API credentials should be kept secret rather than embedded in shared notebooks or client-side code.

The request contains a messages array with a user role and the entered text. I explain that a system message can provide general instructions for the assistant, while the user message contains the prompt. The response contains choices, from which the example extracts the returned message text.

I create a Gradio interface around the function with text input and output, then launch it in Colab. A test prompt asking for a joke returns a response. This is a simple prompt-and-response demonstration; the video does not build a persistent conversation history.

02

Bubble API connector

He creates a no-code app and configures an authenticated JSON API action. Credentials must remain private.

The second approach uses Bubble. I create an app, install its API Connector plugin and configure a private authorization header, a JSON content type and a POST action for the chat-completion endpoint. Credentials need to stay private and server-side when an app is shared.

The request body specifies the model and a user message, with a dynamic value for the prompt. I initialize the call using an example prompt so Bubble can inspect the response structure. This tutorial uses the endpoint and settings shown in the video, which may require updates with newer versions.

03

Page and workflow

He adds input, button and response elements, then binds the workflow to the returned message. A preview tests short and longer prompts.

In Bubble’s design view I add a multiline input, a submit button and a text element to display the answer. The goal is a functional interface: the appearance can be customized later.

Bubble input element
SLIDE 1 / 3Bubble input elementThe design view shows a multiline input for the user’s prompt.

The button workflow calls the API action and supplies the input field’s value. A second workflow step stores the first returned message’s content in a custom state on the response element. The display element is then bound to that state.

Storing the API result
SLIDE 2 / 3Storing the API resultThe workflow selects a returned choice and stores it in a custom state.
Chatbot preview
SLIDE 3 / 3Chatbot previewThe simple page contains a prompt box and submit button.

In preview, I submit a prompt asking for a name and receive responses. A longer answer is initially clipped, so I enlarge the text element and test again. Both approaches demonstrate how a user interface can send a prompt and display the API response.

More from this channel

6 slides25:50EN
MBMatthew Berman· Oct 24, 2026Kimi K3.1 Pro Tested: Strong 3D Demos, Uneven Results and Competitive PricingMatthew Berman · Forward FutureMatthew Berman tests the open-weight model on coding, 3D rendering and visual explanations, then compares benchmark results and prices.Open-weight modelsBenchmarksAI cost & performance+1
2 slides32:20EN
MBMatthew Berman· Oct 23, 2026Who Is Local AI For? The Costs, Trade-offs and a Hybrid FutureMatthew Berman · Forward FutureMatthew Berman weighs data control and independence against hardware cost, setup complexity and inference speed.Local inferenceOpen-weight modelsAI cost & performance+1
6 slides1:03:37EN
MBMatthew Berman· Oct 23, 2026Matthew Berman’s Team Tests Kimi K3.1 on Animation, Games, and ChartsMatthew Berman, Alex, Brian · Forward FutureA live team AMA turns into an informal test of Kimi K3.1, from personal-agent workflows to motion graphics, a browser game, and a benchmark chart.Coding agentsGenerative mediaEvals+2
0:53EN
MBMatthew Berman· Oct 22, 2026Sam Altman on AI and the Discovery of New KnowledgeSam Altman · OpenAIAltman expects progress in mathematical discovery to extend to biology, materials and energy.AI for scienceMathematicsComputational Biology+1
Slides0:22EN
MBMatthew Berman· Oct 21, 2026A Robot Bodyguard Video Shows Dramatic Rescue ScenariosMatthew Berman · Forward FutureMatthew Berman reacts to a short robot demonstration depicting fighting and vehicle-rescue scenarios.RoboticsEvals
45:08EN
MBMatthew Berman· Oct 21, 2026Sam Altman on AI Discovery, Consciousness, Compute and a Human-Centered FutureMatthew Berman, Sam Altman · Forward FutureIn a conversation with Matthew Berman, Altman discusses scientific progress, personal assistants, recursive self-improvement and the importance of human agency.AI for sciencePersonal agentsConsciousness+2