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 Berman登壇者 · Forward Future
チャンネル
Matthew Berman
公開日
2023年3月8日
動画
14:55
読了時間
2 分
スライド
3
原文
英語
YouTube で開く
スクロールすると動画は右下に小さくなって再生を続けます。字幕は閲覧言語に合わせて切り替わります。
閲覧言語2 言語で読めます
この記事はまだ日本語に翻訳されていないため、英語の原文を表示しています。
要約

30 秒でわかる

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.

ポイント

  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.
全文

チャプターごとに整えた全文を読む

文字起こしのみ
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
スライド 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
スライド 2 / 3Storing the API resultThe workflow selects a returned choice and stores it in a custom state.
Chatbot preview
スライド 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.

同じチャンネルの記事

スライド 6 枚25:50EN
MBMatthew Berman· 2026年10月24日Kimi 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 枚32:20EN
MBMatthew Berman· 2026年10月23日Who 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· 2026年10月21日Sam 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· 2026年10月21日Sam 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 engineeringコーディングエージェント
スライド 5 枚12:14EN
MBMatthew Berman· 2026年10月14日Gemini 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.GeminiBenchmarksコーディングエージェント+1
スライド 5 枚10:36EN
MBMatthew Berman· 2026年10月13日Meta 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.モデルと学習BenchmarksAI cost & performance+1