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 BermanIntervenant · Forward Future
Chaîne
Matthew Berman
Publié
8 mars 2023
Vidéo
14:55
Lecture
2 min
Diapositives
3
Original
anglais
Ouvrir sur YouTube
En faisant défiler, la vidéo se réduit en bas à droite et continue. Les sous-titres suivent votre langue de lecture.
Langue de lectureDisponible en 2 langues
Cet article n’est pas encore disponible en français ; il s’affiche dans l’original en anglais.
RÉSUMÉ

En 30 secondes

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.

À retenir

  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.
TEXTE INTÉGRAL

Lire le texte remanié, chapitre par chapitre

Transcription seule
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
DIAPOSITIVE 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
DIAPOSITIVE 2 / 3Storing the API resultThe workflow selects a returned choice and stores it in a custom state.
Chatbot preview
DIAPOSITIVE 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.

Sur la même chaîne

6 diapositives25:50EN
MBMatthew Berman· 24 oct. 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 diapositives32:20EN
MBMatthew Berman· 23 oct. 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
45:08EN
MBMatthew Berman· 21 oct. 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
0:32EN
MBMatthew Berman· 21 oct. 2026Sam Altman on the Continuing Demand for Software WorkSam Altman, Matthew Berman · OpenAIIn a short interview excerpt, Altman says demand for software may be larger than expected even as AI changes how it is made.Future of WorkSoftware engineeringAgents de code
5 diapositives12:14EN
MBMatthew Berman· 14 oct. 2026Gemini 4 Argon Tested: 3D Demos, a Spreadsheet Prototype and Benchmark ResultsMatthew Berman · Forward FutureMatthew Berman tests Google’s model on games and visual projects, then compares reported coding and agent benchmarks.GeminiBenchmarksAgents de code+1
5 diapositives10:36EN
MBMatthew Berman· 13 oct. 2026Meta Muse Wonder Tested: Strong Benchmarks, Mixed Demos and Quota FrictionMatthew Berman · Forward FutureMatthew Berman tests Meta’s models on browser demos and reviews their published benchmark scores, availability and cost.Modèles et entraînementBenchmarksAI cost & performance+1