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: core/prompts.py
+56-12Lines changed: 56 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,11 @@
1
1
fromlangchain.promptsimportStringPromptTemplate
2
2
frompydanticimportBaseModel, validator
3
3
4
-
PROMPT="""
4
+
RAG_PROMPT="""
5
5
<|system|>
6
-
You are an expert lawyer analyzing terms of service agreements. Given a statement about the service and 4 pieces of text extracted from its documents, pick the number of the text that directly answers the query in its entirety. Output a valid JSON object containing the choice of text and concise reasoning. If none of the texts can explicitly answer the statement, return 0. If there is a text that answers the question, set the "answer" field to true. In all other cases, set it to false.
7
-
Here are some examples:
6
+
You are an expert lawyer analyzing terms of service agreements for a website (called "service") Given a query statement and 4 pieces of text extracted from the service's documents, pick the number of the text that directly answers the query in its entirety. Output a valid JSON object containing the choice of text and concise reasoning. If none of the texts can explicitly answer the statement, return 0. If there is a text that answers the question, set the "answer" field to true. In all other cases, set it to false. DO NOT IMPLY ANYTHING NOT GIVEN IN THE TEXT.
7
+
8
+
Here are some examples:
8
9
9
10
Given the statement "You sign away all moral rights", which of the following texts, if any, answer it fully?
10
11
@@ -41,9 +42,6 @@
41
42
* Location information
42
43
* Log data
43
44
* Information from cookie data and similar technologies (To find out more about how we use cookies, please see our Cookie Policy)
44
-
* Device information
45
-
* Usage data and inferences
46
-
* User choices
47
45
```
48
46
2)
49
47
```
@@ -55,9 +53,6 @@
55
53
When we use cookies to learn about your behavior on or off of our services, we
56
54
or our partners will obtain consent that we may need under applicable law. To
57
55
find out more about how we use cookies, please see our Cookie Policy.
58
-
Additional Info for EEA, Swiss and UK Data Subjects: Legal bases we rely on
59
-
where we use your information
60
-
The below section only applies for residents in the EEA, Switzerland, and UK.
61
56
```
62
57
4)
63
58
```
@@ -81,7 +76,7 @@
81
76
}}
82
77
</s>
83
78
<|user|>
84
-
Given the statement "{query}", which text provides enough context to explicitly answer the entire statement? Do not infer or imply anything not provided in the texts. Answer with a single JSON object as demonstrated above.
79
+
Given the statement "{query}", which text provides enough context to explicitly answer the entire statement? Answer with a single JSON object as demonstrated above. DO NOT IMPLY ANYTHING NOT GIVEN IN THE TEXT.
85
80
1)
86
81
```
87
82
{result1}
@@ -102,7 +97,56 @@
102
97
<|assistant|>
103
98
"""
104
99
105
-
n_results=4
100
+
DOC_PROMPT="""
101
+
<|user|>
102
+
Respond with a JSON object with all the URLs that are likely to contain the terms and conditions,
103
+
user agreements, cookie policy, privacy policy etc. for {source} like so:
Given a statement about the service {service} and a piece of text that answers it, respond with a JSON object indicating if the statement is true or false like so:
0 commit comments