UPDATES

Join ChatGPT to your SQL Database


With our newest actual time data launch, we’re now capable of join ChatGPT to any SQL database you have got, and transmit the results of your SQL to ChatGPT, for then to have it analyse your knowledge, reply your query, and return a solution accordingly.

Nonetheless, earlier than I begin explaining the method, let’s first take pleasure in a screenshot 😁

Connect ChatGPT with your SQL database



What you are taking a look at

The above ChatGPT reply was created by executing the next SQL

choose f.title as Movie, depend(fa.actor_id) as Actors
    from movie as f
    be a part of film_actor as fa on f.film_id = fa.film_id
    group by f.title
    order by Actors desc
    restrict 10
Enter fullscreen mode

Exit fullscreen mode

The above SQL in fact is part of a Hyperlambda snippet, that appears as follows;

knowledge.join:[generic|sakila]
   knowledge.choose:@"choose f.title as Movie, depend(fa.actor_id) as Actors
    from movie as f
    be a part of film_actor as fa on f.film_id = fa.film_id
    group by f.title
    order by Actors desc
    restrict 10;"
   .end result:
   for-each:x:@knowledge.choose/*
      set-value:x:@.end result
         strings.concat
            get-value:x:@.end result
            .:"Movie "
            get-value:x:@.dp/#/*/Movie
            .:" "
            .:"Actor depend "
            get-value:x:@.dp/#/*/Actors
            .:"rn"
   return:x:@.end result
Enter fullscreen mode

Exit fullscreen mode

The above Hyperlambda snippet once more is utilizing the Hyperlambda [strings.mixin] slot, which mixes pure language textual content with the results of executing Hyperlambda code. Beneath is a screenshot of the whole coaching snippet for those who’re .

Executin SQL to create ChatGPT context data

As soon as the context is semantically matched in the direction of the question, being e.g.

What number of actors performed within the film MUMMY CREATURES?

The SQL extracts the next knowledge;

Movie MUMMY CREATURES Actor depend 11
Movie BOONDOCK BALLROOM Actor depend 11
Movie LAMBS CINCINATTI Actor depend 10
Movie HELLFIGHTERS SIERRA Actor depend 10
Movie ARABIA DOGMA Actor depend 10
Movie WIZARD COLDBLOODED Actor depend 9
Movie SUBMARINE BED Actor depend 9
Movie RANDOM GO Actor depend 9
Movie LESSON CLEOPATRA Actor depend 9
Movie IMAGE PRINCESS Actor depend 9
Enter fullscreen mode

Exit fullscreen mode

Then our OpenAI machine studying capabilities submits the above knowledge to OpenAI’s APIs, which then makes use of the above as its “actual time knowledge basis for answering the query”, the tip end result being one thing comparable to follows;

There was 11 actora enjoying within the film MUMMY CREATURES

Within the video under I’m strolling you thru the whole course of


Fairly kick ass for those who ask me 😁

Leave a Reply

Your email address will not be published. Required fields are marked *