Generation of formula from natural language description
Systems and methods include reception of a natural language description of a calculation formula and metadata of a data source, generation of a first prompt to prompt determination of calculation components of the calculation formula based on the description, reception of a plurality of calculation components from a text generation model in response to the first prompt, determination, for each of the plurality of calculation components, of metadata of each of one or more similar operators to a calculation component, generation of a second prompt to determine the calculation formula based on the natural language description, the metadata of the data source and the metadata of each of the one or more similar operators, and reception of the calculation formula from the text generation model in response to the second prompt.
1 . A system comprising:
a memory storing program code; and
one or more processing units to execute the program code to cause the system to:
receive a natural language description of a calculation formula and column names of a data source;
generate a first prompt to prompt determination of calculation components of the calculation formula based on the natural language description and the column names of the data source;
transmit the first prompt to a text generation model;
receive a plurality of calculation components from the text generation model in response to the first prompt;
for each of the plurality of calculation components, determine descriptions of each of one or more similar operators by:
transmission of each of the plurality of calculation components to an embedding model to determine an embedding for each of the plurality of calculation components;
querying of a vector database for each determined embedding; and
in response to the querying, reception of, for each of the plurality of calculation components, descriptions of each of one or more similar operators from the vector database;
generate a second prompt to determine the calculation formula based on the natural language description, the column names of the data source and the descriptions of each of the one or more similar operators of each of the plurality of calculation components;
transmit the second prompt to the text generation model;
receive the calculation formula from the text generation model in response to the second prompt; and
present the calculation formula.
2 . The system according to claim 1 , the one or more processing units to execute the program code to cause the system to:
execute a syntactic validation on the received calculation formula.
3 . The system according to claim 2 , the one or more processing units to execute the program code to cause the system to:
execute a functional validation on the received calculation formula.
4 . The system according to claim 1 , the first prompt including a first system prompt and a first user prompt, wherein the first user prompt includes the natural language description and the column names of the data source.
5 . The system according to claim 4 , the second prompt including a second system prompt and a second user prompt, wherein the second system prompt includes the column names of the data source and the descriptions of each of the one or more similar operators, and the second user prompt includes the natural language description.
6 . A method comprising:
receiving a natural language description of a calculation formula;
generating a first prompt to prompt determination of calculation components of the calculation formula based on the natural language description;
transmitting the first prompt to a text generation model;
receiving a plurality of calculation components from the text generation model in response to the first prompt;
for each of the plurality of calculation components, determining descriptions of each of one or more similar operators by:
transmitting each of the plurality of calculation components to an embedding model to determine an embedding for each of the plurality of calculation components;
querying a vector database for each determined embedding; and
in response to the querying, receiving, for each of the plurality of calculation components, descriptions of each of one or more similar operators from the vector database;
generating a second prompt to determine the calculation formula based on the natural language description, column names of a data source against which the calculation formula is to be applied, and the descriptions of each of the one or more similar operators of each of the plurality of calculation components;
transmitting the second prompt to the text generation model;
receiving the calculation formula from the text generation model in response to the second prompt; and
presenting the calculation formula.
7 . The method according to claim 6 , further comprising:
executing a syntactic validation on the received calculation formula.
8 . The method according to claim 7 , further comprising:
executing a functional validation on the received calculation formula.
9 . The method according to claim 6 , the first prompt including a first system prompt and a first user prompt, wherein the first user prompt includes the natural language description and the column names of the data source.
10 . The method according to claim 9 , the second prompt including a second system prompt and a second user prompt, wherein the second system prompt includes the column names of the data source and the descriptions of each of the one or more similar operators, and the second user prompt includes the natural language description.
11 . A non-transitory medium storing program code executable by one or more processing units of a computing system to cause the computing system to:
receive a natural language description of a calculation formula and column names of a data source;
generate a first prompt to prompt determination of calculation components of the calculation formula based on the natural language description;
transmit the first prompt to a text generation model;
receive a plurality of calculation components from the text generation model in response to the first prompt;
for each of the plurality of calculation components, determine descriptions of each of one or more operators similar to a calculation component by:
transmission of each of the plurality of calculation components to an embedding model to determine an embedding for each of the plurality of calculation components;
querying of a vector database for each determined embedding; and
in response to the querying, reception of, for each of the plurality of calculation components, descriptions of each of one or more similar operators from the vector database;
generate a second prompt to determine the calculation formula based on the natural language description, the column names of the data source and the descriptions of each of the one or more similar operators determined for each of the plurality of calculation components;
transmit the second prompt to the text generation model; and
receive the calculation formula from the text generation model in response to the second prompt.
12 . The medium according to claim 11 , the program code executable by one or more processing units of a computing system to cause the computing system to:
execute a syntactic validation on the received calculation formula.
13 . The medium according to claim 12 , the program code executable by one or more processing units of a computing system to cause the computing system to:
execute a functional validation on the received calculation formula.
14 . The medium according to claim 11 , the first prompt including a first system prompt and a first user prompt, wherein the first user prompt includes the natural language description and the column names of the data source, and
the second prompt including a second system prompt and a second user prompt, wherein the second system prompt includes the column names of the data source and the descriptions of each of the one or more similar operators, and the second user prompt includes the natural language description.