US 12,411,841 B2
Systems and methods for automatically generating source code
Dion Almaer, Boulder, CO (US); David Geddes, Herriman, UT (US); Teddy Hwang, Toronto (CA); and Darius Gai, Grimsby (CA)
Assigned to Shopify Inc., Ottawa (CA)
Filed by Shopify Inc., Ottawa (CA)
Filed on Jul. 31, 2023, as Appl. No. 18/362,143.
Claims priority of provisional application 63/498,626, filed on Apr. 27, 2023.
Prior Publication US 2024/0362209 A1, Oct. 31, 2024
Int. Cl. G06F 16/242 (2019.01); G06F 8/30 (2018.01); G06F 16/245 (2019.01)
CPC G06F 16/2433 (2019.01) [G06F 8/30 (2013.01); G06F 16/245 (2019.01)] 18 Claims
OG exemplary drawing
 
1. A computer-implemented method, comprising:
receiving, via a computing device, a request for retrieval of data satisfying one or more criteria, the request including at least one data request parameter;
generating a first embedding based on the request in an embedding space;
locating a second embedding in the embedding space from amongst a set of embeddings of one or more previous queries, the second embedding being the embedding of the set of embeddings that is closest to the first embedding in the embedding space;
in response to determining that the first and second embeddings satisfy a defined distance criterion:
retrieving, from cache memory, the previous query associated with the second embedding; and
outputting, to the computing device, the retrieved previous query in a response to the request for retrieval of data;
in response to determining that the first and second embeddings do not satisfy the defined distance criterion:
providing, to a large language model (LLM), a first input prompt for instructing the LLM to generate a query purporting to retrieve data satisfying the one or more criteria, the first input prompt including the at least one data request parameter and the previous query associated with the second embedding as an example;
receiving, from the LLM, a result including the generated query;
transmitting the generated query to a server endpoint;
receiving, from the server endpoint, a server response including error data indicating a source code error associated with the generated query; and
providing, to the LLM, a further input prompt for instructing the LLM to generate a revised query, the further input prompt obtained based on modifying the first input prompt to include the error data.