Spaces:
Runtime error
Runtime error
Removed debug print statements which cause extra chaff in the logs
Browse files- pages/010_LLM_Architectures.py +0 -2
- src/architectures.py +0 -4
- src/datatypes.py +0 -3
- src/st_helpers.py +0 -1
pages/010_LLM_Architectures.py
CHANGED
@@ -124,9 +124,7 @@ if st_setup('LLM Arch'):
|
|
124 |
arch_names = [a.name for a in Architecture.architectures]
|
125 |
compare = 'Side by side comparison'
|
126 |
arch_names.append(compare)
|
127 |
-
print(arch_names)
|
128 |
selected_arch = st.radio(label="Available architectures", label_visibility="hidden", options=arch_names, index=None)
|
129 |
-
print(f'Selected "{selected_arch}"')
|
130 |
if selected_arch is None:
|
131 |
st.info('Select an architecture from above to see details and interact with it')
|
132 |
elif selected_arch == compare:
|
|
|
124 |
arch_names = [a.name for a in Architecture.architectures]
|
125 |
compare = 'Side by side comparison'
|
126 |
arch_names.append(compare)
|
|
|
127 |
selected_arch = st.radio(label="Available architectures", label_visibility="hidden", options=arch_names, index=None)
|
|
|
128 |
if selected_arch is None:
|
129 |
st.info('Select an architecture from above to see details and interact with it')
|
130 |
elif selected_arch == compare:
|
src/architectures.py
CHANGED
@@ -299,7 +299,6 @@ class OutputResponseScreener(ArchitectureComponent):
|
|
299 |
}
|
300 |
llm_response = requests.post(self.endpoint_url, headers=headers, json=payload)
|
301 |
generated_text = json.loads(llm_response.text)[0]['generated_text'].strip()
|
302 |
-
print(f"Response screener got LLM response: {generated_text}")
|
303 |
if generated_text[0:2].lower() != 'no': # Lean cautious even if the model fails to return yes/no
|
304 |
request.response = "Sorry - I cannot answer this question. Please try and rephrase it."
|
305 |
request.early_exit = True
|
@@ -319,12 +318,9 @@ class RetrievalAugmentor(ArchitectureComponent):
|
|
319 |
# Get the count nearest documents from the doc store
|
320 |
input_query = request.request
|
321 |
results = self.collection.query(query_texts=[input_query], n_results=self.doc_count)
|
322 |
-
print(results)
|
323 |
documents = results['documents'][0] # Index 0 as we are always asking one question
|
324 |
|
325 |
# Update the request to include the retrieved documents
|
326 |
-
#new_query = f'QUESTION: {input_query}\n\n'
|
327 |
-
#new_query += '\n'.join([f'FACT: {d}' for d in documents])
|
328 |
new_query = '{"background": ['
|
329 |
new_query += ', '.join([f'"{d}"' for d in documents])
|
330 |
new_query += ']}\n\nQUESTION: '
|
|
|
299 |
}
|
300 |
llm_response = requests.post(self.endpoint_url, headers=headers, json=payload)
|
301 |
generated_text = json.loads(llm_response.text)[0]['generated_text'].strip()
|
|
|
302 |
if generated_text[0:2].lower() != 'no': # Lean cautious even if the model fails to return yes/no
|
303 |
request.response = "Sorry - I cannot answer this question. Please try and rephrase it."
|
304 |
request.early_exit = True
|
|
|
318 |
# Get the count nearest documents from the doc store
|
319 |
input_query = request.request
|
320 |
results = self.collection.query(query_texts=[input_query], n_results=self.doc_count)
|
|
|
321 |
documents = results['documents'][0] # Index 0 as we are always asking one question
|
322 |
|
323 |
# Update the request to include the retrieved documents
|
|
|
|
|
324 |
new_query = '{"background": ['
|
325 |
new_query += ', '.join([f'"{d}"' for d in documents])
|
326 |
new_query += ']}\n\nQUESTION: '
|
src/datatypes.py
CHANGED
@@ -14,7 +14,6 @@ class DataLoader:
|
|
14 |
def set_db_name(cls, name: str):
|
15 |
if name != cls.active_db:
|
16 |
new_file = os.path.join(data_dir, 'sqlite', f"{name}.db")
|
17 |
-
print(f"Switching database file from {cls.db_file} to {new_file}")
|
18 |
cls.db_file = os.path.join(DataLoader.db_dir, f"{name}.db")
|
19 |
DataLoader.load_data(reload=True)
|
20 |
cls.active_db = name
|
@@ -38,7 +37,6 @@ class DataLoader:
|
|
38 |
Product.all = {}
|
39 |
Category.all = {}
|
40 |
|
41 |
-
print(f"Loading {DataLoader.db_file}")
|
42 |
con = sqlite3.connect(DataLoader.db_file)
|
43 |
cur = con.cursor()
|
44 |
|
@@ -69,7 +67,6 @@ class DataLoader:
|
|
69 |
Review.all[r[0]] = rev
|
70 |
Product.all[r[1]].reviews.append(rev)
|
71 |
|
72 |
-
print("Data loaded")
|
73 |
DataLoader.loaded = True
|
74 |
|
75 |
|
|
|
14 |
def set_db_name(cls, name: str):
|
15 |
if name != cls.active_db:
|
16 |
new_file = os.path.join(data_dir, 'sqlite', f"{name}.db")
|
|
|
17 |
cls.db_file = os.path.join(DataLoader.db_dir, f"{name}.db")
|
18 |
DataLoader.load_data(reload=True)
|
19 |
cls.active_db = name
|
|
|
37 |
Product.all = {}
|
38 |
Category.all = {}
|
39 |
|
|
|
40 |
con = sqlite3.connect(DataLoader.db_file)
|
41 |
cur = con.cursor()
|
42 |
|
|
|
67 |
Review.all[r[0]] = rev
|
68 |
Product.all[r[1]].reviews.append(rev)
|
69 |
|
|
|
70 |
DataLoader.loaded = True
|
71 |
|
72 |
|
src/st_helpers.py
CHANGED
@@ -15,7 +15,6 @@ def login(pw: str) -> bool:
|
|
15 |
if pu_password == pw:
|
16 |
pu_user = pu[split_point + 1: -1]
|
17 |
st.session_state['username'] = pu_user
|
18 |
-
print(f'{pu_user} logged in')
|
19 |
return True
|
20 |
return False
|
21 |
|
|
|
15 |
if pu_password == pw:
|
16 |
pu_user = pu[split_point + 1: -1]
|
17 |
st.session_state['username'] = pu_user
|
|
|
18 |
return True
|
19 |
return False
|
20 |
|