openingestion 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. openingestion-0.1.0/LICENSE +32 -0
  2. openingestion-0.1.0/PKG-INFO +176 -0
  3. openingestion-0.1.0/README.md +95 -0
  4. openingestion-0.1.0/__init__.py +455 -0
  5. openingestion-0.1.0/chef/__init__.py +12 -0
  6. openingestion-0.1.0/chef/base.py +68 -0
  7. openingestion-0.1.0/chef/docling_chef.py +434 -0
  8. openingestion-0.1.0/chef/mineru_chef.py +349 -0
  9. openingestion-0.1.0/chunker/__init__.py +69 -0
  10. openingestion-0.1.0/chunker/base.py +121 -0
  11. openingestion-0.1.0/chunker/by_block.py +105 -0
  12. openingestion-0.1.0/chunker/by_page.py +0 -0
  13. openingestion-0.1.0/chunker/by_recursive.py +489 -0
  14. openingestion-0.1.0/chunker/by_section.py +0 -0
  15. openingestion-0.1.0/chunker/by_semantic.py +677 -0
  16. openingestion-0.1.0/chunker/by_sentence.py +635 -0
  17. openingestion-0.1.0/chunker/by_slumber.py +513 -0
  18. openingestion-0.1.0/chunker/by_token.py +259 -0
  19. openingestion-0.1.0/chunker/fixed_size.py +0 -0
  20. openingestion-0.1.0/chunker/multipass.py +207 -0
  21. openingestion-0.1.0/document.py +158 -0
  22. openingestion-0.1.0/fetcher/__init__.py +35 -0
  23. openingestion-0.1.0/fetcher/base.py +89 -0
  24. openingestion-0.1.0/fetcher/cloud.py +1 -0
  25. openingestion-0.1.0/fetcher/database.py +1 -0
  26. openingestion-0.1.0/fetcher/local.py +234 -0
  27. openingestion-0.1.0/fetcher/sharepoint.py +220 -0
  28. openingestion-0.1.0/fetcher/web.py +137 -0
  29. openingestion-0.1.0/genie/__init__.py +29 -0
  30. openingestion-0.1.0/genie/base.py +94 -0
  31. openingestion-0.1.0/genie/openai_genie.py +248 -0
  32. openingestion-0.1.0/openingestion.egg-info/PKG-INFO +176 -0
  33. openingestion-0.1.0/openingestion.egg-info/SOURCES.txt +96 -0
  34. openingestion-0.1.0/openingestion.egg-info/dependency_links.txt +1 -0
  35. openingestion-0.1.0/openingestion.egg-info/requires.txt +70 -0
  36. openingestion-0.1.0/openingestion.egg-info/top_level.txt +1 -0
  37. openingestion-0.1.0/porter/__init__.py +5 -0
  38. openingestion-0.1.0/porter/base.py +53 -0
  39. openingestion-0.1.0/porter/json_porter.py +157 -0
  40. openingestion-0.1.0/porter/to_dicts.py +0 -0
  41. openingestion-0.1.0/porter/to_langchain.py +0 -0
  42. openingestion-0.1.0/porter/to_llamaindex.py +0 -0
  43. openingestion-0.1.0/pyproject.toml +161 -0
  44. openingestion-0.1.0/refinery/__init__.py +8 -0
  45. openingestion-0.1.0/refinery/base.py +54 -0
  46. openingestion-0.1.0/refinery/contextual_rag.py +361 -0
  47. openingestion-0.1.0/refinery/protocols.py +39 -0
  48. openingestion-0.1.0/refinery/rag_refinery.py +333 -0
  49. openingestion-0.1.0/refinery/vision.py +141 -0
  50. openingestion-0.1.0/setup.cfg +4 -0
  51. openingestion-0.1.0/utils/__init__.py +56 -0
  52. openingestion-0.1.0/utils/draw_chunks.py +273 -0
  53. openingestion-0.1.0/utils/embedder.py +251 -0
  54. openingestion-0.1.0/utils/tokenizer.py +365 -0
