bupa1018 commited on
Commit
761a499
·
1 Parent(s): ae6cea7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -8,7 +8,7 @@ from dotenv import load_dotenv
8
 
9
  from chunking import chunk_pythoncode_and_add_metadata
10
  from chunking import chunk_text_and_add_metadata
11
- from vectorstore import get_chroma_vectorstore
12
  from download_repo import download_gitlab_repo_to_hfspace
13
  from process_repo import extract_repo_files
14
  from ragchain import RAGChain
@@ -58,8 +58,8 @@ def rag_workflow(query):
58
  """
59
  RAGChain class to perform the complete RAG workflow.
60
  """
61
- # Assume 'llm' and 'vector_store' are already initialized instances
62
- rag_chain = RAGChain(llm, vector_store)
63
 
64
 
65
  """
@@ -102,7 +102,7 @@ def rag_workflow(query):
102
 
103
 
104
  def initialize():
105
- global vector_store, chunks, llm
106
 
107
 
108
  download_gitlab_repo_to_hfspace(GITLAB_API_URL, GITLAB_PROJECT_ID, GITLAB_PROJECT_VERSION)
@@ -120,7 +120,7 @@ def initialize():
120
  print(f"Total number of code_chunks: {len(code_chunks)}")
121
  print(f"Total number of doc_chunks: {len(doc_chunks)}")
122
 
123
- vector_store = embed_documents_into_vectorstore(doc_chunks + code_chunks, EMBEDDING_MODEL_NAME, VECTORSTORE_DIRECTORY)
124
  llm = get_groq_llm(LLM_MODEL_NAME, LLM_MODEL_TEMPERATURE, GROQ_API_KEY)
125
 
126
  from langchain_community.document_loaders import TextLoader
 
8
 
9
  from chunking import chunk_pythoncode_and_add_metadata
10
  from chunking import chunk_text_and_add_metadata
11
+ from vectorstore import setup_vectorstore
12
  from download_repo import download_gitlab_repo_to_hfspace
13
  from process_repo import extract_repo_files
14
  from ragchain import RAGChain
 
58
  """
59
  RAGChain class to perform the complete RAG workflow.
60
  """
61
+ # Assume 'llm' and 'vectorstore' are already initialized instances
62
+ rag_chain = RAGChain(llm, vectorstore)
63
 
64
 
65
  """
 
102
 
103
 
104
  def initialize():
105
+ global vectorstore, chunks, llm
106
 
107
 
108
  download_gitlab_repo_to_hfspace(GITLAB_API_URL, GITLAB_PROJECT_ID, GITLAB_PROJECT_VERSION)
 
120
  print(f"Total number of code_chunks: {len(code_chunks)}")
121
  print(f"Total number of doc_chunks: {len(doc_chunks)}")
122
 
123
+ vectorstore = setup_vectorstore(doc_chunks + code_chunks, EMBEDDING_MODEL_NAME, VECTORSTORE_DIRECTORY)
124
  llm = get_groq_llm(LLM_MODEL_NAME, LLM_MODEL_TEMPERATURE, GROQ_API_KEY)
125
 
126
  from langchain_community.document_loaders import TextLoader