Interactive prompting for supply chains
A computing system for interactive prompting for a supply chain includes processing circuitry that constructs a knowledge graph based ontologies from a plurality of data sources, the ontologies being related to a product. In a turn-based dialog session, the processing circuitry receives a prompt for the product, identifies at least one ontology-level node in a first layer of the knowledge graph, and generates one or more sub-questions. The processing circuitry outputs the sub-questions via a large language model, receives responses to the sub-questions, identifies one or more second-level nodes in a second, middle layer of the knowledge graph based on the responses, and performs a multi-hop query to identify one or more instance-level nodes in the third layer of the knowledge graph. The processing circuitry outputs, via the large language model, text data corresponding to the instance-level nodes as an answer to the prompt.
1 . A computing system for interactive prompting for an agricultural food product supply chain, the computing system comprising:
a computing device including processing circuitry configured to execute instructions using portions of associated memory to implement an interactive prompting program, wherein the processing circuitry is configured to:
obtain domain constructed ontologies related to an agricultural food product from a plurality of data sources;
generate text data for the domain constructed ontologies;
tokenize the text data for the domain constructed ontologies;
generate embeddings from the tokenized text data to construct a knowledge graph based on the ontologies; and
store the knowledge graph in a vector database, and
in an inference phase:
receive a prompt for the agricultural food product via a prompt interface in a turn-based dialog session;
in response to the prompt, identify at least one ontology-level node in a first layer of the knowledge graph that matches information in the prompt;
generate one or more sub-question prompts based on the at least one ontology-level node;
input the one or more sub-question prompts to a large language model, and, in response, receive as output from the large language model one or more sub-questions;
output the one or more sub-questions for display in the turn-based dialog session via the prompt interface;
receive responses to the one or more sub-questions in the turn-based dialog session via the prompt interface;
identify one or more second-level nodes in a second, middle layer of the knowledge graph based on the responses to the one or more sub-questions;
perform a multi-hop query to identify one or more instance-level nodes in a third layer of the knowledge graph; and
output text data corresponding to the one or more instance-level nodes as an answer to the prompt for the agricultural food product in the turn-based dialog session via the prompt interface, wherein
the prompt and the one or more sub-question prompts are received as text input,
the text input is tokenized, and
embeddings generated from the tokenized text input are used to query the vector database to identify nodes in the knowledge graph.
2 . The computing system of claim 1 , further comprising:
a retrieval model configured to query the knowledge graph and generate the one or more sub-question prompts.
3 . The computing system of claim 2 , wherein
the retrieval model is a retrieval-augmented generation model.
4 . The computing system of claim 1 , wherein
the prompt is a question regarding where the agricultural food product can be sold.
5 . The computing system of claim 1 , wherein
the first layer of the knowledge graph is configured as an ontology-level layer that contains factorial entities related to sales of the agricultural food product.
6 . The computing system of claim 1 , wherein
the second, middle layer of the knowledge graph includes logic from agricultural regulations and subject matter experts for decision making.
7 . The computing system of claim 1 , wherein
the third layer of the knowledge graph is configured as an instance-level layer that contains specific diversified market options for the agricultural food product and their respective locations.
8 . The computing system of claim 1 , wherein
the one or more sub-questions identifies factors relating to at least one of a location of a growing facility, a certification of the growing facility, or a type of the agricultural food product.
9 . The computing system of claim 1 , wherein
the knowledge graph is constructed using open source data and user private data.
10 . A method for interactive prompting for an agricultural food supply chain, the method comprising, at a computing device including processing circuitry and memory:
obtaining domain constructed ontologies related to an agricultural food product from a plurality of data sources;
generating text data for the domain constructed ontologies;
tokenizing the text data for the domain constructed ontologies;
generating embeddings from the tokenized text data to construct a knowledge graph based on the ontologies; and
storing the knowledge graph in a vector database, and
in an inference phase:
receiving a prompt for the agricultural food product in a turn-based dialog session via a prompt interface;
in response to the prompt, identifying at least one ontology-level node in a first layer of the knowledge graph that matches information in the prompt;
generating one or more sub-question prompts based on each of the at least one ontology-level node;
inputting the one or more sub-question prompts to a large language model, and receiving as output one or more sub-questions according to the one or more sub-question prompts;
outputting the one or more sub-questions for display in the turn-based dialog session via the prompt interface;
receiving responses to the one or more sub-questions in the turn-based dialog session via the prompt interface;
identifying one or more second-level nodes in a second, middle layer of the knowledge graph based on the responses to the one or more sub-questions;
performing a multi-hop query to identify one or more instance-level nodes in a third layer of the knowledge graph; and
outputting text data corresponding to the one or more instance-level nodes as an answer to the prompt for the agricultural food product in the turn-based dialog session via the prompt interface, wherein
the prompt and the one or more sub-question prompts are received as text input,
the text input is tokenized, and
embeddings generated from the tokenized text input are used to query the vector database to identify nodes in the knowledge graph.
11 . The method of claim 10 , the method further comprising:
at a retrieval model, querying, the knowledge graph, and generating the one or more sub-question prompts.
12 . The method of claim 11 , the method further comprising:
configuring the retrieval model as a retrieval-augmented generation model.
13 . The method of claim 10 , the method further comprising:
including in the knowledge graph sub-graphs with data related to factor ontology, decision making, and market options.
14 . The method of claim 10 , the method further comprising:
configuring the first layer of the knowledge graph as an ontology-level layer that contains factorial entities related to sales of the agricultural food product.
15 . The method of claim 10 , the method further comprising:
including in the second, middle layer of the knowledge graph logic from agricultural regulations and subject matter experts for decision making.
16 . The method of claim 10 , the method further comprising:
configuring the third layer of the knowledge graph as an instance-level layer that contains specific diversified market options for the agricultural food product and their respective locations.
17 . The method of claim 10 , the method further comprising:
identifying, via the one or more sub-questions, factors relating to at least one of a location of a growing facility, a certification of the growing facility, or a type of the agricultural food product.
18 . A computing system for interactive prompting for an industrial product supply chain, the computing system comprising:
a computing device including processing circuitry configured to execute instructions using portions of associated memory to implement an interactive prompting program, wherein the processing circuitry is configured to:
obtain domain constructed ontologies related to an industrial product from open source data and user private data; and
construct a knowledge graph based on the ontologies, and
in an inference phase:
receive a prompt for the industrial product via a prompt interface in a turn-based dialog session;
in response to the prompt, identify at least one ontology-level node in a first layer of the knowledge graph that matches information in the prompt;
generate, via a retrieval-augmented generation model, one or more sub-question prompts to identify factors relating to at least one of an economic structure, a location of a production facility, a certification of the production facility, or a type of the industrial product;
input the one or more sub-question prompts to a large language model, and in response receive as output from the large language model one or more sub-questions;
output the one or more sub-questions for display in the turn-based dialog session via the prompt interface;
receive responses to the one or more sub-questions in the turn-based dialog session via the prompt interface;
identify one or more second-level nodes in a second, middle layer of the knowledge graph based on the responses to the one or more sub-questions;
perform a multi-hop query to identify one or more instance-level nodes in a third layer of the knowledge graph; and
output text data corresponding to the one or more instance-level nodes as an answer to the prompt for the industrial product in the turn-based dialog session via the prompt interface, wherein
the first layer of the knowledge graph is configured as an ontology-level layer that contains factorial entities related to sales of the industrial product,
the second, middle layer of the knowledge graph includes logic from industrial regulations and subject matter experts for decision making, and
the third layer of the knowledge graph is configured as an instance-level layer that contains specific diversified market options for the industrial product and their respective locations.
19 . The computing system of claim 18 , further comprising:
a retrieval-augmented generation model configured to query the knowledge graph and generate the one or more sub-question prompts.
20 . The computing system of claim 18 , wherein
the prompt is a question regarding where the industrial product can be sold.