@@ -0,0 +1,32 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 openingestion contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ──────────────────────────────────────────────────────────────────────────────
24
+ NOTICE ON OPTIONAL DEPENDENCIES
25
+ ──────────────────────────────────────────────────────────────────────────────
26
+ This package has optional dependencies with more restrictive licences:
27
+
28
+ - MinerU (pip install openingestion[mineru]) — AGPL-3.0
29
+ https://github.com/opendatalab/MinerU/blob/master/LICENSE
30
+
31
+ When you install these optional extras, their respective licence terms apply
32
+ to your usage of those components.
@@ -0,0 +1,176 @@
1
+ Metadata-Version: 2.4
2
+ Name: openingestion
3
+ Version: 0.1.0
4
+ Summary: RAG ingestion pipeline — Chef → Chunker → Refinery → Porter
5
+ Author: openingestion contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Isopope/openIngestion.git
8
+ Project-URL: Bug Tracker, https://github.com/Isopope/openIngestion/issues
9
+ Keywords: rag,ingestion,chunking,pdf,nlp,llm,mineru,docling,vector-store
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Classifier: Topic :: Text Processing
21
+ Classifier: Topic :: Text Processing :: Indexing
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: loguru
26
+ Requires-Dist: chonkie-core
27
+ Provides-Extra: mineru
28
+ Requires-Dist: mineru[pipeline]>=2.7.6; extra == "mineru"
29
+ Provides-Extra: docling
30
+ Requires-Dist: docling; extra == "docling"
31
+ Provides-Extra: semantic
32
+ Requires-Dist: sentence-transformers; extra == "semantic"
33
+ Requires-Dist: numpy; extra == "semantic"
34
+ Requires-Dist: scipy; extra == "semantic"
35
+ Provides-Extra: web
36
+ Requires-Dist: playwright; extra == "web"
37
+ Provides-Extra: sharepoint
38
+ Requires-Dist: office365-rest-python-client; extra == "sharepoint"
39
+ Requires-Dist: msal; extra == "sharepoint"
40
+ Provides-Extra: slumber
41
+ Requires-Dist: openai; extra == "slumber"
42
+ Requires-Dist: pydantic; extra == "slumber"
43
+ Requires-Dist: tenacity; extra == "slumber"
44
+ Requires-Dist: tqdm; extra == "slumber"
45
+ Provides-Extra: tiktoken
46
+ Requires-Dist: tiktoken; extra == "tiktoken"
47
+ Provides-Extra: hf-tokenizers
48
+ Requires-Dist: tokenizers; extra == "hf-tokenizers"
49
+ Provides-Extra: transformers
50
+ Requires-Dist: transformers; extra == "transformers"
51
+ Provides-Extra: langchain
52
+ Requires-Dist: langchain-core; extra == "langchain"
53
+ Provides-Extra: llamaindex
54
+ Requires-Dist: llama-index-core; extra == "llamaindex"
55
+ Provides-Extra: cpu
56
+ Requires-Dist: openingestion[docling]; extra == "cpu"
57
+ Requires-Dist: openingestion[semantic]; extra == "cpu"
58
+ Requires-Dist: openingestion[tiktoken]; extra == "cpu"
59
+ Provides-Extra: gpu
60
+ Requires-Dist: openingestion[semantic]; extra == "gpu"
61
+ Requires-Dist: openingestion[tiktoken]; extra == "gpu"
62
+ Provides-Extra: all
63
+ Requires-Dist: openingestion[docling]; extra == "all"
64
+ Requires-Dist: openingestion[semantic]; extra == "all"
65
+ Requires-Dist: openingestion[slumber]; extra == "all"
66
+ Requires-Dist: openingestion[tiktoken]; extra == "all"
67
+ Requires-Dist: openingestion[hf-tokenizers]; extra == "all"
68
+ Requires-Dist: openingestion[transformers]; extra == "all"
69
+ Requires-Dist: openingestion[langchain]; extra == "all"
70
+ Requires-Dist: openingestion[llamaindex]; extra == "all"
71
+ Requires-Dist: openingestion[web]; extra == "all"
72
+ Requires-Dist: openingestion[sharepoint]; extra == "all"
73
+ Provides-Extra: dev
74
+ Requires-Dist: pytest>=8; extra == "dev"
75
+ Requires-Dist: pytest-mock; extra == "dev"
76
+ Requires-Dist: ruff; extra == "dev"
77
+ Requires-Dist: mypy; extra == "dev"
78
+ Requires-Dist: build; extra == "dev"
79
+ Requires-Dist: twine; extra == "dev"
80
+ Dynamic: license-file
81
+
82
+ # openingestion
83
+
84
+ Pipeline d'ingestion RAG au-dessus de MinerU / Docling.
85
+
86
+ ```
87
+ Fetcher → Chef → Chunker → Refinery → Porter
88
+ ```
89
+
90
+ ## Installation
91
+
92
+ ### 1. Cloner et installer en mode éditable
93
+
94
+ ```bash
95
+ git clone <repo-url>
96
+ cd openingestion
97
+ pip install -e .
98
+ ```
99
+
100
+ > L'installation éditable (`-e`) est **obligatoire** pour que les imports
101
+ > `from openingestion import …` se résolvent correctement depuis les scripts
102
+ > et notebooks, car la racine du dépôt *est* le package Python.
103
+
104
+ ### 1bis. Setup Windows / PowerShell
105
+
106
+ Le projet demande `Python >= 3.10`. Sur Windows, un setup simple ressemble à :
107
+
108
+ ```powershell
109
+ py -3.14 -m venv .venv
110
+ . .\.venv\Scripts\Activate.ps1
111
+ python -m pip install --upgrade pip
112
+ python -m pip install -e .
113
+ ```
114
+
115
+ Pour un premier run CPU sans GPU, ajoutez Docling :
116
+
117
+ ```powershell
118
+ python -m pip install -e ".[docling]"
119
+ ```
120
+
121
+ ### 2. Extras optionnels
122
+
123
+ ```bash
124
+ # Parser MinerU (GPU recommandé)
125
+ pip install -e ".[mineru]"
126
+
127
+ # Parser Docling (CPU, pas de GPU nécessaire)
128
+ pip install -e ".[docling]"
129
+
130
+ # Chunking sémantique (sentence-transformers + scipy)
131
+ pip install -e ".[semantic]"
132
+
133
+ # Chunking LLM-guidé SlumberChunker + OpenAIGenie
134
+ pip install -e ".[slumber]"
135
+
136
+ # Tokenizer OpenAI exact (cl100k_base, o200k_base…)
137
+ pip install -e ".[tiktoken]"
138
+
139
+ # Tokenizer HuggingFace rapide (Rust, BPE/WordPiece…)
140
+ pip install -e ".[hf-tokenizers]"
141
+
142
+ # AutoTokenizer HuggingFace (transformers complet)
143
+ pip install -e ".[transformers]"
144
+
145
+ # Tout à la fois
146
+ pip install -e ".[mineru,docling,semantic,slumber,tiktoken]"
147
+ ```
148
+
149
+ ## Utilisation rapide
150
+
151
+ ```python
152
+ from openingestion import ingest
153
+
154
+ # Depuis un PDF brut (MinerU tourne en arrière-plan)
155
+ chunks = ingest("rapport.pdf")
156
+
157
+ # Depuis un répertoire de sortie MinerU existant (pas de re-parsing)
158
+ chunks = ingest("./output/rapport/auto/")
159
+
160
+ # Avec Docling (CPU, pas de GPU)
161
+ chunks = ingest("rapport.pdf", parser="docling", strategy="by_token")
162
+
163
+ # Format LangChain
164
+ docs = ingest("rapport.pdf", output_format="langchain")
165
+ ```
166
+
167
+ ## Architecture
168
+
169
+ | Étape | Classe | Rôle |
170
+ |---|---|---|
171
+ | Chef | `MinerUChef`, `DoclingChef` | Parse le document → `ContentBlock[]` |
172
+ | Chunker | `TokenChunker`, `SentenceChunker`, `SemanticChunker`… | Groupe les blocs → `RagChunk[]` |
173
+ | Refinery | `RagRefinery`, `ContextualRagRefinery` | Enrichit les chunks (tokens, hash, images, contexte LLM) |
174
+ | Porter | `JSONPorter`, `to_langchain`, `to_llamaindex` | Exporte vers le format cible |
175
+
176
+ Voir [specv3.md](specv3.md) pour les spécifications techniques détaillées.
@@ -0,0 +1,95 @@
1
+ # openingestion
2
+
3
+ Pipeline d'ingestion RAG au-dessus de MinerU / Docling.
4
+
5
+ ```
6
+ Fetcher → Chef → Chunker → Refinery → Porter
7
+ ```
8
+
9
+ ## Installation
10
+
11
+ ### 1. Cloner et installer en mode éditable
12
+
13
+ ```bash
14
+ git clone <repo-url>
15
+ cd openingestion
16
+ pip install -e .
17
+ ```
18
+
19
+ > L'installation éditable (`-e`) est **obligatoire** pour que les imports
20
+ > `from openingestion import …` se résolvent correctement depuis les scripts
21
+ > et notebooks, car la racine du dépôt *est* le package Python.
22
+
23
+ ### 1bis. Setup Windows / PowerShell
24
+
25
+ Le projet demande `Python >= 3.10`. Sur Windows, un setup simple ressemble à :
26
+
27
+ ```powershell
28
+ py -3.14 -m venv .venv
29
+ . .\.venv\Scripts\Activate.ps1
30
+ python -m pip install --upgrade pip
31
+ python -m pip install -e .
32
+ ```
33
+
34
+ Pour un premier run CPU sans GPU, ajoutez Docling :
35
+
36
+ ```powershell
37
+ python -m pip install -e ".[docling]"
38
+ ```
39
+
40
+ ### 2. Extras optionnels
41
+
42
+ ```bash
43
+ # Parser MinerU (GPU recommandé)
44
+ pip install -e ".[mineru]"
45
+
46
+ # Parser Docling (CPU, pas de GPU nécessaire)
47
+ pip install -e ".[docling]"
48
+
49
+ # Chunking sémantique (sentence-transformers + scipy)
50
+ pip install -e ".[semantic]"
51
+
52
+ # Chunking LLM-guidé SlumberChunker + OpenAIGenie
53
+ pip install -e ".[slumber]"
54
+
55
+ # Tokenizer OpenAI exact (cl100k_base, o200k_base…)
56
+ pip install -e ".[tiktoken]"
57
+
58
+ # Tokenizer HuggingFace rapide (Rust, BPE/WordPiece…)
59
+ pip install -e ".[hf-tokenizers]"
60
+
61
+ # AutoTokenizer HuggingFace (transformers complet)
62
+ pip install -e ".[transformers]"
63
+
64
+ # Tout à la fois
65
+ pip install -e ".[mineru,docling,semantic,slumber,tiktoken]"
66
+ ```
67
+
68
+ ## Utilisation rapide
69
+
70
+ ```python
71
+ from openingestion import ingest
72
+
73
+ # Depuis un PDF brut (MinerU tourne en arrière-plan)
74
+ chunks = ingest("rapport.pdf")
75
+
76
+ # Depuis un répertoire de sortie MinerU existant (pas de re-parsing)
77
+ chunks = ingest("./output/rapport/auto/")
78
+
79
+ # Avec Docling (CPU, pas de GPU)
80
+ chunks = ingest("rapport.pdf", parser="docling", strategy="by_token")
81
+
82
+ # Format LangChain
83
+ docs = ingest("rapport.pdf", output_format="langchain")
84
+ ```
85
+
86
+ ## Architecture
87
+
88
+ | Étape | Classe | Rôle |
89
+ |---|---|---|
90
+ | Chef | `MinerUChef`, `DoclingChef` | Parse le document → `ContentBlock[]` |
91
+ | Chunker | `TokenChunker`, `SentenceChunker`, `SemanticChunker`… | Groupe les blocs → `RagChunk[]` |
92
+ | Refinery | `RagRefinery`, `ContextualRagRefinery` | Enrichit les chunks (tokens, hash, images, contexte LLM) |
93
+ | Porter | `JSONPorter`, `to_langchain`, `to_llamaindex` | Exporte vers le format cible |
94
+
95
+ Voir [specv3.md](specv3.md) pour les spécifications techniques détaillées.