You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/notebooks/augmented_model_suggester_examples.ipynb
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,15 @@
53
53
"execution_count": null,
54
54
"outputs": []
55
55
},
56
+
{
57
+
"cell_type": "markdown",
58
+
"source": [
59
+
"Here we introduce the AugmentedModelSuggester class. Creating an instance of it enables the chosen LLM to utilize Retrieval Augmented Generation (RAG) to determine causality. It currently does this by searching the CauseNet dataset for a relevant causal pair and augmenting the LLM with the corresponding evidence/information stored in CauseNet."
60
+
],
61
+
"metadata": {
62
+
"id": "DjYECuX84vbN"
63
+
}
64
+
},
56
65
{
57
66
"cell_type": "code",
58
67
"source": [
@@ -66,6 +75,15 @@
66
75
"execution_count": null,
67
76
"outputs": []
68
77
},
78
+
{
79
+
"cell_type": "markdown",
80
+
"source": [
81
+
"AugmentedModelSuggester can suggest the pairwise relationship given two variables. If a relevant causal pair is found in CauseNet, the LLM is augmented with the aforementioned information in CauseNet. If not found, by default, the LLM will rely on its own knowledge."
A class that extends SimpleModelSuggester and currently provides methods for suggesting causal relationships between variables by leveraging the CauseNet dataset for Retrieval Augmented Generation (RAG).
Suggests a cause-and-effect relationship between two variables, leveraging the CauseNet dataset for Retrieval Augmented Generation (RAG).
45
+
If a relevant causal pair is found in CauseNet, the LLM is augmented with corresponding information regarding the relationship stored
46
+
in CauseNet. If not found, by default, the LLM will rely on its own knowledge.
47
+
48
+
Args:
49
+
variable1 (str): The name of the first variable.
50
+
variable2 (str): The name of the second variable.
51
+
52
+
Returns:
53
+
list: A list containing the suggested cause variable, the suggested effect variable, and a description of the reasoning behind the suggestion. If there is no relationship between the two variables, the first two elements will be None.
query=f"""Which cause-and-effect-relationship is more likely? Provide reasoning and you must give your final answer (A, B, or C) in <answer> </answer> tags with the letter only.
126
107
A. {variable1} causes {variable2} B. {variable2} causes {variable1} C. neither {variable1} nor {variable2} cause each other."""
127
108
128
-
# Define the system prompt
129
109
ifsource_text:
130
-
# Create a document chain to combine retrieved documents
0 commit comments