Skip to content

Add a flask ai chat example.#1519

Merged
gscho merged 2 commits into
mainfrom
gscho/flask-websocket-example
Jun 29, 2026
Merged

Add a flask ai chat example.#1519
gscho merged 2 commits into
mainfrom
gscho/flask-websocket-example

Conversation

@gscho

@gscho gscho commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a flask version of https://github.com/vercel/examples/tree/main/websockets/fastapi-ai-chat

This needs to be released before merging: vercel/vercel#16811

Demo URL

Requires an AI gateway key so you need to deploy it yourself to test.

Type of Change

  • New Example
  • Example updates (Bug fixes, new features, etc.)
  • Other (changes to the codebase, but not to examples)

New Example Checklist

  • 🛫 npm run new-example was used to create the example
  • 📚 The template wasn't used but I carefuly read the Adding a new example steps and implemented them in the example
  • 📱 Is it responsive? Are mobile and tablets considered?

Signed-off-by: gscho <greg.c.schofield@gmail.com>
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

You must have Developer access to commit code to Vercel Examples on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes.

Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles

@gscho gscho requested review from dnwpark and fantix June 26, 2026 14:06
@socket-security

socket-security Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​werkzeug@​3.1.896100100100100
Addedpypi/​flask-sock@​0.7.0100100100100100

View full report

@fantix fantix left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Requires an AI gateway key so you need to deploy it yourself to test.

Maybe we can try vercel-labs/ai-python#183?

Comment thread websockets/flask-ai-chat/backend/main.py Outdated

import ai
from flask import Flask
from flask_sock import Sock

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing many Flask WebSocket tutorials using flask_socketio (from the same author but with a lot more GH ⭐) - my personal wish here is that we have a SocketIO Python example too (also being slightly different than the existing one) but that doesn't have to be this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested a version using that library and it worked as well. We could do a new example for that one

Signed-off-by: gscho <greg.c.schofield@gmail.com>
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blob-starter Ready Ready Preview, Comment Jun 26, 2026 3:32pm
blob-sveltekit Error Error Jun 26, 2026 3:32pm
cron Ready Ready Preview, Comment Jun 26, 2026 3:32pm
edge-functions-i18n Ready Ready Preview, Comment Jun 26, 2026 3:32pm
example-express-bun Ready Ready Preview, Comment Jun 26, 2026 3:32pm
example-hono-bun Ready Ready Preview, Comment Jun 26, 2026 3:32pm
example-nitro-bun Ready Ready Preview, Comment Jun 26, 2026 3:32pm
examples Ready Ready Preview, Comment Jun 26, 2026 3:32pm
examples-q42o Error Error Jun 26, 2026 3:32pm
experimentation-statsig Ready Ready Preview, Comment Jun 26, 2026 3:32pm
express-ai-sdk-demo Ready Ready Preview, Comment Jun 26, 2026 3:32pm
fastapi-ai-chat Error Error Jun 26, 2026 3:32pm
flags-sdk-openfeature Ready Ready Preview, Comment Jun 26, 2026 3:32pm
geolocation-script Ready Ready Preview, Comment Jun 26, 2026 3:32pm
hono Ready Ready Preview, Comment Jun 26, 2026 3:32pm
hono-ai-sdk Ready Ready Preview, Comment Jun 26, 2026 3:32pm
hono-mcp-example Ready Ready Preview, Comment Jun 26, 2026 3:32pm
kv-redis-starter Ready Ready Preview, Comment Jun 26, 2026 3:32pm
laurens-test Error Error Jun 26, 2026 3:32pm
litellm-gateway-demo Ready Ready Preview, Comment Jun 26, 2026 3:32pm
mint-nft Ready Ready Preview, Comment Jun 26, 2026 3:32pm
next-fastapi-monorepo Error Error Jun 26, 2026 3:32pm
nextjs-fastapi Error Error Jun 26, 2026 3:32pm
nextjs-fastapi-bindings Error Error Jun 26, 2026 3:32pm
nextjs-gin Error Error Jun 26, 2026 3:32pm
nitro Ready Ready Preview, Comment Jun 26, 2026 3:32pm
nitro-cached-handler Ready Ready Preview, Comment Jun 26, 2026 3:32pm
nitro-plugins Ready Ready Preview, Comment Jun 26, 2026 3:32pm
nitro-route-rules Ready Ready Preview, Comment Jun 26, 2026 3:32pm
postgres-drizzle Ready Ready Preview, Comment Jun 26, 2026 3:32pm
postgres-kysely Ready Ready Preview, Comment Jun 26, 2026 3:32pm
postgres-prisma Error Error Jun 26, 2026 3:32pm
postgres-starter Ready Ready Preview, Comment Jun 26, 2026 3:32pm
redirect-with-fallback Ready Ready Preview, Comment Jun 26, 2026 3:32pm
redirects-bloom-filter Ready Ready Preview, Comment Jun 26, 2026 3:32pm
rust-axum Ready Ready Preview, Comment Jun 26, 2026 3:32pm
rust-hello-world Ready Ready Preview, Comment Jun 26, 2026 3:32pm
starter-test Error Error Jun 26, 2026 3:32pm
turborepo-hono-api Error Error Jun 26, 2026 3:32pm
turborepo-hono-web Ready Ready Preview, Comment Jun 26, 2026 3:32pm
vercel-plus-fastapi Ready Ready Preview Jun 26, 2026 3:32pm
vite-fastapi Error Error Jun 26, 2026 3:32pm
xmcp-demo Ready Ready Preview, Comment Jun 26, 2026 3:32pm
14 Skipped Deployments
Project Deployment Actions Updated (UTC)
build-output-api-draft-mode Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-edge-functions Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-edge-middleware Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-image-optimization Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-isr Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-overrides Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-prerender-functions Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-routes Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-serverless-functions Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-static-files Ignored Ignored Preview Jun 26, 2026 3:32pm
build-output-api-wildcard Ignored Ignored Preview Jun 26, 2026 3:32pm
example-auth-with-ory Ignored Ignored Preview Jun 26, 2026 3:32pm
solutions-nx-monorepo Ignored Ignored Preview Jun 26, 2026 3:32pm
solutions-testing Ignored Ignored Preview Jun 26, 2026 3:32pm

@gscho gscho marked this pull request as ready for review June 29, 2026 17:51
@gscho gscho requested review from a team as code owners June 29, 2026 17:51
@gscho gscho merged commit 3313210 into main Jun 29, 2026
49 of 139 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants