Skip to content

Example of FastAPI application for streaming OpenAI responses using Server-Sent Events (SSE)

Notifications You must be signed in to change notification settings

talesmousinho/fastapi-openai-sse-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI OpenAI Server-Sent Events Stream

This is a Python FastAPI application that return OpenAI's response has a stream of Server-Sent Events.

Setup

Install the dependencies:

poetry install

Environment Variables

Before running the application or the tests, copy .env.example to .env and fill in the appropriate values:

cp .env.example .env

Usage

To run the application:

poetry run uvicorn app.main:app

This will start a development server at http://localhost:8000/.

Testing

To run the tests:

poetry run pytest

About

Example of FastAPI application for streaming OpenAI responses using Server-Sent Events (SSE)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages