Skip to content

Coding-Crashkurse/LangChain-FastAPI-Streaming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI GPT-3.5-turbo Streaming API with FastAPI

This project demonstrates how to create a real-time conversational AI by streaming responses from OpenAI's GPT-3.5-turbo model. It uses FastAPI to create a web server that accepts user inputs and streams generated responses back to the user.

Running the Project

  1. Clone the repository.
  2. Install Python (Python 3.7+ is recommended).
  3. Install necessary libraries. This project uses FastAPI, uvicorn, LangChain, among others. You can install them with pip: pip install fastapi uvicorn langchain.
  4. Add your OpenAI API key to the .env file.
  5. Start the FastAPI server by running uvicorn main:app in the terminal.
  6. Access the application by opening your web browser and navigating to localhost:8000.

Note: Ensure the appropriate CORS settings if you're not serving the frontend and the API from the same origin.

Project Overview

The project uses an HTML interface for user input. The user's input is sent to a FastAPI server, which forwards it to the GPT-3.5-turbo model. The generated response is streamed back to the user, simulating a real-time conversation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published