jaytoday / tinygen

0 stars 0 forks source link

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

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