Asaad Almutareb commited on
Commit
92304dd
1 Parent(s): d713a77

moved configuration to a config.ini file

Browse files
app.py CHANGED
@@ -13,17 +13,20 @@ from innovation_pathfinder_ai.utils.utils import (
13
  from langchain_community.vectorstores import Chroma
14
 
15
  import chromadb
 
16
  import dotenv
17
  import os
18
 
19
  dotenv.load_dotenv()
 
 
20
 
21
  logger = logger.get_console_logger("app")
22
 
23
  app = FastAPI()
24
 
25
  def initialize_chroma_db() -> Chroma:
26
- collection_name=os.getenv("CONVERSATION_COLLECTION_NAME")
27
 
28
  client = chromadb.PersistentClient()
29
 
 
13
  from langchain_community.vectorstores import Chroma
14
 
15
  import chromadb
16
+ from configparser import ConfigParser
17
  import dotenv
18
  import os
19
 
20
  dotenv.load_dotenv()
21
+ config = ConfigParser()
22
+ config.read('config.ini')
23
 
24
  logger = logger.get_console_logger("app")
25
 
26
  app = FastAPI()
27
 
28
  def initialize_chroma_db() -> Chroma:
29
+ collection_name = config.get('main', 'CONVERSATION_COLLECTION_NAME')
30
 
31
  client = chromadb.PersistentClient()
32
 
config.ini ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [main]
2
+ VECTOR_DATABASE_LOCATION = innovation_pathfinder_ai/chroma_db/
3
+ CONVERSATION_COLLECTION_NAME = ConversationMemory
innovation_pathfinder_ai/structured_tools/structured_tools.py CHANGED
@@ -32,8 +32,12 @@ from innovation_pathfinder_ai.utils.utils import (
32
  create_wikipedia_urls_from_text, create_folder_if_not_exists,
33
  )
34
  import os
 
35
  # from innovation_pathfinder_ai.utils import create_wikipedia_urls_from_text
36
 
 
 
 
37
  @tool
38
  def memory_search(query:str) -> str:
39
  """Search the memory vector store for existing knowledge and relevent pervious researches. \
@@ -43,7 +47,7 @@ def memory_search(query:str) -> str:
43
  # path=persist_directory,
44
  )
45
 
46
- collection_name=os.getenv("CONVERSATION_COLLECTION_NAME")
47
  #store using envar
48
 
49
  embedding_function = SentenceTransformerEmbeddings(
 
32
  create_wikipedia_urls_from_text, create_folder_if_not_exists,
33
  )
34
  import os
35
+ from configparser import ConfigParser
36
  # from innovation_pathfinder_ai.utils import create_wikipedia_urls_from_text
37
 
38
+ config = ConfigParser()
39
+ config.read('config.ini')
40
+
41
  @tool
42
  def memory_search(query:str) -> str:
43
  """Search the memory vector store for existing knowledge and relevent pervious researches. \
 
47
  # path=persist_directory,
48
  )
49
 
50
+ collection_name = config.get('main', 'CONVERSATION_COLLECTION_NAME')
51
  #store using envar
52
 
53
  embedding_function = SentenceTransformerEmbeddings(
innovation_pathfinder_ai/vector_store/chroma_vector_store.py CHANGED
@@ -24,14 +24,15 @@ from langchain_community.embeddings.sentence_transformer import (
24
  from innovation_pathfinder_ai.utils.utils import (
25
  generate_uuid
26
  )
27
-
28
  import dotenv
29
  import os
30
 
31
  dotenv.load_dotenv()
 
 
32
 
33
-
34
- VECTOR_DATABASE_LOCATION = os.getenv("VECTOR_DATABASE_LOCATION")
35
 
36
 
37
 
 
24
  from innovation_pathfinder_ai.utils.utils import (
25
  generate_uuid
26
  )
27
+ from configparser import ConfigParser
28
  import dotenv
29
  import os
30
 
31
  dotenv.load_dotenv()
32
+ config = ConfigParser()
33
+ config.read('config.ini')
34
 
35
+ VECTOR_DATABASE_LOCATION = config.get('main', 'VECTOR_DATABASE_LOCATION')
 
36
 
37
 
38