Spaces:
Runtime error
Runtime error
Chintan Donda
commited on
Commit
·
227ccaf
1
Parent(s):
ac64082
Fixing issue in Display Data Source widget
Browse files- app.py +7 -2
- src/constants.py +1 -0
- src/langchain_utils.py +1 -2
app.py
CHANGED
|
@@ -173,15 +173,20 @@ class DomState:
|
|
| 173 |
# return json.dumps(self.kb_sources, default=_serialize_sets)
|
| 174 |
kb_sources = ''
|
| 175 |
for index_category, doc_type in self.kb_sources.items():
|
| 176 |
-
|
|
|
|
|
|
|
| 177 |
kb_sources += f'Question Category: {index_category}'
|
| 178 |
for dt, source in doc_type.items():
|
| 179 |
-
kb_sources += '\n' + f'='*50 + '\n'
|
| 180 |
if not source:
|
| 181 |
continue
|
|
|
|
| 182 |
kb_sources += f'Document type: {dt}'
|
|
|
|
| 183 |
for doc in source:
|
| 184 |
kb_sources += f'\t\t\t\n{doc}'
|
|
|
|
|
|
|
| 185 |
self.kb_sources = kb_sources
|
| 186 |
return self.kb_sources
|
| 187 |
|
|
|
|
| 173 |
# return json.dumps(self.kb_sources, default=_serialize_sets)
|
| 174 |
kb_sources = ''
|
| 175 |
for index_category, doc_type in self.kb_sources.items():
|
| 176 |
+
if not doc_type:
|
| 177 |
+
continue
|
| 178 |
+
kb_sources += f'='*100 + '\n'
|
| 179 |
kb_sources += f'Question Category: {index_category}'
|
| 180 |
for dt, source in doc_type.items():
|
|
|
|
| 181 |
if not source:
|
| 182 |
continue
|
| 183 |
+
kb_sources += '\n' + f'='*50 + '\n'
|
| 184 |
kb_sources += f'Document type: {dt}'
|
| 185 |
+
kb_sources += '\n' + f'='*25
|
| 186 |
for doc in source:
|
| 187 |
kb_sources += f'\t\t\t\n{doc}'
|
| 188 |
+
kb_sources += '\n\n'
|
| 189 |
+
|
| 190 |
self.kb_sources = kb_sources
|
| 191 |
return self.kb_sources
|
| 192 |
|
src/constants.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import src.web_crawler as web_crawler_utils
|
| 3 |
import src.weather as weather_utils
|
| 4 |
|
|
|
|
| 5 |
LOAD_FROM_EXISTING_INDEX_STORE = False
|
| 6 |
INDEX_TYPE = 'FAISS'
|
| 7 |
|
|
|
|
| 2 |
import src.web_crawler as web_crawler_utils
|
| 3 |
import src.weather as weather_utils
|
| 4 |
|
| 5 |
+
# Wheater to load the existing index store or create from scratch?
|
| 6 |
LOAD_FROM_EXISTING_INDEX_STORE = False
|
| 7 |
INDEX_TYPE = 'FAISS'
|
| 8 |
|
src/langchain_utils.py
CHANGED
|
@@ -600,7 +600,6 @@ class LANGCHAIN_UTILS:
|
|
| 600 |
if not index or not isinstance(index, GPTSimpleVectorIndex):
|
| 601 |
logger.warning(f'{doc_type} index to be merged is not an instance of type llama_index.GPTSimpleVectorIndex')
|
| 602 |
continue
|
| 603 |
-
import pdb; pdb.set_trace()
|
| 604 |
raise NotImplementedError
|
| 605 |
|
| 606 |
# Store index_category master index
|
|
@@ -853,7 +852,7 @@ class LANGCHAIN_UTILS:
|
|
| 853 |
# Update self.index to store/overwrite the existing index with the updated index
|
| 854 |
self.index = self.index_category_doc_type_wise_index[index_category][doc_type]
|
| 855 |
|
| 856 |
-
|
| 857 |
# Store newly created/merged index
|
| 858 |
self.store_index(
|
| 859 |
index=self.index,
|
|
|
|
| 600 |
if not index or not isinstance(index, GPTSimpleVectorIndex):
|
| 601 |
logger.warning(f'{doc_type} index to be merged is not an instance of type llama_index.GPTSimpleVectorIndex')
|
| 602 |
continue
|
|
|
|
| 603 |
raise NotImplementedError
|
| 604 |
|
| 605 |
# Store index_category master index
|
|
|
|
| 852 |
# Update self.index to store/overwrite the existing index with the updated index
|
| 853 |
self.index = self.index_category_doc_type_wise_index[index_category][doc_type]
|
| 854 |
|
| 855 |
+
|
| 856 |
# Store newly created/merged index
|
| 857 |
self.store_index(
|
| 858 |
index=self.index,
|