umangchaudhry commited on
Commit
15eadf4
·
verified ·
1 Parent(s): d6a2c1d

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. summary_tool_questions.md +1 -1
app.py CHANGED
@@ -7,7 +7,7 @@ from langchain.chains.combine_documents import create_stuff_documents_chain
7
  from langchain_core.prompts import ChatPromptTemplate
8
  from langchain_openai import ChatOpenAI
9
  from langchain_community.document_loaders import PyPDFLoader
10
- from langchain_core.vectorstores import InMemoryVectorStore
11
  from langchain_openai import OpenAIEmbeddings
12
  from langchain_text_splitters import RecursiveCharacterTextSplitter
13
 
@@ -26,12 +26,12 @@ def process_pdf(api_key, uploaded_file, questions_path, prompt_path, display_pla
26
  docs = loader.load()
27
 
28
  # Split the document into smaller chunks for embedding
29
- text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
30
  splits = text_splitter.split_documents(docs)
31
 
32
  # Create vector store and retriever
33
- vectorstore = InMemoryVectorStore.from_documents(
34
- documents=splits, embedding=OpenAIEmbeddings()
35
  )
36
  retriever = vectorstore.as_retriever(search_kwargs={"k": 10})
37
 
 
7
  from langchain_core.prompts import ChatPromptTemplate
8
  from langchain_openai import ChatOpenAI
9
  from langchain_community.document_loaders import PyPDFLoader
10
+ from langchain.vectorstores import FAISS
11
  from langchain_openai import OpenAIEmbeddings
12
  from langchain_text_splitters import RecursiveCharacterTextSplitter
13
 
 
26
  docs = loader.load()
27
 
28
  # Split the document into smaller chunks for embedding
29
+ text_splitter = RecursiveCharacterTextSplitter(chunk_size=3000, chunk_overlap=500)
30
  splits = text_splitter.split_documents(docs)
31
 
32
  # Create vector store and retriever
33
+ vectorstore = FAISS.from_documents(
34
+ documents=splits, embedding=OpenAIEmbeddings(model="text-embedding-3-large")
35
  )
36
  retriever = vectorstore.as_retriever(search_kwargs={"k": 10})
37
 
summary_tool_questions.md CHANGED
@@ -1,4 +1,4 @@
1
- Provide a summary of information available from the plan including the city name, population, geography, major industries, per capita income, or similar summary information.
2
 
3
  To what extent does the plan address resilience, mitigation, and adaptation?
4
 
 
1
+ Provide a summary of information available from the plan regarding the planning jurisdiction, including its name, location, population, geography, major industries, per capita income, and similar information.
2
 
3
  To what extent does the plan address resilience, mitigation, and adaptation?
4