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!

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 can use the @ character to bring up a list of tables present in the project sandbox.
  • 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. Again, we can use the @ character: after selecting a table from the list of tables in the sandbox, we can also access a list of column names present in the selected table.
  • 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 Ask Leapfrog AI button to the right in the toolbar at the top of DataStar. This will open the Leapfrog tab where a welcome message will be shown. Next, we can 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 @rawshipments table to create unique customers (use the @rawshipments.destination_store column); average the latitudes and longitudes. Only use records with the @rawshipments.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.
  • The use of the @ character to quickly find sandbox tables and their columns is explained in more detail in the Leapfrog section of the Getting Started with DataStar help center article.

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 type of task it has created, here a Run SQL one
  • 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.
  • A Notes section repeating the text from the Documentation part of the response, with an indication of how long the response took to generate and the number of words and characters added. This section will be added as a Notes section if a task is created and added to the macro from the Leapfrog response.
  • Users can optionally give a thumbs up or down to give feedback on the Leapfrog response which can be used to improve the Leapfrog algorithm.
  • The Add Macro button can be used to add the propsed Run SQL task to the macro.

For copy-pasting purposes, the resulting SQL Script is repeated here:

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') >= '2024-07-01'::DATE
  AND TO_DATE(ship_date, 'DD/MM/YYYY') <= '2025-06-30'::DATE
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) and columns: leverage the @character to find the intended table and column names Leapfrog should use
  4. Leverage Anura schema knowledge: use text like “match to the anura schema for X table” to create tables in the Cosmic Frog model data format
  5. Chain your prompts: ask follow-ups to refine the query (e.g. “like that, but with X changed”, “like that, and with Y added”).
  6. Break down complex prompts: if your goal has multiple parts (e.g. filtering, grouping, joining), split it into smaller steps.
  7. 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.

In addition, these example prompts do not use the @ character to specify tables and columns to use, but they could to facilitate prompt writing further.

Helpful Resources

  • The Leapfrog Prompt Library on the Frogger Pond community portal.
  • All available DataStar documentation on Optilogic's Help Center can be found here in the "Navigating DataStar" section.
  • DataStar specific resources such as scripts for uploading data and connecting to external data sources, and template projects can be found on the Resource Library. To filter for DataStar related resources, click on the DataStar button at the top right.

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!

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 can use the @ character to bring up a list of tables present in the project sandbox.
  • 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. Again, we can use the @ character: after selecting a table from the list of tables in the sandbox, we can also access a list of column names present in the selected table.
  • 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 Ask Leapfrog AI button to the right in the toolbar at the top of DataStar. This will open the Leapfrog tab where a welcome message will be shown. Next, we can 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 @rawshipments table to create unique customers (use the @rawshipments.destination_store column); average the latitudes and longitudes. Only use records with the @rawshipments.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.
  • The use of the @ character to quickly find sandbox tables and their columns is explained in more detail in the Leapfrog section of the Getting Started with DataStar help center article.

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 type of task it has created, here a Run SQL one
  • 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.
  • A Notes section repeating the text from the Documentation part of the response, with an indication of how long the response took to generate and the number of words and characters added. This section will be added as a Notes section if a task is created and added to the macro from the Leapfrog response.
  • Users can optionally give a thumbs up or down to give feedback on the Leapfrog response which can be used to improve the Leapfrog algorithm.
  • The Add Macro button can be used to add the propsed Run SQL task to the macro.

For copy-pasting purposes, the resulting SQL Script is repeated here:

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') >= '2024-07-01'::DATE
  AND TO_DATE(ship_date, 'DD/MM/YYYY') <= '2025-06-30'::DATE
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) and columns: leverage the @character to find the intended table and column names Leapfrog should use
  4. Leverage Anura schema knowledge: use text like “match to the anura schema for X table” to create tables in the Cosmic Frog model data format
  5. Chain your prompts: ask follow-ups to refine the query (e.g. “like that, but with X changed”, “like that, and with Y added”).
  6. Break down complex prompts: if your goal has multiple parts (e.g. filtering, grouping, joining), split it into smaller steps.
  7. 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.

In addition, these example prompts do not use the @ character to specify tables and columns to use, but they could to facilitate prompt writing further.

Helpful Resources

  • The Leapfrog Prompt Library on the Frogger Pond community portal.
  • All available DataStar documentation on Optilogic's Help Center can be found here in the "Navigating DataStar" section.
  • DataStar specific resources such as scripts for uploading data and connecting to external data sources, and template projects can be found on the Resource Library. To filter for DataStar related resources, click on the DataStar button at the top right.

Have More Questions?

Contact Support

Get in touch

Contact Sales

Get in touch

Visit Frogger Pond Community

Visit our Community