folders cleanup
Browse files- ragntex.py +19 -8
- src/__init__.py +15 -0
- src/compilation/__init__.py +3 -0
- src/{latex_compilation.py β compilation/latex_compilation.py} +0 -0
- src/database/__init__.py +3 -0
- src/{database.py β database/database.py} +1 -1
- src/interface/__init__.py +0 -0
- src/processing/__init__.py +5 -0
- src/{document_processing.py β processing/document_processing.py} +1 -1
- src/{images_processing.py β processing/images_processing.py} +0 -0
- src/{prompt.py β processing/prompt.py} +0 -0
- src/services/__init__.py +3 -0
- src/{google_client.py β services/google_client.py} +0 -0
ragntex.py
CHANGED
|
@@ -3,12 +3,23 @@ import re
|
|
| 3 |
from datetime import datetime
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
|
| 6 |
-
from src.database import db, embed_fn
|
| 7 |
-
from src.document_processing import process_documents
|
| 8 |
-
from src.images_processing import save_pdf_images, save_pdf_figures
|
| 9 |
-
from src.latex_compilation import CompilePresentation
|
| 10 |
-
from src.prompt import prompt
|
| 11 |
-
from src.google_client import client
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
load_dotenv()
|
|
@@ -61,7 +72,7 @@ for passage, metas in zip(documents, metadatas):
|
|
| 61 |
prompt += f"IMAGES: {images_passage}\n"
|
| 62 |
|
| 63 |
# Create a new subfolder
|
| 64 |
-
print("Creating new subfolder...")
|
| 65 |
base_path = MAIN_DIR + "output/"
|
| 66 |
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
| 67 |
work_dir = os.path.join(base_path, timestamp)
|
|
@@ -71,7 +82,7 @@ print(f"π Created folder: {work_dir}")
|
|
| 71 |
# Generate the presentation code
|
| 72 |
model_name = "gemini-2.0-flash"
|
| 73 |
# model_name = "gemini-2.5-flash-preview-04-17"
|
| 74 |
-
print("Generating response...")
|
| 75 |
answer = client.models.generate_content(model=model_name, contents=prompt)
|
| 76 |
print(f"π² Generated the response using: {model_name}")
|
| 77 |
|
|
|
|
| 3 |
from datetime import datetime
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
|
| 6 |
+
# from src.database import db, embed_fn
|
| 7 |
+
# from src.document_processing import process_documents
|
| 8 |
+
# from src.images_processing import save_pdf_images, save_pdf_figures
|
| 9 |
+
# from src.latex_compilation import CompilePresentation
|
| 10 |
+
# from src.prompt import prompt
|
| 11 |
+
# from src.google_client import client
|
| 12 |
+
|
| 13 |
+
from src import (
|
| 14 |
+
db,
|
| 15 |
+
embed_fn,
|
| 16 |
+
process_documents,
|
| 17 |
+
save_pdf_images,
|
| 18 |
+
save_pdf_figures,
|
| 19 |
+
prompt,
|
| 20 |
+
CompilePresentation,
|
| 21 |
+
client,
|
| 22 |
+
)
|
| 23 |
|
| 24 |
|
| 25 |
load_dotenv()
|
|
|
|
| 72 |
prompt += f"IMAGES: {images_passage}\n"
|
| 73 |
|
| 74 |
# Create a new subfolder
|
| 75 |
+
print("πΎCreating new subfolder...")
|
| 76 |
base_path = MAIN_DIR + "output/"
|
| 77 |
timestamp = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
| 78 |
work_dir = os.path.join(base_path, timestamp)
|
|
|
|
| 82 |
# Generate the presentation code
|
| 83 |
model_name = "gemini-2.0-flash"
|
| 84 |
# model_name = "gemini-2.5-flash-preview-04-17"
|
| 85 |
+
print("βοΈGenerating response...")
|
| 86 |
answer = client.models.generate_content(model=model_name, contents=prompt)
|
| 87 |
print(f"π² Generated the response using: {model_name}")
|
| 88 |
|
src/__init__.py
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .database import db, embed_fn
|
| 2 |
+
from .processing import process_documents, save_pdf_images, save_pdf_figures, prompt
|
| 3 |
+
from .compilation import CompilePresentation
|
| 4 |
+
from .services import client
|
| 5 |
+
|
| 6 |
+
__all__ = [
|
| 7 |
+
"db",
|
| 8 |
+
"embed_fn",
|
| 9 |
+
"process_documents",
|
| 10 |
+
"save_pdf_images",
|
| 11 |
+
"save_pdf_figures",
|
| 12 |
+
"prompt",
|
| 13 |
+
"CompilePresentation",
|
| 14 |
+
"client",
|
| 15 |
+
]
|
src/compilation/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .latex_compilation import CompilePresentation
|
| 2 |
+
|
| 3 |
+
__all__ = ["CompilePresentation"]
|
src/{latex_compilation.py β compilation/latex_compilation.py}
RENAMED
|
File without changes
|
src/database/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .database import db, embed_fn
|
| 2 |
+
|
| 3 |
+
__all__ = ["db", "embed_fn"]
|
src/{database.py β database/database.py}
RENAMED
|
@@ -4,7 +4,7 @@ from google import genai
|
|
| 4 |
from chromadb import Documents, EmbeddingFunction, Embeddings
|
| 5 |
import chromadb
|
| 6 |
|
| 7 |
-
from
|
| 8 |
|
| 9 |
# Define a helper to retry when per-minute quota is reached.
|
| 10 |
is_retriable = lambda e: (isinstance(e, genai.errors.APIError) and e.code in {429, 503})
|
|
|
|
| 4 |
from chromadb import Documents, EmbeddingFunction, Embeddings
|
| 5 |
import chromadb
|
| 6 |
|
| 7 |
+
from ..services import client
|
| 8 |
|
| 9 |
# Define a helper to retry when per-minute quota is reached.
|
| 10 |
is_retriable = lambda e: (isinstance(e, genai.errors.APIError) and e.code in {429, 503})
|
src/interface/__init__.py
ADDED
|
File without changes
|
src/processing/__init__.py
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .document_processing import process_documents
|
| 2 |
+
from .images_processing import save_pdf_images, save_pdf_figures
|
| 3 |
+
from .prompt import prompt
|
| 4 |
+
|
| 5 |
+
__all__ = ["process_documents", "save_pdf_images", "save_pdf_figures", "prompt"]
|
src/{document_processing.py β processing/document_processing.py}
RENAMED
|
@@ -3,7 +3,7 @@ import fitz
|
|
| 3 |
import os
|
| 4 |
import hashlib
|
| 5 |
|
| 6 |
-
from
|
| 7 |
|
| 8 |
|
| 9 |
def extract_pdf_content(pdf_path: str):
|
|
|
|
| 3 |
import os
|
| 4 |
import hashlib
|
| 5 |
|
| 6 |
+
from .images_processing import extract_images, extract_vector
|
| 7 |
|
| 8 |
|
| 9 |
def extract_pdf_content(pdf_path: str):
|
src/{images_processing.py β processing/images_processing.py}
RENAMED
|
File without changes
|
src/{prompt.py β processing/prompt.py}
RENAMED
|
File without changes
|
src/services/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .google_client import client
|
| 2 |
+
|
| 3 |
+
__all__ = ["client"]
|
src/{google_client.py β services/google_client.py}
RENAMED
|
File without changes
|