eranmi commited on
Commit
07f8852
·
1 Parent(s): 338df3b

sphinx documentation

Browse files
.github/workflows/ci.yml CHANGED
@@ -2,9 +2,9 @@ name: CI
2
 
3
  on:
4
  push:
5
- branches: [main]
6
  pull_request:
7
- branches: [main]
8
 
9
  jobs:
10
  lint:
@@ -41,3 +41,15 @@ jobs:
41
  score=$(tail -n 2 pylint-output.txt | grep -oP "rated at \K[0-9.]+")
42
  echo "Pylint score: $score"
43
  awk -v s="$score" 'BEGIN {exit (s >= 9.5) ? 0 : 1}'
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  on:
4
  push:
5
+ branches: [main, dev]
6
  pull_request:
7
+ branches: [main, dev]
8
 
9
  jobs:
10
  lint:
 
41
  score=$(tail -n 2 pylint-output.txt | grep -oP "rated at \K[0-9.]+")
42
  echo "Pylint score: $score"
43
  awk -v s="$score" 'BEGIN {exit (s >= 9.5) ? 0 : 1}'
44
+
45
+ - name: Build docs
46
+ working-directory: docs
47
+ run: poetry run sphinx-build -b html . _build/html
48
+
49
+ - name: Deploy to GitHub Pages
50
+ if: github.actor != 'nektos/act'
51
+ uses: peaceiris/actions-gh-pages@v4
52
+ with:
53
+ github_token: ${{ secrets.GITHUB_TOKEN }}
54
+ publish_dir: ./docs/_build/html
55
+ publish_branch: gh-pages
.gitignore CHANGED
@@ -5,6 +5,16 @@ run_docker.sh
5
  uploaded_docs/*
6
  output/*
7
 
 
 
 
 
 
 
 
 
 
 
8
  # Byte-compiled / optimized / DLL files
9
  __pycache__/
10
  *.py[cod]
 
5
  uploaded_docs/*
6
  output/*
7
 
8
+ # Sphinx build directory
9
+ docs/_build/
10
+
11
+ # Auto-generated static/template folders
12
+ docs/_static/
13
+ docs/_templates/
14
+
15
+ # Catch-all for any other underscored dirs in docs/
16
+ docs/_*/
17
+
18
  # Byte-compiled / optimized / DLL files
19
  __pycache__/
20
  *.py[cod]
