docqwise 0.2.0__tar.gz → 0.2.1__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 (130) hide show
  1. {docqwise-0.2.0 → docqwise-0.2.1}/PKG-INFO +1 -1
  2. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/factory.py +1 -0
  3. docqwise-0.2.1/docqwise/stores/faiss_store.py +187 -0
  4. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise.egg-info/PKG-INFO +1 -1
  5. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise.egg-info/SOURCES.txt +1 -0
  6. {docqwise-0.2.0 → docqwise-0.2.1}/pyproject.toml +1 -1
  7. {docqwise-0.2.0 → docqwise-0.2.1}/LICENSE +0 -0
  8. {docqwise-0.2.0 → docqwise-0.2.1}/README.md +0 -0
  9. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/__init__.py +0 -0
  10. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/_version.py +0 -0
  11. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/agent/__init__.py +0 -0
  12. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/benchmark/__init__.py +0 -0
  13. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/benchmark/runner.py +0 -0
  14. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/bridges/__init__.py +0 -0
  15. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/bridges/adaptive_bridge.py +0 -0
  16. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/bridges/evalkit_bridge.py +0 -0
  17. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/bridges/sightrag_bridge.py +0 -0
  18. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/bridges/sonarwise_bridge.py +0 -0
  19. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/chunkers/__init__.py +0 -0
  20. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/chunkers/base.py +0 -0
  21. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/chunkers/fixed_chunker.py +0 -0
  22. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/chunkers/sentence_chunker.py +0 -0
  23. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/chunkers/structure_chunker.py +0 -0
  24. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/classifier/__init__.py +0 -0
  25. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/classifier/zero_shot.py +0 -0
  26. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/cli/__init__.py +0 -0
  27. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/cli/main.py +0 -0
  28. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/comparator/__init__.py +0 -0
  29. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/comparator/text_diff.py +0 -0
  30. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/config.py +0 -0
  31. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/connectors/__init__.py +0 -0
  32. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/connectors/base.py +0 -0
  33. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/connectors/filesystem.py +0 -0
  34. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/core/__init__.py +0 -0
  35. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/core/bases.py +0 -0
  36. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/core/chunk.py +0 -0
  37. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/core/document.py +0 -0
  38. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/core/element.py +0 -0
  39. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/core/field.py +0 -0
  40. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/databases/__init__.py +0 -0
  41. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/databases/base.py +0 -0
  42. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/databases/sqlite_db.py +0 -0
  43. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/embedders/__init__.py +0 -0
  44. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/embedders/base.py +0 -0
  45. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/embedders/sentence_transformer.py +0 -0
  46. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/engine.py +0 -0
  47. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/exceptions.py +0 -0
  48. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/export/__init__.py +0 -0
  49. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/export/csv_exporter.py +0 -0
  50. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/export/json_exporter.py +0 -0
  51. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/__init__.py +0 -0
  52. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/base.py +0 -0
  53. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/entity_extractor.py +0 -0
  54. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/field_extractor.py +0 -0
  55. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/image_extractor.py +0 -0
  56. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/llm_extractor.py +0 -0
  57. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/metadata_extractor.py +0 -0
  58. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/multimodal_extractor.py +0 -0
  59. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/rag_extractor.py +0 -0
  60. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/table_extractor.py +0 -0
  61. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/extractors/text_extractor.py +0 -0
  62. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/graph/__init__.py +0 -0
  63. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/graph/backends/__init__.py +0 -0
  64. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/graph/document_graph.py +0 -0
  65. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/incremental/__init__.py +0 -0
  66. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/incremental/change_detector.py +0 -0
  67. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/incremental/watcher.py +0 -0
  68. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/layout/__init__.py +0 -0
  69. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/learning/__init__.py +0 -0
  70. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/learning/correction.py +0 -0
  71. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/llm/__init__.py +0 -0
  72. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/llm/base.py +0 -0
  73. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/llm/hf_llm.py +0 -0
  74. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/llm/ollama.py +0 -0
  75. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/llm/openai_llm.py +0 -0
  76. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/ocr/__init__.py +0 -0
  77. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/ocr/base.py +0 -0
  78. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/ocr/easyocr_engine.py +0 -0
  79. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/ocr/tesseract_engine.py +0 -0
  80. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/pipeline/__init__.py +0 -0
  81. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/pipeline/pipeline.py +0 -0
  82. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/pipeline/prebuilt/__init__.py +0 -0
  83. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/__init__.py +0 -0
  84. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/auto_reader.py +0 -0
  85. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/base.py +0 -0
  86. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/csv_reader.py +0 -0
  87. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/docx_reader.py +0 -0
  88. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/email_reader.py +0 -0
  89. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/excel_reader.py +0 -0
  90. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/html_reader.py +0 -0
  91. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/image_reader.py +0 -0
  92. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/json_reader.py +0 -0
  93. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/parquet_reader.py +0 -0
  94. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/pdf_reader.py +0 -0
  95. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/pptx_reader.py +0 -0
  96. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/readers/text_reader.py +0 -0
  97. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/retrieval/__init__.py +0 -0
  98. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/retrieval/hybrid_search.py +0 -0
  99. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/retrieval/qa_engine.py +0 -0
  100. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/retrieval/query_router.py +0 -0
  101. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/retrieval/retriever.py +0 -0
  102. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/schema/__init__.py +0 -0
  103. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/schema/detector.py +0 -0
  104. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/schema/quality.py +0 -0
  105. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/schema/validator.py +0 -0
  106. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/security/__init__.py +0 -0
  107. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/security/pii_detector.py +0 -0
  108. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/server/__init__.py +0 -0
  109. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/server/api.py +0 -0
  110. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/server/mcp_server.py +0 -0
  111. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/server/routes/__init__.py +0 -0
  112. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/speed/__init__.py +0 -0
  113. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/speed/dispatcher.py +0 -0
  114. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/speed/progress.py +0 -0
  115. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/stores/__init__.py +0 -0
  116. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/stores/base.py +0 -0
  117. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/stores/sqlite_store.py +0 -0
  118. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/strategy/__init__.py +0 -0
  119. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/strategy/profiler.py +0 -0
  120. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/strategy/router.py +0 -0
  121. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/templates/__init__.py +0 -0
  122. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/templates/contract.py +0 -0
  123. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/templates/invoice.py +0 -0
  124. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/templates/receipt.py +0 -0
  125. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise/templates/resume.py +0 -0
  126. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise.egg-info/dependency_links.txt +0 -0
  127. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise.egg-info/entry_points.txt +0 -0
  128. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise.egg-info/requires.txt +0 -0
  129. {docqwise-0.2.0 → docqwise-0.2.1}/docqwise.egg-info/top_level.txt +0 -0
  130. {docqwise-0.2.0 → docqwise-0.2.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docqwise
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Read, Extract, Retrieve: Document intelligence that adapts, accelerates, and scales.
5
5
  Author: Venkatkumar Rajan
6
6
  License: Apache-2.0
@@ -174,6 +174,7 @@ class StoreFactory:
174
174
 
175
175
  STORES = {
176
176
  "sqlite": "docqwise.stores.sqlite_store.SQLiteVectorStore",
177
+ "faiss": "docqwise.stores.faiss_store.FAISSVectorStore",
177
178
  }
178
179
 
179
180
  @classmethod
@@ -0,0 +1,187 @@
1
+ """FAISS vector store — fast, production-grade, local.
2
+
3
+ Faster than SQLite for large datasets. Scales to millions of documents.
4
+ No server needed. Runs in-process.
5
+
6
+ Install:
7
+ pip install faiss-cpu # CPU (works everywhere)
8
+ pip install faiss-gpu # GPU (NVIDIA CUDA)
9
+
10
+ Windows fix (if faiss-cpu fails):
11
+ pip install faiss-cpu --no-cache-dir
12
+ # OR
13
+ conda install -c conda-forge faiss-cpu
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import os
19
+ import pickle
20
+ from typing import Optional
21
+
22
+ import numpy as np
23
+
24
+ from docqwise.core.chunk import DocqwiseChunk
25
+ from docqwise.stores.base import BaseVectorStore
26
+
27
+ try:
28
+ import faiss
29
+ FAISS_AVAILABLE = True
30
+ except ImportError:
31
+ FAISS_AVAILABLE = False
32
+
33
+
34
+ class FAISSVectorStore(BaseVectorStore):
35
+ """FAISS vector store. Fast cosine similarity search.
36
+
37
+ Usage:
38
+ from docqwise.stores.faiss_store import FAISSVectorStore
39
+ store = FAISSVectorStore("./docqwise_db")
40
+ store.insert(chunks)
41
+ results = store.search(query_embedding, top_k=5)
42
+ """
43
+
44
+ def __init__(self, store_path: str = "./docqwise_db", dimension: int = 384):
45
+ if not FAISS_AVAILABLE:
46
+ raise ImportError(
47
+ "FAISS not installed. Install with:\n"
48
+ " pip install faiss-cpu\n"
49
+ " # Windows: pip install faiss-cpu --no-cache-dir\n"
50
+ " # OR: conda install -c conda-forge faiss-cpu"
51
+ )
52
+
53
+ os.makedirs(store_path, exist_ok=True)
54
+ self._store_path = store_path
55
+ self._index_path = os.path.join(store_path, "faiss.index")
56
+ self._meta_path = os.path.join(store_path, "faiss_meta.pkl")
57
+ self._dimension = dimension
58
+
59
+ # Metadata storage (chunk_id, doc_id, text, source_path, metadata)
60
+ self._metadata: list[dict] = []
61
+
62
+ # Load existing index or create new
63
+ if os.path.exists(self._index_path) and os.path.exists(self._meta_path):
64
+ self._index = faiss.read_index(self._index_path)
65
+ with open(self._meta_path, "rb") as f:
66
+ self._metadata = pickle.load(f)
67
+ self._dimension = self._index.d
68
+ else:
69
+ self._index = faiss.IndexFlatIP(dimension) # inner product (cosine on normalized vectors)
70
+
71
+ def _save(self):
72
+ """Persist index and metadata to disk."""
73
+ faiss.write_index(self._index, self._index_path)
74
+ with open(self._meta_path, "wb") as f:
75
+ pickle.dump(self._metadata, f)
76
+
77
+ def insert(self, chunks: list[DocqwiseChunk]) -> None:
78
+ vectors = []
79
+ for chunk in chunks:
80
+ if chunk.embedding is None:
81
+ continue
82
+
83
+ emb = chunk.embedding.astype(np.float32)
84
+ # Normalize for cosine similarity
85
+ norm = np.linalg.norm(emb)
86
+ if norm > 0:
87
+ emb = emb / norm
88
+
89
+ vectors.append(emb)
90
+ self._metadata.append({
91
+ "chunk_id": chunk.chunk_id,
92
+ "doc_id": chunk.metadata.doc_id,
93
+ "text": chunk.text,
94
+ "source_path": chunk.metadata.source_path,
95
+ "metadata": {
96
+ "page_num": chunk.metadata.page_num,
97
+ "chunk_index": chunk.metadata.chunk_index,
98
+ "element_type": chunk.metadata.element_type.value,
99
+ "heading_context": chunk.metadata.heading_context,
100
+ "confidence": chunk.metadata.confidence,
101
+ },
102
+ })
103
+
104
+ if vectors:
105
+ matrix = np.array(vectors, dtype=np.float32)
106
+ # Resize index if dimension changed
107
+ if self._index.d != matrix.shape[1]:
108
+ import faiss
109
+ self._dimension = matrix.shape[1]
110
+ self._index = faiss.IndexFlatIP(self._dimension)
111
+ self._index.add(matrix)
112
+ self._save()
113
+
114
+ def search(self, query_embedding: np.ndarray, top_k: int = 5,
115
+ filters: Optional[dict] = None) -> list[dict]:
116
+ if self._index.ntotal == 0:
117
+ return []
118
+
119
+ # Normalize query
120
+ query = query_embedding.astype(np.float32)
121
+ norm = np.linalg.norm(query)
122
+ if norm > 0:
123
+ query = query / norm
124
+ query = query.reshape(1, -1)
125
+
126
+ # Search
127
+ scores, indices = self._index.search(query, min(top_k * 3, self._index.ntotal))
128
+
129
+ results = []
130
+ for score, idx in zip(scores[0], indices[0]):
131
+ if idx < 0 or idx >= len(self._metadata):
132
+ continue
133
+ meta = self._metadata[idx]
134
+
135
+ # Apply filters
136
+ if filters:
137
+ skip = False
138
+ for k, v in filters.items():
139
+ if k == "doc_id" and meta.get("doc_id") != v:
140
+ skip = True
141
+ elif meta.get("metadata", {}).get(k) != v:
142
+ skip = True
143
+ if skip:
144
+ continue
145
+
146
+ results.append({
147
+ "chunk_id": meta["chunk_id"],
148
+ "doc_id": meta["doc_id"],
149
+ "text": meta["text"],
150
+ "score": float(score),
151
+ "metadata": meta["metadata"],
152
+ "source_path": meta.get("source_path", ""),
153
+ })
154
+
155
+ if len(results) >= top_k:
156
+ break
157
+
158
+ return results
159
+
160
+ def delete(self, doc_id: str) -> None:
161
+ """Delete all chunks for a document. Rebuilds index."""
162
+
163
+ new_meta = []
164
+ new_vectors = []
165
+
166
+ for i, meta in enumerate(self._metadata):
167
+ if meta["doc_id"] != doc_id:
168
+ new_meta.append(meta)
169
+ vec = self._index.reconstruct(i)
170
+ new_vectors.append(vec)
171
+
172
+ self._metadata = new_meta
173
+ self._index = faiss.IndexFlatIP(self._dimension)
174
+ if new_vectors:
175
+ matrix = np.array(new_vectors, dtype=np.float32)
176
+ self._index.add(matrix)
177
+ self._save()
178
+
179
+ def update(self, doc_id: str, chunks: list[DocqwiseChunk]) -> None:
180
+ self.delete(doc_id)
181
+ self.insert(chunks)
182
+
183
+ def count(self) -> int:
184
+ return self._index.ntotal
185
+
186
+ def get_all_doc_ids(self) -> list[str]:
187
+ return list(set(m["doc_id"] for m in self._metadata))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docqwise
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Read, Extract, Retrieve: Document intelligence that adapts, accelerates, and scales.
5
5
  Author: Venkatkumar Rajan
6
6
  License: Apache-2.0
@@ -116,6 +116,7 @@ docqwise/speed/dispatcher.py
116
116
  docqwise/speed/progress.py
117
117
  docqwise/stores/__init__.py
118
118
  docqwise/stores/base.py
119
+ docqwise/stores/faiss_store.py
119
120
  docqwise/stores/sqlite_store.py
120
121
  docqwise/strategy/__init__.py
121
122
  docqwise/strategy/profiler.py
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "docqwise"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "Read, Extract, Retrieve: Document intelligence that adapts, accelerates, and scales."
5
5
  readme = "README.md"
6
6
  license = {text = "Apache-2.0"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes