ujaganna commited on
Commit
86c6863
·
verified ·
1 Parent(s): 34c8c28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -9,8 +9,28 @@ from langchain_community.document_loaders import Docx2txtLoader
9
  from langchain_community.document_loaders import UnstructuredWordDocumentLoader
10
  from langchain.indexes import VectorstoreIndexCreator
11
  from langchain_community.document_loaders import PyPDFLoader
12
-
13
  import os
14
 
15
  from dotenv import load_dotenv, find_dotenv
16
  _ = load_dotenv(find_dotenv())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  from langchain_community.document_loaders import UnstructuredWordDocumentLoader
10
  from langchain.indexes import VectorstoreIndexCreator
11
  from langchain_community.document_loaders import PyPDFLoader
12
+ import datetime
13
  import os
14
 
15
  from dotenv import load_dotenv, find_dotenv
16
  _ = load_dotenv(find_dotenv())
17
+
18
+
19
+ # account for deprecation of LLM model
20
+
21
+ # Get the current date
22
+ current_date = datetime.datetime.now().date()
23
+
24
+ # Define the date after which the model should be set to "gpt-3.5-turbo"
25
+ target_date = datetime.date(2024, 6, 12)
26
+
27
+ # Set the model variable based on the current date
28
+ if current_date > target_date:
29
+ llm_model = "gpt-3.5-turbo"
30
+ else:
31
+ llm_model = "gpt-3.5-turbo-0301"
32
+
33
+ loader = PyPDFLoader("Firm_Data.pdf")
34
+ index = VectorstoreIndexCreator(
35
+ vectorstore_cls=DocArrayInMemorySearch
36
+ ).from_loaders([loader])