docs/Makefile ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = .
9
+ BUILDDIR = _build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
docs/conf.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+
6
+ # -- Project information -----------------------------------------------------
7
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8
+ import os
9
+ import sys
10
+ from pathlib import Path
11
+
12
+ project = "RAGnTeX"
13
+ copyright = "2025, Anna Ershova, Kajetan Niewczas"
14
+ author = "Anna Ershova, Kajetan Niewczas"
15
+ release = "0.1.0"
16
+
17
+ # ── allow “import ragntex …” ────────────────────────────────────────────────
18
+ sys.path.insert(0, os.path.abspath("../src"))
19
+ # -- General configuration ---------------------------------------------------
20
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
21
+
22
+ extensions = [
23
+ "sphinx.ext.autodoc",
24
+ "sphinx.ext.napoleon",
25
+ "sphinx_autodoc_typehints",
26
+ ]
27
+
28
+
29
+ templates_path = ["_templates"]
30
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
31
+
32
+ # -- Options for Napoleon ----------------------------------------------------
33
+
34
+ napoleon_google_docstring = True
35
+ napoleon_numpy_docstring = False
36
+
37
+ # -- Options for HTML output -------------------------------------------------
38
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
39
+
40
+ html_theme = "furo"
41
+ html_static_path = ["_static"]
docs/index.rst ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .. RAGnTeX documentation master file, created by
2
+ sphinx-quickstart on Fri Jun 13 12:43:29 2025.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+ RAGnTeX documentation
6
+ =====================
7
+
8
+ 📚 From Text to Visuals: Auto-Generating LaTeX Beamer Presentations with GenAI
9
+ ------------------------------------------------------------------------------
10
+
11
+ In this project, we explore how generative AI can automate the creation of professional-looking presentation slides—directly from extensive collections of PDF documents.
12
+
13
+ ---
14
+
15
+ 🧠 Use Case
16
+ ===========
17
+
18
+ Creating slide decks from dense documents (like whitepapers or scientific articles) is a time-consuming and cognitively heavy task. Our goal is to streamline this process using generative AI.
19
+
20
+ We built an AI assistant that transforms document collections into LaTeX Beamer presentations—complete with structure, content, and visuals—based on a user-defined topic.
21
+
22
+ ---
23
+
24
+ 🔍 How It Works
25
+ ==============
26
+
27
+ 💿 Database Creation
28
+ -------------------
29
+
30
+ We start by creating a vector database from a collection of PDF documents (e.g., arXiv papers). Each document is processed to extract text chunks, and for each chunk, we store:
31
+
32
+ - **Embeddings** of the text from the file
33
+ - **Associated metadata** (like images, their captions, how many images there are)
34
+
35
+ 🗣️ User Prompt
36
+ --------------
37
+
38
+ A user enters a natural language query like:
39
+
40
+ ::
41
+
42
+ "I need a presentation about AI agents."
43
+
44
+ 📄 Document Retrieval
45
+ --------------------
46
+
47
+ We use **Chroma** as our vector database to retrieve the most relevant PDF documents based on the query.
48
+
49
+ 🧠 Content Understanding
50
+ ------------------------
51
+
52
+ Using **Gemini 2.0 Flash** (``google-genai==1.7.0``), the assistant analyzes the retrieved content and extracts the most relevant ideas and insights.
53
+
54
+ 🎞️ Slide Generation (LaTeX Beamer)
55
+ ----------------------------------
56
+
57
+ The model outputs fully formatted compilable LaTeX code following a clear and consistent structure:
58
+
59
+ - **Introduction**: Topic overview and motivation
60
+ - **Main Content**: 2–4 slides, each presenting a core idea
61
+ - **Summary**: Key takeaways
62
+
63
+ It also incorporates relevant images extracted from the documents, organizing them into LaTeX Beamer-friendly layouts (e.g., *Core Idea 2* and *Core Idea 3* slide formats).
64
+
65
+ Installation
66
+ ============
67
+
68
+ Install poetry to manage dependencies and virtual environments:
69
+
70
+ .. code-block:: bash
71
+
72
+ pip install poetry
73
+
74
+ Then, install the project dependencies:
75
+
76
+ .. code-block:: bash
77
+
78
+ poetry install
79
+
80
+ Running
81
+ =======
82
+
83
+ Run project with:
84
+
85
+ .. code-block:: bash
86
+
87
+ poetry run python ragntex.py
88
+
89
+ Or via Docker:
90
+
91
+ .. code-block:: bash
92
+
93
+ docker run \
94
+ --env-file .env \
95
+ -e IN_DOCKER=true \
96
+ -p 7860:7860 \
97
+ -v /path/to/your/output:/app/output \
98
+ ragntex
99
+
100
+ .. toctree::
101
+ :maxdepth: 2
102
+ :caption: Contents:
103
+
104
+ src
docs/make.bat ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @ECHO OFF
2
+
3
+ pushd %~dp0
4
+
5
+ REM Command file for Sphinx documentation
6
+
7
+ if "%SPHINXBUILD%" == "" (
8
+ set SPHINXBUILD=sphinx-build
9
+ )
10
+ set SOURCEDIR=.
11
+ set BUILDDIR=_build
12
+
13
+ %SPHINXBUILD% >NUL 2>NUL
14
+ if errorlevel 9009 (
15
+ echo.
16
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17
+ echo.installed, then set the SPHINXBUILD environment variable to point
18
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
19
+ echo.may add the Sphinx directory to PATH.
20
+ echo.
21
+ echo.If you don't have Sphinx installed, grab it from
22
+ echo.https://www.sphinx-doc.org/
23
+ exit /b 1
24
+ )
25
+
26
+ if "%1" == "" goto help
27
+
28
+ %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29
+ goto end
30
+
31
+ :help
32
+ %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33
+
34
+ :end
35
+ popd
docs/modules.rst ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ src
2
+ ===
3
+
4
+ .. toctree::
5
+ :maxdepth: 4
6
+
7
+ src
docs/source/modules.rst ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ RAGnTeX
2
+ =======
3
+
4
+ .. toctree::
5
+ :maxdepth: 4
6
+
7
+ ragntex
8
+ src
docs/source/ragntex.rst ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ ragntex module
2
+ ==============
3
+
4
+ .. automodule:: ragntex
5
+ :members:
6
+ :undoc-members:
7
+ :show-inheritance:
docs/source/src.compilation.rst ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.compilation package
2
+ =======================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.compilation.json\_to\_tex module
8
+ ------------------------------------
9
+
10
+ .. automodule:: src.compilation.json_to_tex
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.compilation.latex\_compilation module
16
+ -----------------------------------------
17
+
18
+ .. automodule:: src.compilation.latex_compilation
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ Module contents
24
+ ---------------
25
+
26
+ .. automodule:: src.compilation
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
docs/source/src.database.rst ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.database package
2
+ ====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.database.database module
8
+ ----------------------------
9
+
10
+ .. automodule:: src.database.database
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.database.db\_manipulation module
16
+ ------------------------------------
17
+
18
+ .. automodule:: src.database.db_manipulation
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ Module contents
24
+ ---------------
25
+
26
+ .. automodule:: src.database
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
docs/source/src.interface.rst ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.interface package
2
+ =====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.interface.download\_files module
8
+ ------------------------------------
9
+
10
+ .. automodule:: src.interface.download_files
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.interface.gradio\_interface module
16
+ --------------------------------------
17
+
18
+ .. automodule:: src.interface.gradio_interface
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ src.interface.upload\_files module
24
+ ----------------------------------
25
+
26
+ .. automodule:: src.interface.upload_files
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: src.interface
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
docs/source/src.processing.rst ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.processing package
2
+ ======================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.processing.document\_processing module
8
+ ------------------------------------------
9
+
10
+ .. automodule:: src.processing.document_processing
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.processing.images\_processing module
16
+ ----------------------------------------
17
+
18
+ .. automodule:: src.processing.images_processing
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ src.processing.output\_folder module
24
+ ------------------------------------
25
+
26
+ .. automodule:: src.processing.output_folder
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: src.processing
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
docs/source/src.rst ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src package
2
+ ===========
3
+
4
+ Subpackages
5
+ -----------
6
+
7
+ .. toctree::
8
+ :maxdepth: 4
9
+
10
+ src.compilation
11
+ src.database
12
+ src.interface
13
+ src.processing
14
+ src.services
15
+ src.telemetry
16
+
17
+ Submodules
18
+ ----------
19
+
20
+ src.generator module
21
+ --------------------
22
+
23
+ .. automodule:: src.generator
24
+ :members:
25
+ :undoc-members:
26
+ :show-inheritance:
27
+
28
+ Module contents
29
+ ---------------
30
+
31
+ .. automodule:: src
32
+ :members:
33
+ :undoc-members:
34
+ :show-inheritance:
docs/source/src.services.rst ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.services package
2
+ ====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.services.google\_client module
8
+ ----------------------------------
9
+
10
+ .. automodule:: src.services.google_client
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.services.output\_schema module
16
+ ----------------------------------
17
+
18
+ .. automodule:: src.services.output_schema
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ src.services.prompt module
24
+ --------------------------
25
+
26
+ .. automodule:: src.services.prompt
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: src.services
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
docs/source/src.telemetry.rst ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.telemetry package
2
+ =====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.telemetry.logging\_utils module
8
+ -----------------------------------
9
+
10
+ .. automodule:: src.telemetry.logging_utils
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.telemetry.telemetry module
16
+ ------------------------------
17
+
18
+ .. automodule:: src.telemetry.telemetry
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ Module contents
24
+ ---------------
25
+
26
+ .. automodule:: src.telemetry
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
docs/src.compilation.rst ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.compilation package
2
+ =======================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.compilation.json\_to\_tex module
8
+ ------------------------------------
9
+
10
+ .. automodule:: src.compilation.json_to_tex
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.compilation.latex\_compilation module
16
+ -----------------------------------------
17
+
18
+ .. automodule:: src.compilation.latex_compilation
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ Module contents
24
+ ---------------
25
+
26
+ .. automodule:: src.compilation
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
docs/src.database.rst ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.database package
2
+ ====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.database.database module
8
+ ----------------------------
9
+
10
+ .. automodule:: src.database.database
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.database.db\_manipulation module
16
+ ------------------------------------
17
+
18
+ .. automodule:: src.database.db_manipulation
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ Module contents
24
+ ---------------
25
+
26
+ .. automodule:: src.database
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
docs/src.interface.rst ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.interface package
2
+ =====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.interface.download\_files module
8
+ ------------------------------------
9
+
10
+ .. automodule:: src.interface.download_files
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.interface.gradio\_interface module
16
+ --------------------------------------
17
+
18
+ .. automodule:: src.interface.gradio_interface
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ src.interface.upload\_files module
24
+ ----------------------------------
25
+
26
+ .. automodule:: src.interface.upload_files
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: src.interface
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
docs/src.processing.rst ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.processing package
2
+ ======================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.processing.document\_processing module
8
+ ------------------------------------------
9
+
10
+ .. automodule:: src.processing.document_processing
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.processing.images\_processing module
16
+ ----------------------------------------
17
+
18
+ .. automodule:: src.processing.images_processing
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ src.processing.output\_folder module
24
+ ------------------------------------
25
+
26
+ .. automodule:: src.processing.output_folder
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: src.processing
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
docs/src.rst ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src package
2
+ ===========
3
+
4
+ Subpackages
5
+ -----------
6
+
7
+ .. toctree::
8
+ :maxdepth: 4
9
+
10
+ src.compilation
11
+ src.database
12
+ src.interface
13
+ src.processing
14
+ src.services
15
+ src.telemetry
16
+
17
+ Submodules
18
+ ----------
19
+
20
+ src.generator module
21
+ --------------------
22
+
23
+ .. automodule:: src.generator
24
+ :members:
25
+ :undoc-members:
26
+ :show-inheritance:
27
+
28
+ Module contents
29
+ ---------------
30
+
31
+ .. automodule:: src
32
+ :members:
33
+ :undoc-members:
34
+ :show-inheritance:
docs/src.services.rst ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.services package
2
+ ====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.services.google\_client module
8
+ ----------------------------------
9
+
10
+ .. automodule:: src.services.google_client
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.services.output\_schema module
16
+ ----------------------------------
17
+
18
+ .. automodule:: src.services.output_schema
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ src.services.prompt module
24
+ --------------------------
25
+
26
+ .. automodule:: src.services.prompt
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
30
+
31
+ Module contents
32
+ ---------------
33
+
34
+ .. automodule:: src.services
35
+ :members:
36
+ :undoc-members:
37
+ :show-inheritance:
docs/src.telemetry.rst ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ src.telemetry package
2
+ =====================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ src.telemetry.logging\_utils module
8
+ -----------------------------------
9
+
10
+ .. automodule:: src.telemetry.logging_utils
11
+ :members:
12
+ :undoc-members:
13
+ :show-inheritance:
14
+
15
+ src.telemetry.telemetry module
16
+ ------------------------------
17
+
18
+ .. automodule:: src.telemetry.telemetry
19
+ :members:
20
+ :undoc-members:
21
+ :show-inheritance:
22
+
23
+ Module contents
24
+ ---------------
25
+
26
+ .. automodule:: src.telemetry
27
+ :members:
28
+ :undoc-members:
29
+ :show-inheritance:
poetry.lock CHANGED
@@ -12,6 +12,18 @@ files = [
12
  {file = "aiofiles-24.1.0.tar.gz", hash = "sha256:22a075c9e5a3810f0c2e48f3008c94d68c65d763b9b03857924c99e57355166c"},
13
  ]
