Skip to content

TomFern/pipelinegpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PipelineGPT

Experimental — this is for learning purposes only — do not use in production.

Generates Semaphore pipelines using OpenAI GPT-3 with embeddings.

Prerequisites

Requires setting up a Pinecone database with embeddings. For more instructions, follow the README at tomfern/semaphore-demo-pipelinegpt.

Run locally

Setup

$ virtualenv venv
$ source venv/bin/activate
$ pip install -r src/requirements.txt

Add API keys to shell env file

$ cp env-shell-example .env-shell
$ nano .env-shell
$ source .env-shell

Run locally

$ FLASK_RUN=src/app.py flask run -p 3000 -h localhost

Test completion

$ curl -X POST -d '{ "prompt": "Create a CI pipeline that builds and pushed Docker image to Docker Hub"}' -H 'Content-Type: application/json' "localhost:3000/complete"

Run in Docker

Build image

$ docker build -t pipelinegpt .

Add API keys to env file

$ cp env-example .env
$ nano .env

Run in container

$ docker run --env-file .env --rm -d -p 8000:8000 pipelinegpt

Test a completion:

$ curl -X POST -d '{ "prompt": "Create a CI pipeline that builds and pushed Docker image to Docker Hub"}' -H 'Content-Type: application/json' "localhost:8000/complete"

Deploy to Fly.io

After installing flyctl and authenticating, create/update launch config:

$ flyctl launch

Upload your API tokens as secrets with:

$  cat .env | flyctl secrets import

To (re)deploy:

$ flyctl deploy

View running apps:

$ flyctl apps list

Test API (change URL as needed):

$ curl -X POST -d '{ "prompt": "Create a CI pipeline that builds and pushed Docker image to Docker Hub"}' -H 'Content-Type: application/json' https://bright-rose-2170.fly.dev/complete

Stop app:

$ flyctl app destroy bright-rose-2170