Placebo - Magical Tools For Everyone 🪄⚡

Placebo - Magical Tools For Everyone 🪄⚡

A little big of magic here and a little bit of magic there...

·

3 min read

So what is Placebo?

Placebo is my submission for the Hashnode and MindsDB Hackathon. Placebo is home to tools that can make life easier, especially for developers. Currently, it has Regexfy and SQL Sorcery.

Regexify ⚡

Regexify is simple. All it does is take your Regex Pattern, and crack it! It returns to natural language. Do you know what's cool, you can also do it and vice versa. So you can convert your natural language into regex. No hassle at all!

SQL Sorcery 🪄

Another simple one here. Sorcery aims to convert SQL code into natural language and back. What I like about Sorcery is that you do not have to think too much when converting to SQL Code.

Tech Stack 🪜

  • Next.js 13 (app dir)

  • Tailwind CSS

  • Framer Motion

  • MindsDB

  • PostgreSQL

  • Railway

  • Next Auth

  • Zod

Demo

Model Training

Placebo has about 4 models for now and all of them are powered by the OpenAI Engine. Two for each service/app. Let us first look at the models for Regexify.

Regex To English Model

CREATE MODEL mindsdb.regex_to_eng
PREDICT eng
USING
engine = 'openai',
max_tokens = 8000,
model_name = 'gpt-4',
prompt_template = '
Convert {{data}} to English. Return only the English version. Do not add your own comments or other things.';

English To Regex Model

CREATE MODEL mindsdb.eng_to_regex
PREDICT regex
USING
engine = 'openai',
max_tokens = 8000,
model_name = 'gpt-4',
prompt_template = '
Convert {{data}} to regex. Return only the regex. Do not add your own comments or other things.';

SQL To English Model

CREATE MODEL mindsdb.converter_human
PREDICT response
USING
engine = 'openai',
max_tokens = 8000,
model_name = 'gpt-4',
prompt_template = '
Convert {{text}} to English. Return only the English version and nothing else.';

English To SQL Model

CREATE MODEL mindsdb.converter_sql
PREDICT response
USING
engine = 'openai',
max_tokens = 8000,
model_name = 'gpt-4',
prompt_template = '
Convert {{text}} to SQL code. Return only the SQL Code and nothing else.';

Pretty simple yh?

Hosting and Database

The app is hosted on Vercel. Both frontend and backend. For the backend, I used Next.js's new Route Handlers.

The database is a Postgres database service from Railway. Railway is pretty cool.

Unit Tests with Jest and GitHub Actions

I use Jest for unit tests in Placebo. The tests are automatically run via GitHub actions. Here is a basic test that passed. More will be added as time progresses and the app gets larger.

GitHub workflow for tests

Credits

I want to thank the whole MindsDB Slack for answering all the questions I had, and for taking the time to go through the whole process with me. I appreciate you all.

Thanks for reading

I'd appreciate a star from you. Head on to the GitHub repo and show some love. God bless you and have a nice day! Peace!