Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
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 '
|
62 |
-
rag_chain = RAGChain(llm,
|
63 |
|
64 |
|
65 |
"""
|
@@ -102,7 +102,7 @@ def rag_workflow(query):
|
|
102 |
|
103 |
|
104 |
def initialize():
|
105 |
-
global
|
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 |
-
|
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
|