Spaces:
Running
Running
Sourcery AI
commited on
Commit
•
c07be57
1
Parent(s):
9ca54c4
'Refactored by Sourcery'
Browse files- server/backend.py +8 -13
server/backend.py
CHANGED
@@ -128,14 +128,11 @@ def fetch_search_results(query):
|
|
128 |
'limit': 3,
|
129 |
})
|
130 |
|
131 |
-
results = []
|
132 |
snippets = ""
|
133 |
for index, result in enumerate(search.json()):
|
134 |
snippet = f'[{index + 1}] "{result["snippet"]}" URL:{result["link"]}.'
|
135 |
snippets += snippet
|
136 |
-
|
137 |
-
|
138 |
-
return results
|
139 |
|
140 |
|
141 |
def generate_stream(response, jailbreak):
|
@@ -205,12 +202,10 @@ def getJailbreak(jailbreak):
|
|
205 |
:param jailbreak: Jailbreak instruction string
|
206 |
:return: Jailbreak instructions if provided, otherwise None
|
207 |
"""
|
208 |
-
if jailbreak
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
else:
|
216 |
-
return None
|
|
|
128 |
'limit': 3,
|
129 |
})
|
130 |
|
|
|
131 |
snippets = ""
|
132 |
for index, result in enumerate(search.json()):
|
133 |
snippet = f'[{index + 1}] "{result["snippet"]}" URL:{result["link"]}.'
|
134 |
snippets += snippet
|
135 |
+
return [{'role': 'system', 'content': snippets}]
|
|
|
|
|
136 |
|
137 |
|
138 |
def generate_stream(response, jailbreak):
|
|
|
202 |
:param jailbreak: Jailbreak instruction string
|
203 |
:return: Jailbreak instructions if provided, otherwise None
|
204 |
"""
|
205 |
+
if jailbreak == "default":
|
206 |
+
return None
|
207 |
+
special_instructions[jailbreak][0]['content'] += special_instructions['two_responses_instruction']
|
208 |
+
if jailbreak not in special_instructions:
|
209 |
+
return None
|
210 |
+
special_instructions[jailbreak]
|
211 |
+
return special_instructions[jailbreak]
|
|
|
|