Skip to content

jaytoday/tinygen

Repository files navigation

tinygen

A trivial version of a code generation API, built with FastAPI.

Demo

Code Generation API

Refer to the documentation.

You can make POST requests to http://127.0.0.1:8000/api/v1/codegen/ to test the API locally. Set the Content-Type header to application/json and pass in a JSON request body containing repoUrl and prompt fields, as shown in this example:

{
    "repoUrl": "https://github.com/jayhack/llm.sh",
    "prompt": "Add a comment in the readme with text 'Here is a self referential link.' linking to https://github.com/jayhack/llm.sh"
}

Included Features

  • Web framework FastAPI
  • Production ASGI web server Uvicorn
  • Interactive API documentation
  • Environment variables file .env for the app configuration
  • Docker docker-compose.yml and Dockerfile to run the prodution server
  • Openapi generator openapi-generator-cli configured to generate clients
  • Data validator Pydantic
  • Unit test framework pytest
  • Linter Flake8
  • Code formatter Black
  • Imports sorter isort
  • Static type checker Mypy

Installation

Visual Studio Code is the recommended editor, please install the recommended extensions in .vscode/extensions.json.

Install poetry.

Install dependencies:

poetry install

Development

Start the development server with automatic reload:

poetry shell
dev

or

uvicorn app.main:app --reload

Unit test

poetry shell
pytest

OpenAPI generator

In openapi-generator install the required packages:

npm install

Start the server then generate clients:

npm run generate

Server Docker

In the project root there is the docker-compose.yml.

Run:

docker compose up -d --build

Stop:

docker compose down

Production server

poetry shell
uvicorn app.main:app

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published