DataStar Quick Start: Creating a Task using Natural Language

DataStar Quick Start: Creating a Task using Natural Language

In this quick start guide we will show how Leapfrog AI can be used in DataStar to generate tasks from natural language prompts, no coding necessary!

Please note that DataStar is currently in the Early Adopter phase, where only users who participate in the Early Adopter program have access to it. DataStar is rapidly evolving while we work towards the General Availability release later this year. For any questions about DataStar or the Early Adopter program, please feel free to reach out to Optilogic’s support team on support@optilogic.com.

Using Leapfrog to create a Run SQL task

This quick start guide builds upon the previous one where a CSV file was imported into the Project Sandbox, please follow the steps in there first if you want to follow along with the steps in this quick start. The starting point for this quick start is therefore a project named Import Historical Shipments that has a Historical Shipments data connection of type = CSV, and a table in the Project Sandbox named rawshipments, which contains 42,656 records.

The Shipments.csv file that was imported into the rawshipments table has following data structure (showing 5 of the 42,656 records):

Our goal in this quick start is to create a task using Leapfrog that will use this data (from the rawshipments table in the Project Sandbox) to create a list of unique customers, where the destination stores function as the customers. Ultimately, this list of customers will be used to populate the Customers input table of a Cosmic Frog model. A few things to consider when formulating the prompt are:

  • Leapfrog will not know what data to use to generate the customer list from unless we tell it, so we need to indicate in our prompt that the rawshipments table is to be used for this task.
  • We may need to tell Leapfrog which column to use to create customers from, as there is no customer name (or similar) column in this data. We want it to use the Destination Store column to create the customers from.
  • Each Destination Store has multiple records in this file, since it is transactional data over a period of time (June 1, 2024 – July 31, 2025) where stores placed and received multiple orders and each was also served by multiple DCs. Therefore, if we want the customer list to include location information, which is contained in the destination latitude and destination longitude columns, we need to think about if we want Leapfrog to do anything with these columns as there is a chance these are not all exactly the same for all records with the same Destination Store. We will tell Leapfrog to take the average of the destination latitude and destination longitude to come up with the coordinates of each unique customer.
  • The data contains shipments for 14 months, but we only want to use the records of the 12 months starting from July 1, 2024. We will need to tell Leapfrog this.
  • Leapfrog is aware of the Anura database schema which is what Cosmic Frog models use underneath. We can therefore reference this in prompts so that tables generated using tasks created by Leapfrog match this schema.

Within the Import Historical Shipments DataStar project, click on the Import Shipments macro to open it in the macro canvas, you should see the Start and Import Raw Shipments tasks on the canvas. Then open Leapfrog by clicking on the Leapfrog tab, which is the right-most tab in the panel on the right-hand side of the macro canvas. Alternatively, click on the “How can I help you” speech bubble with the frog icon in the toolbar at the top of DataStar. Next, we will write our prompt in the “Write a message…” textbox.

Keeping in mind the 5 items mentioned above, the prompt we use is the following: “Use the raw shipments table to create unique customers (the destination column); average the latitudes and longitudes. Only use records with the ship date between July 1 2024 and June 30 2025. Match to the anura schema of the Customers table”. Please note that tips for writing successful prompts and variations of this prompt (some working, others not) can be found in the Tips for Prompt Writing section further below.

After clicking on the send icon to submit the prompt, Leapfrog will take a few seconds to consider the prompt and formulate a response. The response will look similar to the following screenshot, where we see from top to bottom:

  • The prompt
  • Leapfrog’s text response about what it did in the Documentation section
  • The name of the proposed task (Create customers from shipments)
  • The configuration of the task, which is of the Run SQL type:
    • The target data connection will always be the Project Sandbox for Leapfrog generated tasks
    • Then follows the SQL script that was generated to perform the actions user asked for in the prompt. Scrolling right or clicking on the expand icon will show the complete SQL Query

The resulting SQL Script reads:

DROP TABLE IF EXISTS Customers;

CREATE TABLE Customers AS 
SELECT Destination_Store AS CustomerName, AVG(Destination_Latitude) AS Latitude, AVG(Destination_Longitude) AS Longitude 
FROM RawShipments 
WHERE TO_DATE(Ship_Date, 'DD/MM/YYYY') BETWEEN '2024-07-01' AND '2025-06-30' 
GROUP BY Destination_Store;

Those who are familiar with SQL, will be able to tell that this will indeed achieve our goal. Since that is the case, we can click on the Add to Macro button at the bottom of Leapfrog’s response to add this as a Run SQL task to our Import Shipments macro. When hovering over this button, you will see Leapfrog suggests where to put it on the macro canvas and to connect it to the Import Raw Shipments task, which is what we want. When next clicking on the Add to Macro button it will be added.

