Skip to main content

Set up a modern REST API by running one command.

Project description

FastApi Gen

Create LLM-enabled FastAPI applications without build configuration.

Test Package version Supported Python versions


FastApi Gen works on macOS and Linux.
If something doesn’t work, please file an issue.

Quick Overview

pip3 install fastapi-gen
fastapi-gen my_app
cd my_app
make start-dev

or

pipx run fastapi-gen my_app
cd my_app
make start-dev

If you've previously installed fastapi-gen globally via pip3 install fastapi-gen, we recommend you reinstall the package using pip3 install --upgrade --force-reinstall fastapi-gen or pipx upgrade fastapi-gen to ensure that you use the latest version.

Then open http://localhost:8000/docs to see your app OpenAPI documentation.

Available templates:

  1. Default - basic template with GET/POST examples.
  2. NLP - natural language processing template with examples how to use local Hugginface models for summarization, named-entity recognition and text generation using LLM.
  3. Langchain - template with examples how to use LangChain with local Hugginface models (LLMs) for text generation and question answering.
  4. Llama - template with examples how to use llama.cpp and llama-cpp-python with local Llama 2 for question asnwering.

Important notes:

  • Langchain template requires hardware to run and will automatically download required models, be patient.
  • Llama template will download around 4GB model from Hugginface and >4GB of RAM.

Each template includes not only code, but also tests.

Get Started Immediately

You don’t need to install or configure depencendeices like FastApi or Pytest.
They are preconfigured and hidden so that you can focus on the code.

Create a project, and you’re good to go.

Creating an App

You’ll need to have Python 3.7+ or later version on your local development machine. We recommend using the latest LTS version. You can use pyenv (macOS/Linux) to switch Python versions between different projects.

Basic template

pip3 install fastapi-gen
fastapi-gen my_app

or

pip3 install fastapi-gen
fastapi-gen my_app --template hello_world

NLP template

pip install fastapi-gen
fastapi-gen my_app --template nlp

Langchain template

pip install fastapi-gen
fastapi-gen my_app --template Langchain

Llama template

pip install fastapi-gen
fastapi-gen my_app --template llama

Inside the newly created project, you can run some built-in commands:

make start

Runs the app in development mode.
Open http://localhost:8000/docs to view OpenAPI documentation in the browser.

The page will automatically reload if you make changes to the code.

make test

Runs tests.
By default, runs tests related to files changed since the last commit.

License

fastapi-gen is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_gen-0.6.1.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

fastapi_gen-0.6.1-py3-none-any.whl (27.9 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_gen-0.6.1.tar.gz.

File metadata

  • Download URL: fastapi_gen-0.6.1.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for fastapi_gen-0.6.1.tar.gz
Algorithm Hash digest
SHA256 28213df933c4ff2c3cf25839181d1c9ccd8d1b3b0a380db0c7f63a38a0fc2a6f
MD5 548b5df47a38747509eae9405bd9072c
BLAKE2b-256 520de94b26f5faab1f505b81e37f8e4f27384a5b8f2595264a57c8c4f230277d

See more details on using hashes here.

File details

Details for the file fastapi_gen-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: fastapi_gen-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 27.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for fastapi_gen-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 706bf7d0758173ba427e3760eeaa599e549bd4c57690550ff2b00be57cb8e6f1
MD5 571c614469e5552e853011e25e7440f4
BLAKE2b-256 db98766dcdbb74d5db529f0f763f12934f594bb4e07e351f9062880ca608c304

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page