Systems and methods for code generation
AssigneeSap SE
InventorsAnahita Havewala, Jesus Manuel Sanchez Martinez
Life of this patent
Estimating the term…
Abstract
Embodiments of the present disclosure include techniques for generating code. Input code is received from a user. The code may not be conforming to a particular policy. The input code may be used to retrieve corresponding policies relevant for the code. In some embodiments, the input code may have a particular version, and a schema corresponding to the code version may be retrieved. The input code, policy, and schema may be input to a large language model to generate modified code conforming to the policy and the schema, for example.
Claims17
A method of generating code comprising:
- receiving a first program code;
- based on at least a portion of the first program code, retrieving a first schema associated with the first program code;
- generating a query to a data store based on the first program code, the data store comprising a plurality of policies governing the structure of the first program code, the query returning at least one policy associated with the first program code;
- inputting the first program code, the first schema, and the at least one policy to a large language model;
- and
- generating, by the large language model, second program code conforming to the first schema and conforming to the at least one policy,
- wherein the policies are embeddings generated by a second large language model based on text based policies, the method further comprising inputting one or more elements of the first program code into the second large language model, the second large language model returning a plurality of tokens associated with the one or more elements of the first program code, wherein the query comprises a plurality of tokens.
A computer system comprising:
- at least one processor;
- at least one non-transitory computer-readable medium storing computer-executable instructions that, when executed by the at least one processor, cause the computer system to perform a method of connecting computer systems comprising:
- receiving first infrastructure-as-code (IaC) program code;
- based on at least a portion of the first IaC program code, retrieving a first schema associated with the first program code;
- generating a query to a data store based on the first IaC program code, the data store comprising a plurality of security policy embeddings, the query returning text based security policies corresponding to security policy embeddings associated with the first IaC program code, wherein the first program code does not conform with the text based security policies;
- and
- inputting the first IaC program code, the first schema, and the at least one text based security policy to a large language model;
- generating, by the large language model, second IaC program code conforming to the first schema and conforming to the at least one text based security policy,
- wherein the security policy embeddings are generated by a second large language model based on the text based security policies, the method further comprising inputting one or more resource descriptors from the first IaC program code into the second large language model, the second large language model returning a plurality of tokens associated with the one or more resource descriptors of the first IaC program code, wherein the query comprises a plurality of tokens.
A non-transitory computer-readable medium storing computer-executable instructions that, when executed by at least one processor, perform a method of connecting computer systems, the method comprising:
- receiving first program code;
- based on at least a portion of the first program code, retrieving a first schema associated with the first program code;
- generating a query to a data store based on the first program code, the data store comprising a plurality of policies governing the structure of the first program code, the query returning at least one policy associated with the first program code;
- inputting the first program code, the first schema, and the at least one policy to a large language model;
- and
- generating, by the large language model, second program code conforming to the first schema and conforming to the at least one policy,
- wherein the large language model is not trained with the first schema,
- wherein the first program code does not conform with the at least one policy,
- wherein the policies are embeddings generated by a second large language model based on text based policies, the method further comprising inputting one or more elements of the first program code into the second large language model, the second large language model returning a plurality of tokens associated with the one or more elements of the first program code, wherein the query comprises a plurality of tokens.
Dependencies are inferred from the claim text.