Giter VIP home page Giter VIP logo

email-assistant-api's Introduction

LLM Powered API with FastAPI and FastCRUD

This project demonstrates how to create a personalized email writing assistant using FastAPI, OpenAI's API, and FastCRUD. For a full step-by-step tutorial, head to the medium post.

Prerequisites

  • Python 3.9+: Ensure you have Python 3.9 or a newer version installed.
  • Poetry: A dependency manager for Python. Install it with pip install poetry.
  • OpenAI API Key: Sign up and get an API key from OpenAI's website.
  • Access to a Terminal (macOS or Linux): Use the terminal for setting up the project and managing dependencies.

Tip for Windows Users: Use Windows Subsystem for Linux (WSL) to follow along with this tutorial.

Project Setup

  1. Create a Project Folder:

    mkdir email-assistant-api
    cd email-assistant-api
  2. Initialize a Poetry Project:

    poetry init
  3. Add Dependencies:

    poetry add fastapi fastcrud sqlmodel openai aiosqlite greenlet python-jose bcrypt
  4. Set Up Environment Variables: Create a .env file in the app directory with the following content:

    OPENAI_API_KEY="your_openai_api_key"
    SECRET_KEY="your_secret_key"
    

Project Structure

email_assistant_api/
│
├── app/
│   ├── __init__.py
│   ├── main.py        # The main application file
│   ├── routes.py      # Contains API route definitions and endpoint logic
│   ├── database.py    # Database setup and session management
│   ├── models.py      # SQLModel models for the application
│   ├── crud.py        # CRUD operation implementations using FastCRUD
│   ├── schemas.py     # Schemas for request and response models
│   └── .env           # Environment variables
│
├── pyproject.toml     # Project configuration and dependencies
├── README.md          # Provides an overview and documentation
└── .gitignore         # Files to be ignored by version control

Running the Application

To start the application, run:

poetry run uvicorn app.main:app --reload

Open a browser and navigate to 127.0.0.1:8000/docs to access the API documentation.

Connect with Me

If you have any questions, want to discuss tech-related topics, or share your feedback, feel free to reach out to me on social media:

email-assistant-api's People

Contributors

igorbenav avatar

Stargazers

a r k e o d e v avatar  avatar Mithun Thomas avatar Ahmad Bilal Farooqi avatar João Flávio Santos avatar

Watchers

 avatar

Forkers

mithun2003

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.