Skip to content

Commit

Permalink
To support to explain a path generated by the ShowPaths component.
Browse files Browse the repository at this point in the history
  • Loading branch information
yjcyxky committed Mar 10, 2024
1 parent 495405e commit ca5c9f4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 9 additions & 1 deletion src/model/llm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ lazy_static! {
m6.insert("label", "Node/Edge Importance within Disease Context");
m6.insert("type", "subgraph");

let mut m7 = HashMap::new();
m7.insert("key", "explain_path_within_subgraph");
m7.insert("label", "Path within Subgraph");
m7.insert("type", "path");

m.push(m1);
m.push(m2);
m.push(m3);
Expand Down Expand Up @@ -220,7 +225,10 @@ lazy_static! {
// m.insert("explain_subgraph_importance_with_disease_ctx", "Knowledge Subgraph: {{subgraph}}\n\nKnowledge Subgraph Analysis Request:\nI have a set of Subgraph data that includes a collection of genes/proteins and their connections to a specific disease, {{ disease_name }}. This Subgraph consists of nodes (representing genes/proteins) and edges (representing interactions or relationships between the genes/proteins). Each node has associated attributes, such as name, description, or known disease associations. Edges may also have attributes, like the type or strength of interaction. My goal is to identify key nodes and paths within this Subgraph that are most relevant to {{ disease_name }}. To achieve this, please label these nodes and paths as critical, important, moderate, or less important based on your knowledges and the subgraph, and provide a rationale for your assessment. After labeling the nodes and paths, please output your findings as an array, the format is like```{your_output}```. The array contains a set of objects, each object have as least three columns: id (node or edge), importance, reason.");

// Table version
m.insert("explain_subgraph_importance_with_disease_ctx", "Knowledge Subgraph: {{subgraph}}\n\nKnowledge Subgraph Analysis Request:\nI have a set of Subgraph data that includes a collection of genes/proteins and their connections to a specific disease, {{ disease_name }}. This Subgraph consists of nodes (representing genes/proteins) and edges (representing interactions or relationships between the genes/proteins). Each node has associated attributes, such as name, description, or known disease associations. Edges may also have attributes, like the type or strength of interaction. My goal is to identify key nodes and edges within this Subgraph that are most relevant to {{ disease_name }}. To achieve this, please label all nodes and edges listed in the subgraph as Critical, Important, Moderate, or Less Important based on your knowledges on {{ disease_name }} and the subgraph, and provide a rationale for your assessment. Please note the subgraph might be incomplete, so you need to use your knowledges to think these nodes and edges step by step, and then assess the importance of the nodes and edges. After labeling the nodes and edges, please output your findings as a markdown table. The table contains a set of rows, each row have as least five columns: id (node id), name (node name), importance, reliability, reason. For reliability, you should use your knowledges to assess it, totally, if the relation is mentioned more frequent in your knowledgebase, then we can treat it more reliable. The final table you output should ordered by importance and reliability, and the importance should be ordered by Critical, Important, Moderate, and Less Important.");
m.insert("explain_subgraph_importance_with_disease_ctx", "Knowledge Subgraph: {{subgraph}}\n\nKnowledge Subgraph Analysis Request:\nI have a set of Subgraph data that includes a collection of genes/proteins and their connections to a specific disease, {{ disease_name }}. This Subgraph consists of nodes (representing genes/proteins) and edges (representing interactions or relationships between the genes/proteins). Each node has associated attributes, such as name, description, or known disease associations. Edges may also have attributes, like the type or strength of interaction. My goal is to identify key nodes and edges within this Subgraph that are most relevant to {{ disease_name }}. To achieve this, please label these nodes listed in the subgraph as Critical, Important, Moderate, or Less Important based on your knowledges on {{ disease_name }} and the subgraph, and provide a rationale for your assessment. After labeling the nodes, please output your results as a table (not a file). The table contains a set of rows, each row have as least six columns: #, ID (node id), Name (node name), Importance, Reliability, Reason. Please note: 1. the subgraph might be incomplete, so you need to use your knowledges to think these nodes step by step, and then assess the importance of the nodes; 2. you need to consider the importance of the node types for specific diseases, for example, symptom might be important for a symptom-defined disease, but it might be less important for a genetic disease; 3. you need to consider the reliability of the relation, for example, if the relation is mentioned more frequent in your knowledgebase, then we can treat it more reliable; 4. the final table you output should ordered by importance and reliability, and the importance should be ordered by Critical, Important, Moderate, and Less Important; 5. you need to tell me why you think the node is important / less important, reliable / less reliable, and the reason should be based on the subgraph and your knowledges (recommendation).");

// Actually, in this case, the disease_name is a path name.
m.insert("explain_path_within_subgraph", "Knowledge Subgraph: {{subgraph}}\n\nMy goal is to explain the path {{ disease_name }} within the subgraph. Please provide a detailed explanation of the path.");

m
};
Expand Down
2 changes: 1 addition & 1 deletion studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"antd": "5.7.0",
"antd-schema-form": "^4.5.1",
"axios": "^1.1.2",
"biominer-components": "0.3.8",
"biominer-components": "0.3.9",
"classnames": "^2.3.0",
"handlebars": "^4.7.7",
"handsontable": "^12.1.3",
Expand Down
8 changes: 4 additions & 4 deletions studio/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5375,10 +5375,10 @@ bindings@^1.5.0:
dependencies:
file-uri-to-path "1.0.0"

[email protected].8:
version "0.3.8"
resolved "https://registry.yarnpkg.com/biominer-components/-/biominer-components-0.3.8.tgz#923c6cdf79184ba4b9024350edde044cde18c447"
integrity sha512-oWNH3KFmHkETsWQAhi2J5DZtYsDNHrDcaAfeKYOS8xaLrE5c5oyN2KZBkuvxlJUAjTCnnikKLVMC6Qtugk/kvg==
[email protected].9:
version "0.3.9"
resolved "https://registry.yarnpkg.com/biominer-components/-/biominer-components-0.3.9.tgz#512944da9d17be91264f7b750b69de621240b985"
integrity sha512-w5E+N51OkvudBjv+FKKEY2JVGF4oXVapEx+KlpyN5Q832Q92IxfovE/O192YoIewnK8ibKr4ezfhTINw7BXhqg==
dependencies:
"@fingerprintjs/fingerprintjs" "^4.2.2"
ag-grid-community "^31.0.1"
Expand Down

0 comments on commit ca5c9f4

Please sign in to comment.