Spaces:
Sleeping
Sleeping
Update appStore/rag.py
Browse files- appStore/rag.py +17 -16
appStore/rag.py
CHANGED
@@ -10,27 +10,14 @@ from tenacity import retry, stop_after_attempt, wait_random_exponential
|
|
10 |
|
11 |
# Get openai API key
|
12 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
13 |
-
model_select = "gpt-
|
14 |
|
15 |
|
16 |
# define a special function for putting the prompt together (as we can't use haystack)
|
17 |
-
# def get_prompt(context, label):
|
18 |
-
# base_prompt="Summarize the following context efficiently in bullet points, the less the better - but keep concrete goals. \
|
19 |
-
# Summarize only activities that address the vulnerability of "+label+" to climate change. \
|
20 |
-
# Formatting example: \
|
21 |
-
# - Bullet point 1 \
|
22 |
-
# - Bullet point 2 \
|
23 |
-
# "
|
24 |
-
|
25 |
-
# # Add the meta data for references
|
26 |
-
# # context = ' - '.join([d.content for d in docs])
|
27 |
-
# prompt = base_prompt+"; Context: "+context+"; Answer:"
|
28 |
-
|
29 |
-
# return prompt
|
30 |
-
|
31 |
def get_prompt(context, label):
|
32 |
base_prompt="Summarize the following context efficiently in bullet points, the less the better - but keep concrete goals. \
|
33 |
-
Summarize only elements of the context that address vulnerability to climate change. \
|
|
|
34 |
Formatting example: \
|
35 |
- Bullet point 1 \
|
36 |
- Bullet point 2 \
|
@@ -42,6 +29,20 @@ def get_prompt(context, label):
|
|
42 |
|
43 |
return prompt
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
# base_prompt="Summarize the following context efficiently in bullet points, the less the better- but keep concrete goals. \
|
46 |
# Summarize only activities that address the vulnerability of "+label+" to climate change. \
|
47 |
# Formatting example: \
|
|
|
10 |
|
11 |
# Get openai API key
|
12 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
13 |
+
model_select = "gpt-4-0125-preview"
|
14 |
|
15 |
|
16 |
# define a special function for putting the prompt together (as we can't use haystack)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
def get_prompt(context, label):
|
18 |
base_prompt="Summarize the following context efficiently in bullet points, the less the better - but keep concrete goals. \
|
19 |
+
Summarize only elements of the context that address vulnerability of "+label+" to climate change. \
|
20 |
+
If there is no mention of "+label+" in the context, return nothing. \
|
21 |
Formatting example: \
|
22 |
- Bullet point 1 \
|
23 |
- Bullet point 2 \
|
|
|
29 |
|
30 |
return prompt
|
31 |
|
32 |
+
# def get_prompt(context, label):
|
33 |
+
# base_prompt="Summarize the following context efficiently in bullet points, the less the better - but keep concrete goals. \
|
34 |
+
# Summarize only elements of the context that address vulnerability to climate change. \
|
35 |
+
# Formatting example: \
|
36 |
+
# - Bullet point 1 \
|
37 |
+
# - Bullet point 2 \
|
38 |
+
# "
|
39 |
+
|
40 |
+
# # Add the meta data for references
|
41 |
+
# # context = ' - '.join([d.content for d in docs])
|
42 |
+
# prompt = base_prompt+"; Context: "+context+"; Answer:"
|
43 |
+
|
44 |
+
# return prompt
|
45 |
+
|
46 |
# base_prompt="Summarize the following context efficiently in bullet points, the less the better- but keep concrete goals. \
|
47 |
# Summarize only activities that address the vulnerability of "+label+" to climate change. \
|
48 |
# Formatting example: \
|