We can test our macro so far, by clicking on the green Run button at the right top of DataStar. Please note that:

  • For the moment, you will need to have run the "Import Raw Shipments" task before being able to reference the rawshipments table it creates in the Project Sandbox. In other words, before submitting the prompt in Leapfrog, the "Import Raw Shipments" task needs to have been run.
  • Similarly, when building upon this new "Create customers from shipments" task (for example to take the resulting customers and import them into the Customers table of a Cosmic Frog model), it is also needed to run this task before it can be referenced in subsequent tasks. This will not be necessary anymore in future updates to DataStar.

Once the macro is done running, we can check the results. Go to the Data Connections tab, expand the Project Sandbox connection and click on the customers table to open it in the central part of DataStar:

We see that the customers table resulting from running the Leapfrog-created Run SQL task contains 1,333 records. Also notice that its schema matches that of the Customers table of Cosmic Frog models, which includes columns named customername, latitude, and longitude.

Tips for Prompt Writing

Writing prompts for Leapfrog that will create successful responses (e.g. the SQL Script generated will achieve what the prompt-writer intended) may take a bit of practice. This Mastering Leapfrog for SQL Use Cases: How to write Prompts that get Results post on the Frogger Pond community portal has some great advice which applies to Leapfrog in DataStar too. It is highly recommended to give it a read; the main points of advice follow here too:

  1. Start with your goal: what do you want the task to accomplish?
  2. Mention key elements/dimensions: products, locations, time frames, etc.
  3. Name the table(s): if you know them – both those to use as input(s) and those to match outputs to in case of building tables for Cosmic Frog models (use the text “match to anura schema for X table” in that case).
  4. Chain your prompts: ask follow-ups to refine the query (e.g. “like that, but with X changed”, “like that, and with Y added”).
  5. Break down complex prompts: if your goal has multiple parts (e.g. filtering, grouping, joining), split it into smaller steps.
  6. Reset if needed: if Leapfrog gets off track and follow-up redirections do not work, starting a new conversation can help it reset context and produce better results.

As an example, let us look at variations of the prompt we used in this quick start guide, to gauge the level of granularity needed for a successful response. In this table, the prompts are listed from least to most granular:

Note that in the above prompts, we are quite precise about table and column names and no typos are made by the prompt writer. However, Leapfrog can generally manage well with typos and often also pick up table and column names when not explicitly used in the prompt. So while generally being more explicit results in higher accuracy, it is not necessary to always be extremely explicit and we just recommend to be as explicit as you can be.

Helpful Resources

DataStar Quick Start: Creating a Task using Natural Language

In this quick start guide we will show how Leapfrog AI can be used in DataStar to generate tasks from natural language prompts, no coding necessary!

Please note that DataStar is currently in the Early Adopter phase, where only users who participate in the Early Adopter program have access to it. DataStar is rapidly evolving while we work towards the General Availability release later this year. For any questions about DataStar or the Early Adopter program, please feel free to reach out to Optilogic’s support team on support@optilogic.com.

Using Leapfrog to create a Run SQL task

This quick start guide builds upon the previous one where a CSV file was imported into the Project Sandbox, please follow the steps in there first if you want to follow along with the steps in this quick start. The starting point for this quick start is therefore a project named Import Historical Shipments that has a Historical Shipments data connection of type = CSV, and a table in the Project Sandbox named rawshipments, which contains 42,656 records.

The Shipments.csv file that was imported into the rawshipments table has following data structure (showing 5 of the 42,656 records):

Our goal in this quick start is to create a task using Leapfrog that will use this data (from the rawshipments table in the Project Sandbox) to create a list of unique customers, where the destination stores function as the customers. Ultimately, this list of customers will be used to populate the Customers input table of a Cosmic Frog model. A few things to consider when formulating the prompt are:

  • Leapfrog will not know what data to use to generate the customer list from unless we tell it, so we need to indicate in our prompt that the rawshipments table is to be used for this task.
  • We may need to tell Leapfrog which column to use to create customers from, as there is no customer name (or similar) column in this data. We want it to use the Destination Store column to create the customers from.
  • Each Destination Store has multiple records in this file, since it is transactional data over a period of time (June 1, 2024 – July 31, 2025) where stores placed and received multiple orders and each was also served by multiple DCs. Therefore, if we want the customer list to include location information, which is contained in the destination latitude and destination longitude columns, we need to think about if we want Leapfrog to do anything with these columns as there is a chance these are not all exactly the same for all records with the same Destination Store. We will tell Leapfrog to take the average of the destination latitude and destination longitude to come up with the coordinates of each unique customer.
  • The data contains shipments for 14 months, but we only want to use the records of the 12 months starting from July 1, 2024. We will need to tell Leapfrog this.
  • Leapfrog is aware of the Anura database schema which is what Cosmic Frog models use underneath. We can therefore reference this in prompts so that tables generated using tasks created by Leapfrog match this schema.

