Spaces:
Sleeping
Sleeping
Update setup_code.py
Browse files- setup_code.py +9 -2
setup_code.py
CHANGED
@@ -179,10 +179,17 @@ class Relevant_Documents_Agent:
|
|
179 |
def is_relevant(self, matches_text, user_query_plus_conversation) -> bool:
|
180 |
prompt = f"Please confirm that the text in angle brackets: <{matches_text}>, is relevant to the text in double square brackets: [[{user_query_plus_conversation}]]. Return Yes or No"
|
181 |
#st.write(f"is_relevant prompt {prompt}")
|
182 |
-
response = get_completion(self.client, prompt)
|
183 |
#st.write(f"is_relevant response {response}")
|
184 |
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
class OpenAI_Agent:
|
188 |
def __init__(self, model="gpt-3.5-turbo", key_filename="open_ai_key.txt"):
|
|
|
179 |
def is_relevant(self, matches_text, user_query_plus_conversation) -> bool:
|
180 |
prompt = f"Please confirm that the text in angle brackets: <{matches_text}>, is relevant to the text in double square brackets: [[{user_query_plus_conversation}]]. Return Yes or No"
|
181 |
#st.write(f"is_relevant prompt {prompt}")
|
182 |
+
# response = get_completion(self.client, prompt)
|
183 |
#st.write(f"is_relevant response {response}")
|
184 |
|
185 |
+
count = 0
|
186 |
+
|
187 |
+
for i in range(3):
|
188 |
+
response = get_completion(self.client, prompt)
|
189 |
+
count += int(is_Yes(response))
|
190 |
+
|
191 |
+
# return is_Yes(response)
|
192 |
+
return count >= 2
|
193 |
|
194 |
class OpenAI_Agent:
|
195 |
def __init__(self, model="gpt-3.5-turbo", key_filename="open_ai_key.txt"):
|