Hey there, HiveDevs!
Yesterday I needed to query HiveSQL to get some statistics from PixBee, and I had an idea: why not use AI to create these SQL queries automatically?
The idea came and soon it will no longer be necessary to write complex SQLs to query HiveSQL. With the help of AI, we will be able to ask questions in a more human way and get direct answers.
For example, instead of writing this:
SELECT COUNT(*)
FROM Comments
WHERE author = 'vaipraonde'
AND json_metadata IS NOT NULL
AND json_metadata LIKE '%"hivebr"%'
AND title! = '';
You can simply ask:
!aiquery COUNT how many comments does the user vaipraonde have with json_metadata containing hivebr whose title is not ""?
Or instead of:
SELECT TOP 100 [delegate]
FROM Delegations
WHERE [delegate] IN ('steemskate', 'skatehive');
Simply:
!aiquery lists all delegates for steemskate and skatehive
With the help of
@mengao, who already has a bot that queries HiveSQL via Discord, I made a fork, created my HiveSQL account and implemented AI to make searches easier.
After some testing, both with simple queries and with some more complex ones, I managed to get great results.
I believe it will be ready soon! This first version is still a bit "quick and dirty", but I will refactor the code, create more configurations for choosing LLM models, perhaps include more providers and, of course, make the source code available to the community soon.
Here's the spoiler! If you liked the idea, leave a like to encourage me! 🚀
Few examples from tests:
Fala, HiveDevs!
Ontem precisei consultar o HiveSQL para obter algumas estatÃsticas da PixBee, e fiquei me perguntando: por que não usar IA para criar essas queries SQL automaticamente?
A ideia surgiu e logo menos não será mais necessário escrever SQLs complexas para consultar o HiveSQL. Com a ajuda da IA, poderemos fazer perguntas de forma mais humana e obter respostas diretas.
Por exemplo, em vez de escrever isso:
SELECT COUNT(*)
FROM Comments
WHERE author = 'vaipraonde'
AND json_metadata IS NOT NULL
AND json_metadata LIKE '%"hivebr"%'
AND title != '';
Bastará perguntar:
!aiquery COUNT how many comments user vaipraonde has with json_metadata that contain hivebr that the title is not ""?
Ou em vez de:
SELECT TOP 100 [delegatee]
FROM Delegations
WHERE [delegatee] IN ('steemskate', 'skatehive');
Simplesmente:
!aiquery list all delegatee to steemskate and skatehive
Com a ajuda do
@mengao, que já tem um bot que faz consultas no HiveSQL pelo Discord, fiz um fork, criei minha conta no HiveSQL e implementei IA para facilitar as buscas.
Depois de alguns testes, tanto com queries simples quanto com algumas mais complexas, consegui obter ótimos resultados.
Acredito que logo menos estará pronto! Essa primeira versão ainda está meio "quick and dirty", mas vou refatorar o código, criar mais configurações para escolha de modelos LLM, talvez incluir mais providers e, claro, disponibilizar o código-fonte para a comunidade em breve.
Fica aqui o spoiler! Se curtiu a ideia, deixa um like para me incentivar! 🚀