Within the Import Historical Shipments DataStar project, click on the Import Shipments macro to open it in the macro canvas, you should see the Start and Import Raw Shipments tasks on the canvas. Then open Leapfrog by clicking on the Leapfrog tab, which is the right-most tab in the panel on the right-hand side of the macro canvas. Alternatively, click on the “How can I help you” speech bubble with the frog icon in the toolbar at the top of DataStar. Next, we will write our prompt in the “Write a message…” textbox.

Keeping in mind the 5 items mentioned above, the prompt we use is the following: “Use the raw shipments table to create unique customers (the destination column); average the latitudes and longitudes. Only use records with the ship date between July 1 2024 and June 30 2025. Match to the anura schema of the Customers table”. Please note that tips for writing successful prompts and variations of this prompt (some working, others not) can be found in the Tips for Prompt Writing section further below.

After clicking on the send icon to submit the prompt, Leapfrog will take a few seconds to consider the prompt and formulate a response. The response will look similar to the following screenshot, where we see from top to bottom:

  • The prompt
  • Leapfrog’s text response about what it did in the Documentation section
  • The name of the proposed task (Create customers from shipments)
  • The configuration of the task, which is of the Run SQL type:
    • The target data connection will always be the Project Sandbox for Leapfrog generated tasks
    • Then follows the SQL script that was generated to perform the actions user asked for in the prompt. Scrolling right or clicking on the expand icon will show the complete SQL Query

The resulting SQL Script reads:

DROP TABLE IF EXISTS Customers;

CREATE TABLE Customers AS 
SELECT Destination_Store AS CustomerName, AVG(Destination_Latitude) AS Latitude, AVG(Destination_Longitude) AS Longitude 
FROM RawShipments 
WHERE TO_DATE(Ship_Date, 'DD/MM/YYYY') BETWEEN '2024-07-01' AND '2025-06-30' 
GROUP BY Destination_Store;

Those who are familiar with SQL, will be able to tell that this will indeed achieve our goal. Since that is the case, we can click on the Add to Macro button at the bottom of Leapfrog’s response to add this as a Run SQL task to our Import Shipments macro. When hovering over this button, you will see Leapfrog suggests where to put it on the macro canvas and to connect it to the Import Raw Shipments task, which is what we want. When next clicking on the Add to Macro button it will be added.

We can test our macro so far, by clicking on the green Run button at the right top of DataStar. Please note that:

  • For the moment, you will need to have run the "Import Raw Shipments" task before being able to reference the rawshipments table it creates in the Project Sandbox. In other words, before submitting the prompt in Leapfrog, the "Import Raw Shipments" task needs to have been run.
  • Similarly, when building upon this new "Create customers from shipments" task (for example to take the resulting customers and import them into the Customers table of a Cosmic Frog model), it is also needed to run this task before it can be referenced in subsequent tasks. This will not be necessary anymore in future updates to DataStar.

Once the macro is done running, we can check the results. Go to the Data Connections tab, expand the Project Sandbox connection and click on the customers table to open it in the central part of DataStar:

We see that the customers table resulting from running the Leapfrog-created Run SQL task contains 1,333 records. Also notice that its schema matches that of the Customers table of Cosmic Frog models, which includes columns named customername, latitude, and longitude.

Tips for Prompt Writing

Writing prompts for Leapfrog that will create successful responses (e.g. the SQL Script generated will achieve what the prompt-writer intended) may take a bit of practice. This Mastering Leapfrog for SQL Use Cases: How to write Prompts that get Results post on the Frogger Pond community portal has some great advice which applies to Leapfrog in DataStar too. It is highly recommended to give it a read; the main points of advice follow here too:

  1. Start with your goal: what do you want the task to accomplish?
  2. Mention key elements/dimensions: products, locations, time frames, etc.
  3. Name the table(s): if you know them – both those to use as input(s) and those to match outputs to in case of building tables for Cosmic Frog models (use the text “match to anura schema for X table” in that case).
  4. Chain your prompts: ask follow-ups to refine the query (e.g. “like that, but with X changed”, “like that, and with Y added”).
  5. Break down complex prompts: if your goal has multiple parts (e.g. filtering, grouping, joining), split it into smaller steps.
  6. Reset if needed: if Leapfrog gets off track and follow-up redirections do not work, starting a new conversation can help it reset context and produce better results.

As an example, let us look at variations of the prompt we used in this quick start guide, to gauge the level of granularity needed for a successful response. In this table, the prompts are listed from least to most granular:

Note that in the above prompts, we are quite precise about table and column names and no typos are made by the prompt writer. However, Leapfrog can generally manage well with typos and often also pick up table and column names when not explicitly used in the prompt. So while generally being more explicit results in higher accuracy, it is not necessary to always be extremely explicit and we just recommend to be as explicit as you can be.

Helpful Resources

Have More Questions?

Scalability Icon

Contact Support

Get in touch
Scalability Icon

Contact Sales

Get in touch
Scalability Icon

Visit Frogger Pond Community

Visit our Community