Spaces:
Sleeping
Sleeping
Asaad Almutareb commited on
Commit ·
1314610
1
Parent(s): aae1d57
added persistent_directory to chroma client
Browse files
app.py
CHANGED
|
@@ -20,6 +20,7 @@ import os
|
|
| 20 |
dotenv.load_dotenv()
|
| 21 |
config = ConfigParser()
|
| 22 |
config.read('innovation_pathfinder_ai/config.ini')
|
|
|
|
| 23 |
|
| 24 |
logger = logger.get_console_logger("app")
|
| 25 |
|
|
@@ -28,7 +29,9 @@ app = FastAPI()
|
|
| 28 |
def initialize_chroma_db() -> Chroma:
|
| 29 |
collection_name = config.get('main', 'CONVERSATION_COLLECTION_NAME')
|
| 30 |
|
| 31 |
-
client = chromadb.PersistentClient(
|
|
|
|
|
|
|
| 32 |
|
| 33 |
collection = client.get_or_create_collection(
|
| 34 |
name=collection_name,
|
|
|
|
| 20 |
dotenv.load_dotenv()
|
| 21 |
config = ConfigParser()
|
| 22 |
config.read('innovation_pathfinder_ai/config.ini')
|
| 23 |
+
persist_directory = config.get('main', 'VECTOR_DATABASE_LOCATION')
|
| 24 |
|
| 25 |
logger = logger.get_console_logger("app")
|
| 26 |
|
|
|
|
| 29 |
def initialize_chroma_db() -> Chroma:
|
| 30 |
collection_name = config.get('main', 'CONVERSATION_COLLECTION_NAME')
|
| 31 |
|
| 32 |
+
client = chromadb.PersistentClient(
|
| 33 |
+
path=persist_directory
|
| 34 |
+
)
|
| 35 |
|
| 36 |
collection = client.get_or_create_collection(
|
| 37 |
name=collection_name,
|
innovation_pathfinder_ai/knowledge_base/placeholder.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
this file is needed
|
innovation_pathfinder_ai/structured_tools/structured_tools.py
CHANGED
|
@@ -37,6 +37,7 @@ from configparser import ConfigParser
|
|
| 37 |
|
| 38 |
config = ConfigParser()
|
| 39 |
config.read('innovation_pathfinder_ai/config.ini')
|
|
|
|
| 40 |
|
| 41 |
@tool
|
| 42 |
def memory_search(query:str) -> str:
|
|
@@ -44,7 +45,7 @@ def memory_search(query:str) -> str:
|
|
| 44 |
This is your primary source to start your search with checking what you already have learned from the past, before going online."""
|
| 45 |
# Since we have more than one collections we should change the name of this tool
|
| 46 |
client = chromadb.PersistentClient(
|
| 47 |
-
|
| 48 |
)
|
| 49 |
|
| 50 |
collection_name = config.get('main', 'CONVERSATION_COLLECTION_NAME')
|
|
@@ -70,7 +71,7 @@ def knowledgeBase_search(query:str) -> str:
|
|
| 70 |
"""Search the internal knowledge base for research papers and relevent chunks"""
|
| 71 |
# Since we have more than one collections we should change the name of this tool
|
| 72 |
client = chromadb.PersistentClient(
|
| 73 |
-
|
| 74 |
)
|
| 75 |
|
| 76 |
collection_name="ArxivPapers"
|
|
@@ -144,7 +145,7 @@ def embed_arvix_paper(paper_id:str) -> None:
|
|
| 144 |
paper.download_pdf(dirpath=pdf_directory, filename=f"{number_without_period}.pdf")
|
| 145 |
|
| 146 |
client = chromadb.PersistentClient(
|
| 147 |
-
|
| 148 |
)
|
| 149 |
|
| 150 |
collection_name="ArxivPapers"
|
|
|
|
| 37 |
|
| 38 |
config = ConfigParser()
|
| 39 |
config.read('innovation_pathfinder_ai/config.ini')
|
| 40 |
+
persist_directory = config.get('main', 'VECTOR_DATABASE_LOCATION')
|
| 41 |
|
| 42 |
@tool
|
| 43 |
def memory_search(query:str) -> str:
|
|
|
|
| 45 |
This is your primary source to start your search with checking what you already have learned from the past, before going online."""
|
| 46 |
# Since we have more than one collections we should change the name of this tool
|
| 47 |
client = chromadb.PersistentClient(
|
| 48 |
+
path=persist_directory,
|
| 49 |
)
|
| 50 |
|
| 51 |
collection_name = config.get('main', 'CONVERSATION_COLLECTION_NAME')
|
|
|
|
| 71 |
"""Search the internal knowledge base for research papers and relevent chunks"""
|
| 72 |
# Since we have more than one collections we should change the name of this tool
|
| 73 |
client = chromadb.PersistentClient(
|
| 74 |
+
path=persist_directory,
|
| 75 |
)
|
| 76 |
|
| 77 |
collection_name="ArxivPapers"
|
|
|
|
| 145 |
paper.download_pdf(dirpath=pdf_directory, filename=f"{number_without_period}.pdf")
|
| 146 |
|
| 147 |
client = chromadb.PersistentClient(
|
| 148 |
+
path=persist_directory,
|
| 149 |
)
|
| 150 |
|
| 151 |
collection_name="ArxivPapers"
|
innovation_pathfinder_ai/vector_store/chroma_vector_store.py
CHANGED
|
@@ -31,9 +31,7 @@ import os
|
|
| 31 |
dotenv.load_dotenv()
|
| 32 |
config = ConfigParser()
|
| 33 |
config.read('innovation_pathfinder_ai/config.ini')
|
| 34 |
-
|
| 35 |
-
VECTOR_DATABASE_LOCATION = config.get('main', 'VECTOR_DATABASE_LOCATION')
|
| 36 |
-
|
| 37 |
|
| 38 |
|
| 39 |
def read_markdown_file(file_path: str) -> str:
|
|
@@ -91,7 +89,7 @@ def add_markdown_to_collection(
|
|
| 91 |
splits = text_splitter.split_documents(md_header_splits)
|
| 92 |
|
| 93 |
client = chromadb.PersistentClient(
|
| 94 |
-
|
| 95 |
)
|
| 96 |
|
| 97 |
|
|
@@ -176,7 +174,7 @@ def add_pdf_to_vector_store(
|
|
| 176 |
|
| 177 |
|
| 178 |
client = chromadb.PersistentClient(
|
| 179 |
-
|
| 180 |
)
|
| 181 |
|
| 182 |
collection = client.get_or_create_collection(
|
|
@@ -210,7 +208,7 @@ if __name__ == "__main__":
|
|
| 210 |
collection_name="ArxivPapers"
|
| 211 |
|
| 212 |
client = chromadb.PersistentClient(
|
| 213 |
-
|
| 214 |
)
|
| 215 |
|
| 216 |
# delete existing collection
|
|
@@ -238,7 +236,7 @@ if __name__ == "__main__":
|
|
| 238 |
|
| 239 |
#create the cliient using Chroma's library
|
| 240 |
client = chromadb.PersistentClient(
|
| 241 |
-
|
| 242 |
)
|
| 243 |
|
| 244 |
# This is an example collection name
|
|
|
|
| 31 |
dotenv.load_dotenv()
|
| 32 |
config = ConfigParser()
|
| 33 |
config.read('innovation_pathfinder_ai/config.ini')
|
| 34 |
+
persist_directory = config.get('main', 'VECTOR_DATABASE_LOCATION')
|
|
|
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
def read_markdown_file(file_path: str) -> str:
|
|
|
|
| 89 |
splits = text_splitter.split_documents(md_header_splits)
|
| 90 |
|
| 91 |
client = chromadb.PersistentClient(
|
| 92 |
+
path=persist_directory,
|
| 93 |
)
|
| 94 |
|
| 95 |
|
|
|
|
| 174 |
|
| 175 |
|
| 176 |
client = chromadb.PersistentClient(
|
| 177 |
+
path=persist_directory,
|
| 178 |
)
|
| 179 |
|
| 180 |
collection = client.get_or_create_collection(
|
|
|
|
| 208 |
collection_name="ArxivPapers"
|
| 209 |
|
| 210 |
client = chromadb.PersistentClient(
|
| 211 |
+
path=persist_directory,
|
| 212 |
)
|
| 213 |
|
| 214 |
# delete existing collection
|
|
|
|
| 236 |
|
| 237 |
#create the cliient using Chroma's library
|
| 238 |
client = chromadb.PersistentClient(
|
| 239 |
+
path=persist_directory,
|
| 240 |
)
|
| 241 |
|
| 242 |
# This is an example collection name
|