-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0cbdab4
commit b83b56e
Showing
1 changed file
with
40 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,46 @@ | ||
from codeexp.pipeline.rag_pipeline import CodeAnalysisPipeline | ||
import logging | ||
from codeexp.pipeline.rag_pipeline import CodeAnalysisPipeline | ||
|
||
# Configure logging | ||
logging.basicConfig(level=logging.INFO) | ||
|
||
def main(): | ||
pipeline = CodeAnalysisPipeline() | ||
|
||
pipeline = CodeAnalysisPipeline() | ||
try: | ||
phase_name = "Load and preprocess documents" | ||
logging.info(f">>>>>> phase {phase_name} started <<<<<<") | ||
pipeline.load_and_preprocess_documents() | ||
except Exception as e: | ||
logging.error(f"Error in phase {phase_name}: {e}") | ||
return | ||
|
||
PHASE_NAME= "Load and preprocess documents" | ||
logging.info(f">>>>>> phase {PHASE_NAME} started <<<<<<") | ||
pipeline.load_and_preprocess_documents() | ||
try: | ||
phase_name = "Create embeddings and vector store" | ||
logging.info(f">>>>>> phase {phase_name} started <<<<<<") | ||
pipeline.create_embeddings_and_vector_store() | ||
except Exception as e: | ||
logging.error(f"Error in phase {phase_name}: {e}") | ||
return | ||
|
||
PHASE_NAME= "Create embeddings and vector store" | ||
logging.info(f">>>>>> phase {PHASE_NAME} started <<<<<<") | ||
pipeline.create_embeddings_and_vector_store() | ||
try: | ||
phase_name = "Initialize QA chain and explanation chain" | ||
logging.info(f">>>>>> phase {phase_name} started <<<<<<") | ||
pipeline.initialize_qa_chain() | ||
pipeline.initialize_agent_and_explanation_chain() | ||
except Exception as e: | ||
logging.error(f"Error in phase {phase_name}: {e}") | ||
return | ||
|
||
PHASE_NAME = "Initialize QA chain and explanation chain" | ||
logging.info(f">>>>>> phase {PHASE_NAME} started <<<<<<") | ||
pipeline.initialize_qa_chain() | ||
pipeline.initialize_agent_and_explanation_chain() | ||
try: | ||
phase_name = "Process user query" | ||
logging.info(f">>>>>> phase {phase_name} started <<<<<<") | ||
user_query = "Explain the purpose of the provided code" # Consider getting this from a config file or environment variable | ||
if user_query: | ||
pipeline.process_query(user_query) | ||
except Exception as e: | ||
logging.error(f"Error in phase {phase_name}: {e}") | ||
return | ||
|
||
PHASE_NAME = "Process user query" | ||
logging.info(f">>>>>> phase {PHASE_NAME} started <<<<<<") | ||
user_query = "Explain the purpose of the provided code" | ||
if user_query: | ||
pipeline.process_query(user_query) | ||
if __name__ == "__main__": | ||
main() |