diff --git a/data_ingestion/__pycache__/data_ingest.cpython-311.pyc b/data_ingestion/__pycache__/data_ingest.cpython-311.pyc new file mode 100644 index 00000000..de57984a Binary files /dev/null and b/data_ingestion/__pycache__/data_ingest.cpython-311.pyc differ diff --git a/data_ingestion/data_ingest.py b/data_ingestion/data_ingest.py index 3515e625..27c8718b 100644 --- a/data_ingestion/data_ingest.py +++ b/data_ingestion/data_ingest.py @@ -1,8 +1,6 @@ -from utils import create_vector_store, save_embedded_data, load_documents_from_directory, load_embedding_model import sys, os - -# Add the root directory to sys.path sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) +from data_ingestion.utils import create_vector_store, save_embedded_data, load_documents_from_directory, load_embedding_model from loggings.logging_config import logger diff --git a/loggings/app.log b/loggings/app.log index 991e935a..83cf54b1 100644 --- a/loggings/app.log +++ b/loggings/app.log @@ -38,3 +38,15 @@ 2024-08-07 18:02:08,752 - INFO - Vector store created 2024-08-07 18:02:08,752 - INFO - Saving the vector store 2024-08-07 18:02:08,752 - INFO - Vector store saved +2024-08-07 18:32:03,492 - INFO - Loading the embeddings +2024-08-07 18:32:03,492 - INFO - Load pretrained SentenceTransformer: BAAI/bge-small-en +2024-08-07 18:32:07,243 - INFO - Embeddings loaded +2024-08-07 18:32:07,243 - INFO - Loading data from ./data +2024-08-07 18:42:08,987 - INFO - Loading the embeddings +2024-08-07 18:42:08,987 - INFO - Load pretrained SentenceTransformer: BAAI/bge-small-en +2024-08-07 18:42:58,926 - INFO - Loading the embeddings +2024-08-07 18:42:58,926 - INFO - Load pretrained SentenceTransformer: BAAI/bge-small-en +2024-08-07 18:43:25,721 - INFO - Embeddings loaded +2024-08-07 18:46:38,939 - INFO - Loading the embeddings +2024-08-07 18:46:38,939 - INFO - Load pretrained SentenceTransformer: BAAI/bge-small-en +2024-08-07 18:47:03,089 - INFO - Embeddings loaded diff --git a/main.py b/main.py index 81b9bf71..1df6dd6d 100644 --- a/main.py +++ b/main.py @@ -1,4 +1,6 @@ -# main.py +import sys, os +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) + from fastapi import FastAPI, HTTPException from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel @@ -33,7 +35,7 @@ app.add_middleware( class SearchRequest(BaseModel): query: str -@app.post("/load_documents") +@app.get("/load_documents") def load_documents(directory: str): global vector_store @@ -42,7 +44,7 @@ def load_documents(directory: str): return {"status": "Documents loaded successfully"} -@app.post("/search") +@app.get("/search") def search(request: SearchRequest): global vector_store