Auto-assignment of new entities in a hierarchical structure with automatic hierarchy extensions using generative artificial intelligence
The present disclosure relates to an automatic assignment of new entities in an existing hierarchical structure by leveraging retrieval-augmented generation (RAG) that improves the performance of a generative artificial intelligence (AI) model by generating a suggested hierarchical structure. For an automatic assignment, a user input may be received that may include a hierarchical structure and a query for adding one or more new entities to the existing hierarchical structure. For each new embedding vector associated with the query for adding a new entity, a retrieval-augmented generation may generate a context from the hierarchical structure based on a relevance to the query, and an additional context from a knowledge base. The retrieval-augmented generation may input a human-readable prompt, combining query with the context, additional context and a system prompt, to the generative AI model such as a large language model for generating the suggested hierarchical structure.
1 . A computer-implemented method including: receiving
a user input that includes a hierarchical structure and a query for adding one or more new entities to the hierarchical structure, wherein the hierarchical structure comprises hierarchy levels that are assigned hierarchy names in which a plurality of entities is arranged with associated categorization rules, and wherein:
the one or more new entities include image data received in real-time from a continuous data stream by one or more data sources, and
the image data in the one or more new entities is processed using an image identification model to generate an entity name of a new entity;
generating, by leveraging an embedding model, an embedding vector for each chunk of a set of chunks that are obtained by splitting the hierarchical structure based on predefined criteria, wherein embedding vectors associated with the set of chunks capture the hierarchy names, the hierarchy levels, semantic meanings and the associated categorization rules within the hierarchical structure;
generating one or more new embedding vectors associated with the one or more new entities by leveraging the embedding model;
generating, for each new embedding vector of the one or more new embedding vectors, a context via a retrieval-augmented generation, based on a relevance to the query;
generating, via the retrieval-augmented generation, an additional context from a knowledge base that comprises data from one or more external sources that were not included in training of a generative artificial intelligence model;
augmenting, using a processing subsystem within a cloud infrastructure system, the query with a system prompt, the context from the hierarchical structure and the additional context from the knowledge base to generate a human-readable prompt, wherein the system prompt includes instructions to the generative artificial intelligence model for generating a suggested hierarchical structure;
inputting the human-readable prompt to the generative artificial intelligence model to generate, for each new entity of the one or more new entities, one or more suggested hierarchical paths, wherein the new entity of the one or more new entities having the entity name is correctly placed at a hierarchy level in the one or more suggested hierarchical paths by following the associated categorization rules;
generating, based on the generative artificial intelligence model, the suggested hierarchical structure incorporating the one or more suggested hierarchical paths associated with the one or more new entities in the suggested hierarchical structure, wherein the suggested hierarchical structure is displayed on one or more display devices; and
generating a provenance information that includes references to one or more information sources used by the generative artificial intelligence model to provide the suggested hierarchical structure.
2 . The computer-implemented method of claim 1 , further including:
generating, for the new entity of one or more new entities, the one or more suggested hierarchical paths that includes a hierarchy extension by adding a new hierarchy name at one or more hierarchical levels, when the generative artificial intelligence model does not find an appropriate placement of the new entity in the one or more suggested hierarchical paths.
3 . The computer-implemented method of claim 1 , wherein generating the context for each new embedding vector of the one or more new embedding vectors using the retrieval-augmented generation includes:
retrieving a vector database that stores the embedding vectors associated with the set of chunks;
identifying one or more relevant embedding vectors by comparing each new embedding vector of the one or more new embedding vectors to the stored embedding vectors that have the relevance to the query above a particular similarity threshold value; and
extracting one or more chunks associated with the one or more relevant embedding vectors to generate the context.
4 . The computer-implemented method of claim 1 , further including:
generating a provenance information that includes references to one or more information sources that the generative artificial intelligence model used to generate the suggested hierarchical structure.
5 . The computer-implemented method of claim 1 , further including:
generating evaluation results by performing validations for each suggested hierarchical path of the one or more suggested hierarchical paths corresponding to each new entity of the one or more new entities, wherein the validations include:
assessing whether a hierarchy name associated with each hierarchy level of one or more hierarchy levels of each suggested hierarchical path of the one or more suggested hierarchical paths, is valid;
auto-correcting, based on the assessment, the hierarchy name that is found invalid;
checking whether each hierarchy level of each suggested hierarchical path of the one or more suggested hierarchical paths has a correct relationship with neighboring hierarchy levels within the suggested hierarchical path; and
evaluating a severity of an error of each suggested hierarchical path of the one or more suggested hierarchical paths associated with the one or more new entities.
6 . The computer-implemented method of claim 1 , further comprising generating evaluation results that comprise:
a vertical accuracy that measures a success rate of correctly placing each new entity of the one or more new entities in each suggested hierarchical path of the one or more suggested hierarchical paths; and
a horizontal accuracy that measures a success rate at each hierarchy level of each suggested hierarchical path of the one or more suggested hierarchical paths in the suggested hierarchical structure.
7 . The computer-implemented method of claim 1 , wherein the hierarchical structure is in a comma-separated value (CSV) or a spreadsheet file format.
8 . A system comprising:
one or more data processors; and
a non-transitory computer readable storage medium containing instruction which, when executed on the one or more data processors, cause the one or more data processors to perform a set of operations including:
receiving a user input that includes a hierarchical structure and a query for adding one or more new entities to the hierarchical structure, wherein the hierarchical structure comprises hierarchy levels that are assigned hierarchy names in which a plurality of entities is arranged with associated categorization rules, and wherein:
the one or more new entities include image data received in real-time from a continuous data stream by one or more data sources, and
the image data in the one or more new entities is processed using an image identification model to generate an entity name of a new entity;
generating, by leveraging an embedding model, an embedding vector for each chunk of a set of chunks that are obtained by splitting the hierarchical structure based on predefined criteria, wherein embedding vectors associated with the set of chunks capture the hierarchy names, the hierarchy levels, semantic meanings and the associated categorization rules within the hierarchical structure;
generating one or more new embedding vectors associated with the one or more new entities by leveraging the embedding model;
generating, for each new embedding vector of the one or more new embedding vectors, a context via a retrieval-augmented generation, based on a relevance to the query;
generating, via the retrieval-augmented generation, an additional context from a knowledge base that comprises data from one or more external sources that were not included in training of a generative artificial intelligence model;
augmenting, using a processing subsystem within a cloud infrastructure system that includes the one or more data processors, the query with a system prompt, the context from the hierarchical structure and the additional context from the knowledge base to generate a human-readable prompt, wherein the system prompt includes instructions to the generative artificial intelligence model for generating a suggested hierarchical structure;
inputting the human-readable prompt to the generative artificial intelligence model to generate, for each new entity of the one or more new entities, one or more suggested hierarchical paths, wherein the new entity of the one or more new entities having the entity name is correctly placed at a hierarchy level in the one or more suggested hierarchical paths by following the associated categorization rules;
generating, based on the generative artificial intelligence model, the suggested hierarchical structure incorporating the one or more suggested hierarchical paths associated with the one or more new entities in the suggested hierarchical structure, wherein the suggested hierarchical structure is displayed on one or more display devices;
and
generating a provenance information that includes references to one or more information sources used by the generative artificial intelligence model to provide the suggested hierarchical structure.
9 . The system of claim 8 , wherein the set of operations further includes:
generating, for the new entity of one or more new entities, the suggested hierarchy path that includes a hierarchy extension by adding a new hierarchy name at one or more hierarchy levels, when the generative artificial intelligence model does not find an appropriate placement of the new entity.
10 . The system of claim 8 , wherein generating the context for each new embedding vector of the one or more new embedding vectors using the retrieval-augmented generation includes:
retrieving a vector database that stores the embedding vectors associated with the set of chunks;
identifying one or more relevant embedding vectors by comparing each new embedding vector to the stored embedding vectors that have the relevance to the query above a particular similarity threshold; and
extracting one or more chunks associated with the one or more relevant embedding vectors to generate the context.
11 . The system of claim 8 , wherein the set of operations further includes:
generating a provenance information that includes references to one or more sources that the embedding AI model used to generate the suggested hierarchical structure.
12 . The system of claim 8 , wherein the set of operations further includes:
generating evaluation results by performing validations for each suggested hierarchical path corresponding to each new entity of the one or more new entities, wherein the validations include:
assessing whether a hierarchy name associated with each hierarchy level within the suggested hierarchical path, is valid;
auto-correcting, based on the assessment, the hierarchy name that is found invalid;
checking whether each hierarchy level has a correct relationship with neighboring hierarchy levels within the suggested hierarchical path; and
evaluating a severity of an error within the suggested hierarchy paths associated with the one or more new entities.
13 . The system of claim 8 , wherein the set of operations further includes generating evaluation results that comprise:
a vertical accuracy that measures a success rate of correctly placing each new entity in the suggested hierarchical path; and
a horizontal accuracy that measures a success rate at each hierarchy level in the suggested hierarchical structure.
14 . The system of claim 8 , wherein the hierarchical structure is in a comma-separated value (CSV) or a spreadsheet file format.
15 . A computer-program product tangibly embodied in a non-transitory machine-readable storage medium, including instructions configured to cause one or more data processors to perform to perform a set of operations comprising:
receiving a user input that includes a hierarchical structure and a query for adding one or more new entities to the hierarchical structure, wherein the hierarchical structure comprises hierarchy levels that are assigned hierarchy names in which a plurality of entities is arranged with associated categorization rules, and wherein:
the one or more new entities include image data received in real-time from a continuous data stream by one or more data sources, and
the image data in the one or more new entities is processed using an image identification model to generate an entity name of a new entity;
generating, by leveraging an embedding model, an embedding vector for each chunk of a set of chunks that are obtained by splitting the hierarchical structure based on predefined criteria, wherein embedding vectors associated with the set of chunks capture the hierarchy names, the hierarchy levels, semantic meanings and the associated categorization rules within the hierarchical structure;
generating one or more new embedding vectors associated with the one or more new entities by leveraging the embedding model;
generating, for each new embedding vector of the one or more new embedding vectors, a context via a retrieval-augmented generation, based on a relevance to the query;
generating, via the retrieval-augmented generation, an additional context from a knowledge base that comprises data from one or more external sources that were not included in training of a generative artificial intelligence model;
augmenting, using a processing subsystem within a cloud infrastructure system that includes the one or more data processors, the query with a system prompt, the context from the hierarchical structure and the additional context from the knowledge base to generate a human-readable prompt, wherein the system prompt includes instructions to the generative artificial intelligence model for generating a suggested hierarchical structure;
inputting the human-readable prompt to the generative artificial intelligence model to generate, for each new entity of the one or more new entities, one or more suggested hierarchical paths, wherein the new entity of the one or more new entities having the entity name is correctly placed at a hierarchy level in the one or more suggested hierarchical paths by following the associated categorization rules;
generating, based on the generative artificial intelligence model, the suggested hierarchical structure incorporating the one or more suggested hierarchical paths associated with the one or more new entities in the suggested hierarchical structure, wherein the suggested hierarchical structure is displayed on one or more display devices; and
generating a provenance information that includes references to one or more information sources used by the generative artificial intelligence model to provide the suggested hierarchical structure.
16 . The computer-program product of claim 15 , wherein the set of operations further includes:
generating, for the new entity of one or more new entities, the suggested hierarchy path that includes a hierarchy extension by adding a new hierarchy name at one or more hierarchy levels, when the generative artificial intelligence model does not find an appropriate placement of the new entity.
17 . The computer-program product of claim 15 , wherein generating the context for each new embedding vector of the one or more new embedding vectors using the retrieval-augmented generation includes:
retrieving a vector database that stores the embedding vectors associated with the set of chunks;
identifying one or more relevant embedding vectors by comparing each new embedding vector to the stored embedding vectors that have the relevance to the query above a particular similarity threshold; and
extracting one or more chunks associated with the one or more relevant embedding vectors to generate the context.
18 . The computer-program product of claim 15 , wherein the set of operations further includes:
generating a provenance information that includes references to one or more sources that the generative artificial intelligence model used to generate the suggested hierarchical structure.
19 . The computer-program product of claim 15 , wherein the set of operations further includes:
generating evaluation results by performing validations for each suggested hierarchical path corresponding to each new entity of the one or more new entities, wherein the validations include:
assessing whether a hierarchy name associated with each hierarchy level within the suggested hierarchical path, is valid;
auto-correcting, based on the assessment, the hierarchy name that is found invalid;
checking whether each hierarchy level has a correct relationship with neighboring hierarchy levels within the suggested hierarchical path; and
evaluating a severity of an error within the suggested hierarchy paths associated with the one or more new entities.
20 . The computer-program product of claim 15 , wherein the set of operations further includes generating evaluation results that comprise:
a vertical accuracy that measures a success rate of correctly placing each new entity in the suggested hierarchical path; and
a horizontal accuracy that measures a success rate at each hierarchy level in the suggested hierarchical structure.