14
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  [[package]]
16
  name = "annotated-types"
17
  version = "0.7.0"
@@ -100,6 +112,21 @@ docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphi
100
  tests = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"]
101
  tests-mypy = ["mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\""]
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  [[package]]
104
  name = "backoff"
105
  version = "1.11.1"
@@ -183,7 +210,7 @@ version = "4.13.4"
183
  description = "Screen-scraping library"
184
  optional = false
185
  python-versions = ">=3.7.0"
186
- groups = ["main"]
187
  files = [
188
  {file = "beautifulsoup4-4.13.4-py3-none-any.whl", hash = "sha256:9bbbb14bfde9d79f38b8cd5f8c7c85f4b8f2523190ebed90e950a8dea4cb1c4b"},
189
  {file = "beautifulsoup4-4.13.4.tar.gz", hash = "sha256:dbb3c4e1ceae6aefebdaf2423247260cd062430a410e38c66f2baa50a8437195"},
@@ -291,7 +318,7 @@ version = "2025.1.31"
291
  description = "Python package for providing Mozilla's CA Bundle."
292
  optional = false
293
  python-versions = ">=3.6"
294
- groups = ["main"]
295
  files = [
296
  {file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"},
297
  {file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"},
@@ -303,7 +330,7 @@ version = "3.4.1"
303
  description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
304
  optional = false
305
  python-versions = ">=3.7"
306
- groups = ["main"]
307
  files = [
308
  {file = "charset_normalizer-3.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de"},
309
  {file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176"},
@@ -509,12 +536,12 @@ version = "0.4.6"
509
  description = "Cross-platform colored terminal text."
510
  optional = false
511
  python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
512
- groups = ["main", "dev"]
513
  files = [
514
  {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
515
  {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
516
  ]
517
- markers = {main = "os_name == \"nt\" or platform_system == \"Windows\" or sys_platform == \"win32\"", dev = "platform_system == \"Windows\" or sys_platform == \"win32\""}
518
 
519
  [[package]]
520
  name = "coloredlogs"
@@ -580,6 +607,18 @@ files = [
580
  {file = "distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed"},
581
  ]
582
 
 
 
 
 
 
 
 
 
 
 
 
 
583
  [[package]]
584
  name = "dotenv"
585
  version = "0.9.9"
@@ -725,6 +764,24 @@ test-downstream = ["aiobotocore (>=2.5.4,<3.0.0)", "dask[dataframe,test]", "moto
725
  test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas", "panel", "paramiko", "pyarrow", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "smbprotocol", "tqdm", "urllib3", "zarr", "zstandard"]
726
  tqdm = ["tqdm"]
727
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
  [[package]]
729
  name = "google"
730
  version = "3.0.0"
@@ -1197,7 +1254,7 @@ version = "3.10"
1197
  description = "Internationalized Domain Names in Applications (IDNA)"
1198
  optional = false
1199
  python-versions = ">=3.6"
1200
- groups = ["main"]
1201
  files = [
1202
  {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"},
1203
  {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
@@ -1206,6 +1263,18 @@ files = [
1206
  [package.extras]
1207
  all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"]
1208
 
 
 
 
 
 
 
 
 
 
 
 
 
1209
  [[package]]
1210
  name = "importlib-metadata"
1211
  version = "8.6.1"
@@ -1284,7 +1353,7 @@ version = "3.1.6"
1284
  description = "A very fast and expressive template engine."
1285
  optional = false
1286
  python-versions = ">=3.7"
1287
- groups = ["main"]
1288
  files = [
1289
  {file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"},
1290
  {file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"},
@@ -1419,7 +1488,7 @@ version = "3.0.2"
1419
  description = "Safely add untrusted strings to HTML/XML markup."
1420
  optional = false
1421
  python-versions = ">=3.9"
1422
- groups = ["main"]
1423
  files = [
1424
  {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"},
1425
  {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"},
@@ -2092,7 +2161,7 @@ version = "24.2"
2092
  description = "Core utilities for Python packages"
2093
  optional = false
2094
  python-versions = ">=3.8"
2095
- groups = ["main", "dev"]
2096
  files = [
2097
  {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},
2098
  {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},
@@ -2570,7 +2639,7 @@ version = "2.19.1"
2570
  description = "Pygments is a syntax highlighting package written in Python."
2571
  optional = false
2572
  python-versions = ">=3.8"
2573
- groups = ["main", "dev"]
2574
  files = [
2575
  {file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"},
2576
  {file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"},
@@ -2841,7 +2910,7 @@ version = "2.32.3"
2841
  description = "Python HTTP for Humans."
2842
  optional = false
2843
  python-versions = ">=3.8"
2844
- groups = ["main"]
2845
  files = [
2846
  {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"},
2847
  {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"},
@@ -3153,18 +3222,204 @@ files = [
3153
  {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},
3154
  ]
3155
 
 
 
 
 
 
 
 
 
 
 
 
 
3156
  [[package]]
3157
  name = "soupsieve"
3158
  version = "2.7"
3159
  description = "A modern CSS selector implementation for Beautiful Soup."
3160
  optional = false
3161
  python-versions = ">=3.8"
3162
- groups = ["main"]
3163
  files = [
3164
  {file = "soupsieve-2.7-py3-none-any.whl", hash = "sha256:6e60cc5c1ffaf1cebcc12e8188320b72071e922c2e897f737cadce79ad5d30c4"},
3165
  {file = "soupsieve-2.7.tar.gz", hash = "sha256:ad282f9b6926286d2ead4750552c8a6142bc4c783fd66b0293547c8fe6ae126a"},
3166
  ]
3167
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3168
  [[package]]
3169
  name = "starlette"
3170
  version = "0.45.3"
@@ -3256,7 +3511,7 @@ version = "2.2.1"
3256
  description = "A lil' TOML parser"
3257
  optional = false
3258
  python-versions = ">=3.8"
3259
- groups = ["main", "dev"]
3260
  files = [
3261
  {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
3262
  {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
@@ -3350,7 +3605,7 @@ version = "4.13.2"
3350
  description = "Backported and Experimental Type Hints for Python 3.8+"
3351
  optional = false
3352
  python-versions = ">=3.8"
3353
- groups = ["main", "dev"]
3354
  files = [
3355
  {file = "typing_extensions-4.13.2-py3-none-any.whl", hash = "sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c"},
3356
  {file = "typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"},
@@ -3401,7 +3656,7 @@ version = "2.4.0"
3401
  description = "HTTP library with thread-safe connection pooling, file post, and more."
3402
  optional = false
3403
  python-versions = ">=3.9"
3404
- groups = ["main"]
3405
  files = [
3406
  {file = "urllib3-2.4.0-py3-none-any.whl", hash = "sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813"},
3407
  {file = "urllib3-2.4.0.tar.gz", hash = "sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466"},
@@ -3785,4 +4040,4 @@ type = ["pytest-mypy"]
3785
  [metadata]
3786
  lock-version = "2.1"
3787
  python-versions = ">=3.10,<3.11"
3788
- content-hash = "25f896fce1a245a556a773c2ef76e4c85e40edc6a811281d0819cd9bf23450cb"
 
12
  {file = "aiofiles-24.1.0.tar.gz", hash = "sha256:22a075c9e5a3810f0c2e48f3008c94d68c65d763b9b03857924c99e57355166c"},
13
  ]
14
 
15
+ [[package]]
16
+ name = "alabaster"
17
+ version = "1.0.0"
18
+ description = "A light, configurable Sphinx theme"
19
+ optional = false
20
+ python-versions = ">=3.10"
21
+ groups = ["docs"]
22
+ files = [
23
+ {file = "alabaster-1.0.0-py3-none-any.whl", hash = "sha256:fc6786402dc3fcb2de3cabd5fe455a2db534b371124f1f21de8731783dec828b"},
24
+ {file = "alabaster-1.0.0.tar.gz", hash = "sha256:c00dca57bca26fa62a6d7d0a9fcce65f3e026e9bfe33e9c538fd3fbb2144fd9e"},
25
+ ]
26
+
27
  [[package]]
28
  name = "annotated-types"
29
  version = "0.7.0"
 
112
  tests = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-xdist[psutil]"]
113
  tests-mypy = ["mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\"", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.10\""]
114
 
115
+ [[package]]
116
+ name = "babel"
117
+ version = "2.17.0"
118
+ description = "Internationalization utilities"
119
+ optional = false
120
+ python-versions = ">=3.8"
121
+ groups = ["docs"]
122
+ files = [
123
+ {file = "babel-2.17.0-py3-none-any.whl", hash = "sha256:4d0b53093fdfb4b21c92b5213dba5a1b23885afa8383709427046b21c366e5f2"},
124
+ {file = "babel-2.17.0.tar.gz", hash = "sha256:0c54cffb19f690cdcc52a3b50bcbf71e07a808d1c80d549f2459b9d2cf0afb9d"},
125
+ ]
126
+
127
+ [package.extras]
128
+ dev = ["backports.zoneinfo ; python_version < \"3.9\"", "freezegun (>=1.0,<2.0)", "jinja2 (>=3.0)", "pytest (>=6.0)", "pytest-cov", "pytz", "setuptools", "tzdata ; sys_platform == \"win32\""]
129
+
130
  [[package]]
131
  name = "backoff"
132
  version = "1.11.1"
 
210
  description = "Screen-scraping library"
211
  optional = false
212
  python-versions = ">=3.7.0"
213
+ groups = ["main", "docs"]
214
  files = [
215
  {file = "beautifulsoup4-4.13.4-py3-none-any.whl", hash = "sha256:9bbbb14bfde9d79f38b8cd5f8c7c85f4b8f2523190ebed90e950a8dea4cb1c4b"},
216
  {file = "beautifulsoup4-4.13.4.tar.gz", hash = "sha256:dbb3c4e1ceae6aefebdaf2423247260cd062430a410e38c66f2baa50a8437195"},
 
318
  description = "Python package for providing Mozilla's CA Bundle."
319
  optional = false
320
  python-versions = ">=3.6"
321
+ groups = ["main", "docs"]
322
  files = [
323
  {file = "certifi-2025.1.31-py3-none-any.whl", hash = "sha256:ca78db4565a652026a4db2bcdf68f2fb589ea80d0be70e03929ed730746b84fe"},
324
  {file = "certifi-2025.1.31.tar.gz", hash = "sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651"},
 
330
  description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
331
  optional = false
332
  python-versions = ">=3.7"
333
+ groups = ["main", "docs"]
334
  files = [
335
  {file = "charset_normalizer-3.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:91b36a978b5ae0ee86c394f5a54d6ef44db1de0815eb43de826d41d21e4af3de"},
336
  {file = "charset_normalizer-3.4.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7461baadb4dc00fd9e0acbe254e3d7d2112e7f92ced2adc96e54ef6501c5f176"},
 
536
  description = "Cross-platform colored terminal text."
537
  optional = false
538
  python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
539
+ groups = ["main", "dev", "docs"]
540
  files = [
541
  {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
542
  {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
543
  ]
544
+ markers = {main = "os_name == \"nt\" or platform_system == \"Windows\" or sys_platform == \"win32\"", dev = "platform_system == \"Windows\" or sys_platform == \"win32\"", docs = "sys_platform == \"win32\""}
545
 
546
  [[package]]
547
  name = "coloredlogs"
 
607
  {file = "distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed"},
608
  ]
609
 
610
+ [[package]]
611
+ name = "docutils"
612
+ version = "0.21.2"
613
+ description = "Docutils -- Python Documentation Utilities"
614
+ optional = false
615
+ python-versions = ">=3.9"
616
+ groups = ["docs"]
617
+ files = [
618
+ {file = "docutils-0.21.2-py3-none-any.whl", hash = "sha256:dafca5b9e384f0e419294eb4d2ff9fa826435bf15f15b7bd45723e8ad76811b2"},
619
+ {file = "docutils-0.21.2.tar.gz", hash = "sha256:3a6b18732edf182daa3cd12775bbb338cf5691468f91eeeb109deff6ebfa986f"},
620
+ ]
621
+
622
  [[package]]
623
  name = "dotenv"
624
  version = "0.9.9"
 
764
  test-full = ["adlfs", "aiohttp (!=4.0.0a0,!=4.0.0a1)", "cloudpickle", "dask", "distributed", "dropbox", "dropboxdrivefs", "fastparquet", "fusepy", "gcsfs", "jinja2", "kerchunk", "libarchive-c", "lz4", "notebook", "numpy", "ocifs", "pandas", "panel", "paramiko", "pyarrow", "pyarrow (>=1)", "pyftpdlib", "pygit2", "pytest", "pytest-asyncio (!=0.22.0)", "pytest-benchmark", "pytest-cov", "pytest-mock", "pytest-recording", "pytest-rerunfailures", "python-snappy", "requests", "smbprotocol", "tqdm", "urllib3", "zarr", "zstandard"]
765
  tqdm = ["tqdm"]
766
 
767
+ [[package]]
768
+ name = "furo"
769
+ version = "2024.8.6"
770
+ description = "A clean customisable Sphinx documentation theme."
771
+ optional = false
772
+ python-versions = ">=3.8"
773
+ groups = ["docs"]
774
+ files = [
775
+ {file = "furo-2024.8.6-py3-none-any.whl", hash = "sha256:6cd97c58b47813d3619e63e9081169880fbe331f0ca883c871ff1f3f11814f5c"},
776
+ {file = "furo-2024.8.6.tar.gz", hash = "sha256:b63e4cee8abfc3136d3bc03a3d45a76a850bada4d6374d24c1716b0e01394a01"},
777
+ ]
778
+
779
+ [package.dependencies]
780
+ beautifulsoup4 = "*"
781
+ pygments = ">=2.7"
782
+ sphinx = ">=6.0,<9.0"
783
+ sphinx-basic-ng = ">=1.0.0.beta2"
784
+
785
  [[package]]
786
  name = "google"
787
  version = "3.0.0"
 
1254
  description = "Internationalized Domain Names in Applications (IDNA)"
1255
  optional = false
1256
  python-versions = ">=3.6"
1257
+ groups = ["main", "docs"]
1258
  files = [
1259
  {file = "idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3"},
1260
  {file = "idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9"},
 
1263
  [package.extras]
1264
  all = ["flake8 (>=7.1.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"]
1265
 
1266
+ [[package]]
1267
+ name = "imagesize"
1268
+ version = "1.4.1"
1269
+ description = "Getting image size from png/jpeg/jpeg2000/gif file"
1270
+ optional = false
1271
+ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
1272
+ groups = ["docs"]
1273
+ files = [
1274
+ {file = "imagesize-1.4.1-py2.py3-none-any.whl", hash = "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b"},
1275
+ {file = "imagesize-1.4.1.tar.gz", hash = "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"},
1276
+ ]
1277
+
1278
  [[package]]
1279
  name = "importlib-metadata"
1280
  version = "8.6.1"
 
1353
  description = "A very fast and expressive template engine."
1354
  optional = false
1355
  python-versions = ">=3.7"
1356
+ groups = ["main", "docs"]
1357
  files = [
1358
  {file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"},
1359
  {file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"},
 
1488
  description = "Safely add untrusted strings to HTML/XML markup."
1489
  optional = false
1490
  python-versions = ">=3.9"
1491
+ groups = ["main", "docs"]
1492
  files = [
1493
  {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7e94c425039cde14257288fd61dcfb01963e658efbc0ff54f5306b06054700f8"},
1494
  {file = "MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:9e2d922824181480953426608b81967de705c3cef4d1af983af849d7bd619158"},
 
2161
  description = "Core utilities for Python packages"
2162
  optional = false
2163
  python-versions = ">=3.8"
2164
+ groups = ["main", "dev", "docs"]
2165
  files = [
2166
  {file = "packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759"},
2167
  {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"},
 
2639
  description = "Pygments is a syntax highlighting package written in Python."
2640
  optional = false
2641
  python-versions = ">=3.8"
2642
+ groups = ["main", "dev", "docs"]
2643
  files = [
2644
  {file = "pygments-2.19.1-py3-none-any.whl", hash = "sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c"},
2645
  {file = "pygments-2.19.1.tar.gz", hash = "sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f"},
 
2910
  description = "Python HTTP for Humans."
2911
  optional = false
2912
  python-versions = ">=3.8"
2913
+ groups = ["main", "docs"]
2914
  files = [
2915
  {file = "requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6"},
2916
  {file = "requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760"},
 
3222
  {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"},
3223
  ]
3224
 
3225
+ [[package]]
3226
+ name = "snowballstemmer"
3227
+ version = "3.0.1"
3228
+ description = "This package provides 32 stemmers for 30 languages generated from Snowball algorithms."
3229
+ optional = false
3230
+ python-versions = "!=3.0.*,!=3.1.*,!=3.2.*"
3231
+ groups = ["docs"]
3232
+ files = [
3233
+ {file = "snowballstemmer-3.0.1-py3-none-any.whl", hash = "sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064"},
3234
+ {file = "snowballstemmer-3.0.1.tar.gz", hash = "sha256:6d5eeeec8e9f84d4d56b847692bacf79bc2c8e90c7f80ca4444ff8b6f2e52895"},
3235
+ ]
3236
+
3237
  [[package]]
3238
  name = "soupsieve"
3239
  version = "2.7"
3240
  description = "A modern CSS selector implementation for Beautiful Soup."
3241
  optional = false
3242
  python-versions = ">=3.8"
3243
+ groups = ["main", "docs"]
3244
  files = [
3245
  {file = "soupsieve-2.7-py3-none-any.whl", hash = "sha256:6e60cc5c1ffaf1cebcc12e8188320b72071e922c2e897f737cadce79ad5d30c4"},
3246
  {file = "soupsieve-2.7.tar.gz", hash = "sha256:ad282f9b6926286d2ead4750552c8a6142bc4c783fd66b0293547c8fe6ae126a"},
3247
  ]
3248
 
3249
+ [[package]]
3250
+ name = "sphinx"
3251
+ version = "8.1.3"
3252
+ description = "Python documentation generator"
3253
+ optional = false
3254
+ python-versions = ">=3.10"
3255
+ groups = ["docs"]
3256
+ files = [
3257
+ {file = "sphinx-8.1.3-py3-none-any.whl", hash = "sha256:09719015511837b76bf6e03e42eb7595ac8c2e41eeb9c29c5b755c6b677992a2"},
3258
+ {file = "sphinx-8.1.3.tar.gz", hash = "sha256:43c1911eecb0d3e161ad78611bc905d1ad0e523e4ddc202a58a821773dc4c927"},
3259
+ ]
3260
+
3261
+ [package.dependencies]
3262
+ alabaster = ">=0.7.14"
3263
+ babel = ">=2.13"
3264
+ colorama = {version = ">=0.4.6", markers = "sys_platform == \"win32\""}
3265
+ docutils = ">=0.20,<0.22"
3266
+ imagesize = ">=1.3"
3267
+ Jinja2 = ">=3.1"
3268
+ packaging = ">=23.0"
3269
+ Pygments = ">=2.17"
3270
+ requests = ">=2.30.0"
3271
+ snowballstemmer = ">=2.2"
3272
+ sphinxcontrib-applehelp = ">=1.0.7"
3273
+ sphinxcontrib-devhelp = ">=1.0.6"
3274
+ sphinxcontrib-htmlhelp = ">=2.0.6"
3275
+ sphinxcontrib-jsmath = ">=1.0.1"
3276
+ sphinxcontrib-qthelp = ">=1.0.6"
3277
+ sphinxcontrib-serializinghtml = ">=1.1.9"
3278
+ tomli = {version = ">=2", markers = "python_version < \"3.11\""}
3279
+
3280
+ [package.extras]
3281
+ docs = ["sphinxcontrib-websupport"]
3282
+ lint = ["flake8 (>=6.0)", "mypy (==1.11.1)", "pyright (==1.1.384)", "pytest (>=6.0)", "ruff (==0.6.9)", "sphinx-lint (>=0.9)", "tomli (>=2)", "types-Pillow (==10.2.0.20240822)", "types-Pygments (==2.18.0.20240506)", "types-colorama (==0.4.15.20240311)", "types-defusedxml (==0.7.0.20240218)", "types-docutils (==0.21.0.20241005)", "types-requests (==2.32.0.20240914)", "types-urllib3 (==1.26.25.14)"]
3283
+ test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=8.0)", "setuptools (>=70.0)", "typing_extensions (>=4.9)"]
3284
+
3285
+ [[package]]
3286
+ name = "sphinx-autodoc-typehints"
3287
+ version = "1.22"
3288
+ description = "Type hints (PEP 484) support for the Sphinx autodoc extension"
3289
+ optional = false
3290
+ python-versions = ">=3.7"
3291
+ groups = ["docs"]
3292
+ files = [
3293
+ {file = "sphinx_autodoc_typehints-1.22-py3-none-any.whl", hash = "sha256:ef4a8b9d52de66065aa7d3adfabf5a436feb8a2eff07c2ddc31625d8807f2b69"},
3294
+ {file = "sphinx_autodoc_typehints-1.22.tar.gz", hash = "sha256:71fca2d5eee9b034204e4c686ab20b4d8f5eb9409396216bcae6c87c38e18ea6"},
3295
+ ]
3296
+
3297
+ [package.dependencies]
3298
+ sphinx = ">=5.3"
3299
+
3300
+ [package.extras]
3301
+ docs = ["furo (>=2022.12.7)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.21)"]
3302
+ testing = ["covdefaults (>=2.2.2)", "coverage (>=7.0.5)", "diff-cover (>=7.3)", "nptyping (>=2.4.1)", "pytest (>=7.2.1)", "pytest-cov (>=4)", "sphobjinv (>=2.3.1)", "typing-extensions (>=4.4)"]
3303
+ type-comment = ["typed-ast (>=1.5.4) ; python_version < \"3.8\""]
3304
+
3305
+ [[package]]
3306
+ name = "sphinx-basic-ng"
3307
+ version = "1.0.0b2"
3308
+ description = "A modern skeleton for Sphinx themes."
3309
+ optional = false
3310
+ python-versions = ">=3.7"
3311
+ groups = ["docs"]
3312
+ files = [
3313
+ {file = "sphinx_basic_ng-1.0.0b2-py3-none-any.whl", hash = "sha256:eb09aedbabfb650607e9b4b68c9d240b90b1e1be221d6ad71d61c52e29f7932b"},
3314
+ {file = "sphinx_basic_ng-1.0.0b2.tar.gz", hash = "sha256:9ec55a47c90c8c002b5960c57492ec3021f5193cb26cebc2dc4ea226848651c9"},
3315
+ ]
3316
+
3317
+ [package.dependencies]
3318
+ sphinx = ">=4.0"
3319
+
3320
+ [package.extras]
3321
+ docs = ["furo", "ipython", "myst-parser", "sphinx-copybutton", "sphinx-inline-tabs"]
3322
+
3323
+ [[package]]
3324
+ name = "sphinxcontrib-applehelp"
3325
+ version = "2.0.0"
3326
+ description = "sphinxcontrib-applehelp is a Sphinx extension which outputs Apple help books"
3327
+ optional = false
3328
+ python-versions = ">=3.9"
3329
+ groups = ["docs"]
3330
+ files = [
3331
+ {file = "sphinxcontrib_applehelp-2.0.0-py3-none-any.whl", hash = "sha256:4cd3f0ec4ac5dd9c17ec65e9ab272c9b867ea77425228e68ecf08d6b28ddbdb5"},
3332
+ {file = "sphinxcontrib_applehelp-2.0.0.tar.gz", hash = "sha256:2f29ef331735ce958efa4734873f084941970894c6090408b079c61b2e1c06d1"},
3333
+ ]
3334
+
3335
+ [package.extras]
3336
+ lint = ["mypy", "ruff (==0.5.5)", "types-docutils"]
3337
+ standalone = ["Sphinx (>=5)"]
3338
+ test = ["pytest"]
3339
+
3340
+ [[package]]
3341
+ name = "sphinxcontrib-devhelp"
3342
+ version = "2.0.0"
3343
+ description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp documents"
3344
+ optional = false
3345
+ python-versions = ">=3.9"
3346
+ groups = ["docs"]
3347
+ files = [
3348
+ {file = "sphinxcontrib_devhelp-2.0.0-py3-none-any.whl", hash = "sha256:aefb8b83854e4b0998877524d1029fd3e6879210422ee3780459e28a1f03a8a2"},
3349
+ {file = "sphinxcontrib_devhelp-2.0.0.tar.gz", hash = "sha256:411f5d96d445d1d73bb5d52133377b4248ec79db5c793ce7dbe59e074b4dd1ad"},
3350
+ ]
3351
+
3352
+ [package.extras]
3353
+ lint = ["mypy", "ruff (==0.5.5)", "types-docutils"]
3354
+ standalone = ["Sphinx (>=5)"]
3355
+ test = ["pytest"]
3356
+
3357
+ [[package]]
3358
+ name = "sphinxcontrib-htmlhelp"
3359
+ version = "2.1.0"
3360
+ description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files"
3361
+ optional = false
3362
+ python-versions = ">=3.9"
3363
+ groups = ["docs"]
3364
+ files = [
3365
+ {file = "sphinxcontrib_htmlhelp-2.1.0-py3-none-any.whl", hash = "sha256:166759820b47002d22914d64a075ce08f4c46818e17cfc9470a9786b759b19f8"},
3366
+ {file = "sphinxcontrib_htmlhelp-2.1.0.tar.gz", hash = "sha256:c9e2916ace8aad64cc13a0d233ee22317f2b9025b9cf3295249fa985cc7082e9"},
3367
+ ]
3368
+
3369
+ [package.extras]
3370
+ lint = ["mypy", "ruff (==0.5.5)", "types-docutils"]
3371
+ standalone = ["Sphinx (>=5)"]
3372
+ test = ["html5lib", "pytest"]
3373
+
3374
+ [[package]]
3375
+ name = "sphinxcontrib-jsmath"
3376
+ version = "1.0.1"
3377
+ description = "A sphinx extension which renders display math in HTML via JavaScript"
3378
+ optional = false
3379
+ python-versions = ">=3.5"
3380
+ groups = ["docs"]
3381
+ files = [
3382
+ {file = "sphinxcontrib-jsmath-1.0.1.tar.gz", hash = "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"},
3383
+ {file = "sphinxcontrib_jsmath-1.0.1-py2.py3-none-any.whl", hash = "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178"},
3384
+ ]
3385
+
3386
+ [package.extras]
3387
+ test = ["flake8", "mypy", "pytest"]
3388
+
3389
+ [[package]]
3390
+ name = "sphinxcontrib-qthelp"
3391
+ version = "2.0.0"
3392
+ description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp documents"
3393
+ optional = false
3394
+ python-versions = ">=3.9"
3395
+ groups = ["docs"]
3396
+ files = [
3397
+ {file = "sphinxcontrib_qthelp-2.0.0-py3-none-any.whl", hash = "sha256:b18a828cdba941ccd6ee8445dbe72ffa3ef8cbe7505d8cd1fa0d42d3f2d5f3eb"},
3398
+ {file = "sphinxcontrib_qthelp-2.0.0.tar.gz", hash = "sha256:4fe7d0ac8fc171045be623aba3e2a8f613f8682731f9153bb2e40ece16b9bbab"},
3399
+ ]
3400
+
3401
+ [package.extras]
3402
+ lint = ["mypy", "ruff (==0.5.5)", "types-docutils"]
3403
+ standalone = ["Sphinx (>=5)"]
3404
+ test = ["defusedxml (>=0.7.1)", "pytest"]
3405
+
3406
+ [[package]]
3407
+ name = "sphinxcontrib-serializinghtml"
3408
+ version = "2.0.0"
3409
+ description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)"
3410
+ optional = false
3411
+ python-versions = ">=3.9"
3412
+ groups = ["docs"]
3413
+ files = [
3414
+ {file = "sphinxcontrib_serializinghtml-2.0.0-py3-none-any.whl", hash = "sha256:6e2cb0eef194e10c27ec0023bfeb25badbbb5868244cf5bc5bdc04e4464bf331"},
3415
+ {file = "sphinxcontrib_serializinghtml-2.0.0.tar.gz", hash = "sha256:e9d912827f872c029017a53f0ef2180b327c3f7fd23c87229f7a8e8b70031d4d"},
3416
+ ]
3417
+
3418
+ [package.extras]
3419
+ lint = ["mypy", "ruff (==0.5.5)", "types-docutils"]
3420
+ standalone = ["Sphinx (>=5)"]
3421
+ test = ["pytest"]
3422
+
3423
  [[package]]
3424
  name = "starlette"
3425
  version = "0.45.3"
 
3511
  description = "A lil' TOML parser"
3512
  optional = false
3513
  python-versions = ">=3.8"
3514
+ groups = ["main", "dev", "docs"]
3515
  files = [
3516
  {file = "tomli-2.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:678e4fa69e4575eb77d103de3df8a895e1591b48e740211bd1067378c69e8249"},
3517
  {file = "tomli-2.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:023aa114dd824ade0100497eb2318602af309e5a55595f76b626d6d9f3b7b0a6"},
 
3605
  description = "Backported and Experimental Type Hints for Python 3.8+"
3606
  optional = false
3607
  python-versions = ">=3.8"
3608
+ groups = ["main", "dev", "docs"]
3609
  files = [
3610
  {file = "typing_extensions-4.13.2-py3-none-any.whl", hash = "sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c"},
3611
  {file = "typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"},
 
3656
  description = "HTTP library with thread-safe connection pooling, file post, and more."
3657
  optional = false
3658
  python-versions = ">=3.9"
3659
+ groups = ["main", "docs"]
3660
  files = [
3661
  {file = "urllib3-2.4.0-py3-none-any.whl", hash = "sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813"},
3662
  {file = "urllib3-2.4.0.tar.gz", hash = "sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466"},
 
4040
  [metadata]
4041
  lock-version = "2.1"
4042
  python-versions = ">=3.10,<3.11"
4043
+ content-hash = "a46a93339034acadba296391434f6cc21de33d3eb811c870a46ebfed8b2ebff5"
pyproject.toml CHANGED
@@ -8,6 +8,7 @@ authors = [
8
  ]
9
  license = {text = "Apache 2.0"}
10
  readme = "README.md"
 
11
  requires-python = ">=3.10,<3.11"
12
  dependencies = [
13
  "google-genai (==1.11.0)",
@@ -35,3 +36,7 @@ pytest = "^8.4.0"
35
  mypy = "^1.16.0"
36
  isort = "^6.0.1"
37
 
 
 
 
 
 
8
  ]
9
  license = {text = "Apache 2.0"}
10
  readme = "README.md"
11
+ packages = [{ include = "src" }]
12
  requires-python = ">=3.10,<3.11"
13
  dependencies = [
14
  "google-genai (==1.11.0)",
 
36
  mypy = "^1.16.0"
37
  isort = "^6.0.1"
38
 
39
+
40
+ [tool.poetry.group.docs.dependencies]
41
+ sphinx-autodoc-typehints = "1.22"
42
+ furo = "^2024.8.6"
src/processing/images_processing.py CHANGED
@@ -18,11 +18,13 @@ LOGGER = Logger.get_logger()
18
 
19
  def find_image_caption(page, image_bbox, max_distance=100) -> Optional[str]:
20
  """Method to find and extract image caption based on the image bounding box.
 
21
  Args:
22
  page (fitz.Page): The page object from which to extract the caption.
23
  image_bbox (fitz.Rect): The bounding box of the image.
24
  max_distance (int): The maximum vertical distance from the image bottom to consider
25
  a text block as a potential caption.
 
26
  Returns:
27
  str: The extracted caption text if found, otherwise None.
28
  """
@@ -73,11 +75,13 @@ def find_image_caption(page, image_bbox, max_distance=100) -> Optional[str]:
73
 
74
  def extract_images(pdf, doc, page, page_num) -> list[dict]:
75
  """Extract images from a PDF page and classify them based on their aspect ratio.
 
76
  Args:
77
  pdf (str): The PDF filename without extension.
78
  doc (fitz.Document): The PDF document object.
79
  page (fitz.Page): The PDF page object.
80
  page_num (int): The page number in the PDF document.
 
81
  Returns:
82
  list: A list of dictionaries containing image metadata, including:
83
  - "name": The name of the image file.
@@ -138,10 +142,12 @@ def extract_images(pdf, doc, page, page_num) -> list[dict]:
138
 
139
  def are_bounding_boxes_close(bbox1, bbox2, threshold=50) -> bool:
140
  """Check if two bounding boxes are close to each other based on their edges.
 
141
  Args:
142
  bbox1 (tuple): The first bounding box as a tuple (left, top, right, bottom).
143
  bbox2 (tuple): The second bounding box as a tuple (left, top, right, bottom).
144
  threshold (int): The distance threshold to consider two boxes as close.
 
145
  Returns:
146
  bool: True if the bounding boxes are close, False otherwise.
147
  """
@@ -160,8 +166,10 @@ def are_bounding_boxes_close(bbox1, bbox2, threshold=50) -> bool:
160
 
161
  def merge_bounding_boxes(bboxes) -> Optional[fitz.Rect]:
162
  """Merge a list of bounding boxes into a single bounding box.
 
163
  Args:
164
  bboxes (list): A list of bounding boxes, each represented as a tuple (left, top, right, bottom).
 
165
  Returns:
166
  fitz.Rect: A single bounding box that encompasses all input bounding boxes.
167
  """
@@ -176,9 +184,11 @@ def merge_bounding_boxes(bboxes) -> Optional[fitz.Rect]:
176
 
177
  def group_bounding_boxes(bboxes, threshold=50) -> list:
178
  """Group bounding boxes that are close to each other into larger bounding boxes.
 
179
  Args:
180
  bboxes (list): A list of bounding boxes, each represented as a tuple (left, top, right, bottom).
181
  threshold (int): The distance threshold to consider two boxes as close.
 
182
  Returns:
183
  list: A list of merged bounding boxes, where each box represents a group of close bounding boxes.
184
  """
@@ -220,10 +230,12 @@ def group_bounding_boxes(bboxes, threshold=50) -> list:
220
 
221
  def process_large_drawing(drawings, max_drawings=1000, threshold=50) -> list:
222
  """Process a large number of drawings by grouping them into bounding boxes.
 
223
  Args:
224
  drawings (list): A list of drawing dictionaries, each containing a "rect" key with bounding box coordinates.
225
  max_drawings (int): Maximum number of drawings to process at once.
226
  threshold (int): The distance threshold to consider two boxes as close.
 
227
  Returns:
228
  list: A list of merged bounding boxes, where each box represents a group of close drawings.
229
  """
@@ -247,10 +259,12 @@ def process_large_drawing(drawings, max_drawings=1000, threshold=50) -> list:
247
 
248
  def find_surrounding_text(page, group, threshold=50) -> list:
249
  """Find text blocks surrounding a given bounding box on a PDF page.
 
250
  Args:
251
  page (fitz.Page): The PDF page object.
252
  group (fitz.Rect): The bounding box of the group of drawings.
253
  threshold (int): The distance threshold to consider a text block as surrounding.
 
254
  Returns:
255
  list: A list of bounding boxes of surrounding text blocks.
256
  """
@@ -271,10 +285,12 @@ def find_surrounding_text(page, group, threshold=50) -> list:
271
 
272
  def extract_vector(pdf, page, page_num) -> list[dict]:
273
  """Extract vector graphics from a PDF page and classify them based on their aspect ratio.
 
274
  Args:
275
  pdf (str): The PDF filename without extension.
276
  page (fitz.Page): The PDF page object.
277
  page_num (int): The page number in the PDF document.
 
278
  Returns:
279
  list: A list of dictionaries containing figure metadata, including:
280
  - "name": The name of the figure file.
@@ -360,10 +376,12 @@ def extract_vector(pdf, page, page_num) -> list[dict]:
360
 
361
  def save_pdf_images(pdf_path: str, req_imgs: list, images_dir: str) -> bool:
362
  """Save images used in the presentation to the specified directory.
 
363
  Args:
364
  pdf_path (str): Path to the PDF file.
365
  req_imgs (list): List of dictionaries containing required images metadata.
366
  images_dir (str): Directory where the images will be saved.
 
367
  Returns:
368
  bool: True if images were saved successfully, False otherwise.
369
  """
@@ -407,10 +425,12 @@ def save_pdf_images(pdf_path: str, req_imgs: list, images_dir: str) -> bool:
407
 
408
  def save_pdf_figures(pdf_path: str, req_figs: list, figures_dir: str) -> bool:
409
  """Save figures used in the presentation to the specified directory.
 
410
  Args:
411
  pdf_path (str): Path to the PDF file.
412
  req_figs (list): List of dictionaries containing required figures metadata.
413
  figures_dir (str): Directory where the figures will be saved.
 
414
  Returns:
415
  bool: True if figures were saved successfully, False otherwise.
416
  """
@@ -488,6 +508,7 @@ def save_pdf_figures(pdf_path: str, req_figs: list, figures_dir: str) -> bool:
488
  def find_used_gfx(answer, work_dir: str, metadatas: list) -> None:
489
  """Finds and saves the figures used in the LLM output to the gfx directory
490
  where the presentation will be compiled.
 
491
  Args:
492
  answer (str): The LLM answer containing names of the figures.
493
  work_dir (str): The working directory where the presentation will be compiled.
 
18
 
19
  def find_image_caption(page, image_bbox, max_distance=100) -> Optional[str]:
20
  """Method to find and extract image caption based on the image bounding box.
21
+
22
  Args:
23
  page (fitz.Page): The page object from which to extract the caption.
24
  image_bbox (fitz.Rect): The bounding box of the image.
25
  max_distance (int): The maximum vertical distance from the image bottom to consider
26
  a text block as a potential caption.
27
+
28
  Returns:
29
  str: The extracted caption text if found, otherwise None.
30
  """
 
75
 
76
  def extract_images(pdf, doc, page, page_num) -> list[dict]:
77
  """Extract images from a PDF page and classify them based on their aspect ratio.
78
+
79
  Args:
80
  pdf (str): The PDF filename without extension.
81
  doc (fitz.Document): The PDF document object.
82
  page (fitz.Page): The PDF page object.
83
  page_num (int): The page number in the PDF document.
84
+
85
  Returns:
86
  list: A list of dictionaries containing image metadata, including:
87
  - "name": The name of the image file.
 
142
 
143
  def are_bounding_boxes_close(bbox1, bbox2, threshold=50) -> bool:
144
  """Check if two bounding boxes are close to each other based on their edges.
145
+
146
  Args:
147
  bbox1 (tuple): The first bounding box as a tuple (left, top, right, bottom).
148
  bbox2 (tuple): The second bounding box as a tuple (left, top, right, bottom).
149
  threshold (int): The distance threshold to consider two boxes as close.
150
+
151
  Returns:
152
  bool: True if the bounding boxes are close, False otherwise.
153
  """
 
166
 
167
  def merge_bounding_boxes(bboxes) -> Optional[fitz.Rect]:
168
  """Merge a list of bounding boxes into a single bounding box.
169
+
170
  Args:
171
  bboxes (list): A list of bounding boxes, each represented as a tuple (left, top, right, bottom).
172
+
173
  Returns:
174
  fitz.Rect: A single bounding box that encompasses all input bounding boxes.
175
  """
 
184
 
185
  def group_bounding_boxes(bboxes, threshold=50) -> list:
186
  """Group bounding boxes that are close to each other into larger bounding boxes.
187
+
188
  Args:
189
  bboxes (list): A list of bounding boxes, each represented as a tuple (left, top, right, bottom).
190
  threshold (int): The distance threshold to consider two boxes as close.
191
+
192
  Returns:
193
  list: A list of merged bounding boxes, where each box represents a group of close bounding boxes.
194
  """
 
230
 
231
  def process_large_drawing(drawings, max_drawings=1000, threshold=50) -> list:
232
  """Process a large number of drawings by grouping them into bounding boxes.
233
+
234
  Args:
235
  drawings (list): A list of drawing dictionaries, each containing a "rect" key with bounding box coordinates.
236
  max_drawings (int): Maximum number of drawings to process at once.
237
  threshold (int): The distance threshold to consider two boxes as close.
238
+
239
  Returns:
240
  list: A list of merged bounding boxes, where each box represents a group of close drawings.
241
  """
 
259
 
260
  def find_surrounding_text(page, group, threshold=50) -> list:
261
  """Find text blocks surrounding a given bounding box on a PDF page.
262
+
263
  Args:
264
  page (fitz.Page): The PDF page object.
265
  group (fitz.Rect): The bounding box of the group of drawings.
266
  threshold (int): The distance threshold to consider a text block as surrounding.
267
+
268
  Returns:
269
  list: A list of bounding boxes of surrounding text blocks.
270
  """
 
285
 
286
  def extract_vector(pdf, page, page_num) -> list[dict]:
287
  """Extract vector graphics from a PDF page and classify them based on their aspect ratio.
288
+
289
  Args:
290
  pdf (str): The PDF filename without extension.
291
  page (fitz.Page): The PDF page object.
292
  page_num (int): The page number in the PDF document.
293
+
294
  Returns:
295
  list: A list of dictionaries containing figure metadata, including:
296
  - "name": The name of the figure file.
 
376
 
377
  def save_pdf_images(pdf_path: str, req_imgs: list, images_dir: str) -> bool:
378
  """Save images used in the presentation to the specified directory.
379
+
380
  Args:
381
  pdf_path (str): Path to the PDF file.
382
  req_imgs (list): List of dictionaries containing required images metadata.
383
  images_dir (str): Directory where the images will be saved.
384
+
385
  Returns:
386
  bool: True if images were saved successfully, False otherwise.
387
  """
 
425
 
426
  def save_pdf_figures(pdf_path: str, req_figs: list, figures_dir: str) -> bool:
427
  """Save figures used in the presentation to the specified directory.
428
+
429
  Args:
430
  pdf_path (str): Path to the PDF file.
431
  req_figs (list): List of dictionaries containing required figures metadata.
432
  figures_dir (str): Directory where the figures will be saved.
433
+
434
  Returns:
435
  bool: True if figures were saved successfully, False otherwise.
436
  """
 
508
  def find_used_gfx(answer, work_dir: str, metadatas: list) -> None:
509
  """Finds and saves the figures used in the LLM output to the gfx directory
510
  where the presentation will be compiled.
511
+
512
  Args:
513
  answer (str): The LLM answer containing names of the figures.
514
  work_dir (str): The working directory where the presentation will be compiled.