Create state_manager.py
Browse files- state_manager.py +22 -0
state_manager.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from langchain.vectorstores import Chroma
|
2 |
+
from langchain.chat_models import ChatOpenAI
|
3 |
+
from langchain.chains import ConversationalRetrievalChain
|
4 |
+
|
5 |
+
class StateManager:
|
6 |
+
def __init__(self):
|
7 |
+
self.vectorstore = None
|
8 |
+
self.conversation_chain = None
|
9 |
+
|
10 |
+
def create_vectorstore(self, text_chunks):
|
11 |
+
self.vectorstore = self.get_vectorstore(text_chunks)
|
12 |
+
|
13 |
+
def create_conversation_chain(self):
|
14 |
+
self.conversation_chain = self.get_conversation_chain()
|
15 |
+
|
16 |
+
def get_vectorstore(self, text_chunks):
|
17 |
+
# Your existing get_vectorstore function logic
|
18 |
+
pass
|
19 |
+
|
20 |
+
def get_conversation_chain(self):
|
21 |
+
# Your existing get_conversation_chain function logic
|
22 |
+
pass
|