Skip to content

This project implements the backend of a chat system with artificial intelligence using FastAPI and OpenAI.

Notifications You must be signed in to change notification settings

nuriadevs/backend-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backend Chat AI

📘 README available in Spanish

This project implements the backend of a chat system with artificial intelligence using FastAPI and OpenAI. It allows managing conversations between users and an advanced language model, providing automatic responses.

FastAPI OpenAI API Python

Technologies

  • FastAPI: Framework for building fast and modern APIs in Python.

  • OpenAI API: For generating automatic responses using language models.

  • Python 3.13.3

  • CORS Middleware: Enables secure communication between frontend and backend.

Environment Variables

Create the .env file in the root directory and define the following variable:

OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>

Installation

  1. Clone the repository:
git  clone  https://github.com/nuriadevs/backend-chat.git

cd  backend-chat
  1. Install dependencies:
pip  install  -r  requirements.txt

Start

Start the development server:

uvicorn  app.main:app  --reload  --port  8000

The backend will be available at http://localhost:8000.

Endpoints

  • POST /chat: Send messages and receive responses from the AI model.

  • GET /: Test endpoint to verify that the backend is active.

Tests

To run the test suite, execute the following in the application's root directory:

pytest  or  pytest  -s

Summary

  • Don't forget to create the .env file with the OpenAI variable.

  • This project is designed to be scalable.

📬 Contact

If you want to send me any message, suggestion, or collaboration proposal, don't hesitate to write to me through my social networks. Greetings!

Thank you for visiting this repository and giving it a star ⭐️!

About

This project implements the backend of a chat system with artificial intelligence using FastAPI and OpenAI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages