adding logs
Browse files- semantic.py +7 -1
semantic.py
CHANGED
@@ -107,7 +107,7 @@ class SemanticStoreFactory:
|
|
107 |
collection_name=META_SEMANTIC_COLLECTION,
|
108 |
force_recreate=True
|
109 |
)
|
110 |
-
_logger.info(f"\t==>
|
111 |
else:
|
112 |
semantic_chunk_vectorstore = Qdrant.from_documents(
|
113 |
semantic_chunks,
|
@@ -124,9 +124,11 @@ class SemanticStoreFactory:
|
|
124 |
def get_semantic_store(
|
125 |
cls
|
126 |
) -> VectorStore:
|
|
|
127 |
if cls._semantic_vectorstore is None:
|
128 |
if USE_MEMORY == True:
|
129 |
cls._semantic_vectorstore = cls.__create_semantic_store()
|
|
|
130 |
else:
|
131 |
print(f"Loading semantic vectorstore {META_SEMANTIC_COLLECTION} from: {VECTOR_STORE_PATH}")
|
132 |
try:
|
@@ -136,6 +138,7 @@ class SemanticStoreFactory:
|
|
136 |
_logger.warning(f"cannot load: {e}")
|
137 |
cls._semantic_vectorstore = cls.__create_semantic_store()
|
138 |
|
|
|
139 |
return cls._semantic_vectorstore
|
140 |
|
141 |
class SemanticRAGChainFactory:
|
@@ -146,7 +149,9 @@ class SemanticRAGChainFactory:
|
|
146 |
cls
|
147 |
) -> RunnableSequence:
|
148 |
if cls._chain is None:
|
|
|
149 |
semantic_store = SemanticStoreFactory.get_semantic_store()
|
|
|
150 |
if semantic_store is not None:
|
151 |
semantic_chunk_retriever = semantic_store.as_retriever()
|
152 |
semantic_mquery_retriever = MultiQueryRetriever.from_llm(
|
@@ -166,5 +171,6 @@ class SemanticRAGChainFactory:
|
|
166 |
# "context" : populated by getting the value of the "context" key from the previous step
|
167 |
| {"response": rag_prompt | gpt4_model, "context": itemgetter("context")}
|
168 |
)
|
|
|
169 |
|
170 |
return cls._chain
|
|
|
107 |
collection_name=META_SEMANTIC_COLLECTION,
|
108 |
force_recreate=True
|
109 |
)
|
110 |
+
_logger.info(f"\t==> finished constructing vectorstore")
|
111 |
else:
|
112 |
semantic_chunk_vectorstore = Qdrant.from_documents(
|
113 |
semantic_chunks,
|
|
|
124 |
def get_semantic_store(
|
125 |
cls
|
126 |
) -> VectorStore:
|
127 |
+
_logger.info(f"get_semantic_store")
|
128 |
if cls._semantic_vectorstore is None:
|
129 |
if USE_MEMORY == True:
|
130 |
cls._semantic_vectorstore = cls.__create_semantic_store()
|
131 |
+
_logger.info(f"received semantic_vectorstore")
|
132 |
else:
|
133 |
print(f"Loading semantic vectorstore {META_SEMANTIC_COLLECTION} from: {VECTOR_STORE_PATH}")
|
134 |
try:
|
|
|
138 |
_logger.warning(f"cannot load: {e}")
|
139 |
cls._semantic_vectorstore = cls.__create_semantic_store()
|
140 |
|
141 |
+
_logger.info(f"RETURNING get_semantic_store")
|
142 |
return cls._semantic_vectorstore
|
143 |
|
144 |
class SemanticRAGChainFactory:
|
|
|
149 |
cls
|
150 |
) -> RunnableSequence:
|
151 |
if cls._chain is None:
|
152 |
+
_logger.info(f"creating SemanticRAGChainFactory")
|
153 |
semantic_store = SemanticStoreFactory.get_semantic_store()
|
154 |
+
_logger.info(f"\treceived semantic_store")
|
155 |
if semantic_store is not None:
|
156 |
semantic_chunk_retriever = semantic_store.as_retriever()
|
157 |
semantic_mquery_retriever = MultiQueryRetriever.from_llm(
|
|
|
171 |
# "context" : populated by getting the value of the "context" key from the previous step
|
172 |
| {"response": rag_prompt | gpt4_model, "context": itemgetter("context")}
|
173 |
)
|
174 |
+
_logger.info(f"\t_chain constructed")
|
175 |
|
176 |
return cls._chain
|