ashmatics-tools 0.7.2__py3-none-any.whl
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.
- ashmatics_tools/__init__.py +356 -0
- ashmatics_tools/chunkers/__init__.py +42 -0
- ashmatics_tools/chunkers/azure_chunker.py +573 -0
- ashmatics_tools/chunkers/base.py +144 -0
- ashmatics_tools/chunkers/docling_chunker.py +254 -0
- ashmatics_tools/chunkers/factory.py +86 -0
- ashmatics_tools/chunkers/simple_chunker.py +134 -0
- ashmatics_tools/document_storage/__init__.py +47 -0
- ashmatics_tools/document_storage/figure_storage.py +372 -0
- ashmatics_tools/document_storage/table_storage.py +349 -0
- ashmatics_tools/embedders/__init__.py +47 -0
- ashmatics_tools/embedders/azure_embedder.py +584 -0
- ashmatics_tools/embedders/base.py +185 -0
- ashmatics_tools/embedders/factory.py +81 -0
- ashmatics_tools/embedders/openai_embedder.py +270 -0
- ashmatics_tools/embedding/__init__.py +51 -0
- ashmatics_tools/embedding/base.py +126 -0
- ashmatics_tools/embedding/mongodb_pipeline.py +381 -0
- ashmatics_tools/embedding/specialized/__init__.py +22 -0
- ashmatics_tools/embedding/specialized/cards.py +295 -0
- ashmatics_tools/embedding/specialized/framework.py +150 -0
- ashmatics_tools/embedding/specialized/usecases.py +179 -0
- ashmatics_tools/enrichers/__init__.py +80 -0
- ashmatics_tools/enrichers/metrics_extractor.py +623 -0
- ashmatics_tools/enrichers/table_classifier.py +361 -0
- ashmatics_tools/enrichers/table_consolidator.py +1029 -0
- ashmatics_tools/enrichers/training_data_extractor.py +531 -0
- ashmatics_tools/external_apis/__init__.py +93 -0
- ashmatics_tools/external_apis/accessgudid/__init__.py +103 -0
- ashmatics_tools/external_apis/accessgudid/client.py +695 -0
- ashmatics_tools/external_apis/accessgudid/config.py +83 -0
- ashmatics_tools/external_apis/accessgudid/models.py +506 -0
- ashmatics_tools/external_apis/accessgudid/transforms.py +430 -0
- ashmatics_tools/external_apis/base.py +315 -0
- ashmatics_tools/external_apis/factory.py +133 -0
- ashmatics_tools/external_apis/openfda/__init__.py +59 -0
- ashmatics_tools/external_apis/openfda/client.py +475 -0
- ashmatics_tools/external_apis/openfda/config.py +111 -0
- ashmatics_tools/external_apis/openfda/transforms.py +273 -0
- ashmatics_tools/graphql/__init__.py +9 -0
- ashmatics_tools/graphql/client.py +417 -0
- ashmatics_tools/llm/__init__.py +151 -0
- ashmatics_tools/llm/azure_ai_foundry.py +328 -0
- ashmatics_tools/llm/azure_openai.py +519 -0
- ashmatics_tools/llm/base.py +386 -0
- ashmatics_tools/llm/context.py +371 -0
- ashmatics_tools/llm/factory.py +245 -0
- ashmatics_tools/llm/huggingface.py +576 -0
- ashmatics_tools/llm/llamacpp.py +794 -0
- ashmatics_tools/llm/ollama.py +1024 -0
- ashmatics_tools/llm/openai.py +548 -0
- ashmatics_tools/llm/retry.py +287 -0
- ashmatics_tools/mcp_servers/__init__.py +67 -0
- ashmatics_tools/mcp_servers/accessgudid/__init__.py +43 -0
- ashmatics_tools/mcp_servers/accessgudid/__main__.py +254 -0
- ashmatics_tools/mcp_servers/accessgudid/config.py +64 -0
- ashmatics_tools/mcp_servers/accessgudid/server.py +447 -0
- ashmatics_tools/mcp_servers/base.py +201 -0
- ashmatics_tools/mcp_servers/factory.py +126 -0
- ashmatics_tools/mcp_servers/openfda/__init__.py +32 -0
- ashmatics_tools/mcp_servers/openfda/__main__.py +248 -0
- ashmatics_tools/mcp_servers/openfda/config.py +60 -0
- ashmatics_tools/mcp_servers/openfda/server.py +410 -0
- ashmatics_tools/ontology/__init__.py +66 -0
- ashmatics_tools/ontology/categories/__init__.py +26 -0
- ashmatics_tools/ontology/categories/manager.py +419 -0
- ashmatics_tools/ontology/categories/schemas.py +106 -0
- ashmatics_tools/ontology/core/__init__.py +51 -0
- ashmatics_tools/ontology/core/ashcai_ontology.py +1397 -0
- ashmatics_tools/ontology/core/ashmatics_ontology.py +842 -0
- ashmatics_tools/ontology/core/bioportal_client.py +696 -0
- ashmatics_tools/ontology/data/__init__.py +10 -0
- ashmatics_tools/ontology/data/ashcai-ontology-v1.0.json +828 -0
- ashmatics_tools/ontology/data/ashmatics-ontology-v20250616.json +624 -0
- ashmatics_tools/ontology/terms/__init__.py +144 -0
- ashmatics_tools/ontology/terms/ashcai_schemas.py +1046 -0
- ashmatics_tools/ontology/terms/resolver.py +429 -0
- ashmatics_tools/ontology/terms/schemas.py +477 -0
- ashmatics_tools/ontology/terms/valueset_schemas.py +56 -0
- ashmatics_tools/parsers/__init__.py +50 -0
- ashmatics_tools/parsers/base.py +306 -0
- ashmatics_tools/parsers/docling_parser.py +511 -0
- ashmatics_tools/parsers/factory.py +129 -0
- ashmatics_tools/parsers/llama_parser.py +239 -0
- ashmatics_tools/parsers/simple_parser.py +205 -0
- ashmatics_tools/processors/__init__.py +9 -0
- ashmatics_tools/processors/base.py +340 -0
- ashmatics_tools/search/__init__.py +100 -0
- ashmatics_tools/search/base.py +205 -0
- ashmatics_tools/search/exceptions.py +74 -0
- ashmatics_tools/search/factory.py +154 -0
- ashmatics_tools/search/mcp_tools.py +361 -0
- ashmatics_tools/search/prompts.py +70 -0
- ashmatics_tools/search/strategies/__init__.py +16 -0
- ashmatics_tools/search/strategies/multi_query_rag.py +577 -0
- ashmatics_tools/search/strategies/simple_rag.py +402 -0
- ashmatics_tools/storage/__init__.py +50 -0
- ashmatics_tools/storage/adls_store.py +651 -0
- ashmatics_tools/storage/base.py +457 -0
- ashmatics_tools/storage/factory.py +112 -0
- ashmatics_tools/storage/minio_store.py +674 -0
- ashmatics_tools/utils/__init__.py +11 -0
- ashmatics_tools/utils/export_utils.py +314 -0
- ashmatics_tools/utils/import_utils.py +554 -0
- ashmatics_tools/utils/schema_utils.py +324 -0
- ashmatics_tools/vector_stores/__init__.py +90 -0
- ashmatics_tools/vector_stores/base.py +377 -0
- ashmatics_tools/vector_stores/cosmosdb_store.py +622 -0
- ashmatics_tools/vector_stores/factory.py +105 -0
- ashmatics_tools/vector_stores/index_manager.py +413 -0
- ashmatics_tools/vector_stores/pgvector_store.py +601 -0
- ashmatics_tools/vector_stores/qdrant_store.py +503 -0
- ashmatics_tools-0.7.2.dist-info/METADATA +1525 -0
- ashmatics_tools-0.7.2.dist-info/RECORD +117 -0
- ashmatics_tools-0.7.2.dist-info/WHEEL +5 -0
- ashmatics_tools-0.7.2.dist-info/licenses/LICENSE +18 -0
- ashmatics_tools-0.7.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
"""Ashmatics Tools - Shared utilities for Ashmatics Knowledge Base applications.
|
|
2
|
+
|
|
3
|
+
This package provides modular utilities for document processing, embeddings,
|
|
4
|
+
vector stores, LLM clients, and external API integrations.
|
|
5
|
+
|
|
6
|
+
Installation Options:
|
|
7
|
+
# Minimal install (no torch/CUDA dependencies)
|
|
8
|
+
pip install ashmatics-tools
|
|
9
|
+
|
|
10
|
+
# With Azure storage and MongoDB
|
|
11
|
+
pip install ashmatics-tools[api]
|
|
12
|
+
|
|
13
|
+
# With document parsing (includes torch)
|
|
14
|
+
pip install ashmatics-tools[parsers,chunkers]
|
|
15
|
+
|
|
16
|
+
# Full install with all features
|
|
17
|
+
pip install ashmatics-tools[full]
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2025 Asher Informatics PBC. All Rights Reserved.
|
|
20
|
+
See LICENSE file for full license details.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
import importlib
|
|
24
|
+
from typing import TYPE_CHECKING
|
|
25
|
+
|
|
26
|
+
__version__ = "0.7.2"
|
|
27
|
+
|
|
28
|
+
# =============================================================================
|
|
29
|
+
# LAZY LOADING INFRASTRUCTURE
|
|
30
|
+
# =============================================================================
|
|
31
|
+
# We use __getattr__ to lazily import heavy modules only when accessed.
|
|
32
|
+
# This prevents importing torch/CUDA dependencies when they're not needed.
|
|
33
|
+
|
|
34
|
+
# Map of attribute names to their module paths for lazy loading
|
|
35
|
+
_LAZY_IMPORTS: dict[str, tuple[str, str]] = {
|
|
36
|
+
# Parsers (heavy - require docling)
|
|
37
|
+
"DoclingParser": ("ashmatics_tools.parsers.docling_parser", "DoclingParser"),
|
|
38
|
+
"LlamaParser": ("ashmatics_tools.parsers.llama_parser", "LlamaParser"),
|
|
39
|
+
"SimpleParser": ("ashmatics_tools.parsers.simple_parser", "SimpleParser"),
|
|
40
|
+
# Chunkers (heavy - require transformers)
|
|
41
|
+
"DoclingChunker": ("ashmatics_tools.chunkers.docling_chunker", "DoclingChunker"),
|
|
42
|
+
"AzureChunker": ("ashmatics_tools.chunkers.azure_chunker", "AzureChunker"),
|
|
43
|
+
"SimpleChunker": ("ashmatics_tools.chunkers.simple_chunker", "SimpleChunker"),
|
|
44
|
+
# Embedders
|
|
45
|
+
"AzureEmbedder": ("ashmatics_tools.embedders.azure_embedder", "AzureEmbedder"),
|
|
46
|
+
"OpenAIEmbedder": ("ashmatics_tools.embedders.openai_embedder", "OpenAIEmbedder"),
|
|
47
|
+
# Vector stores
|
|
48
|
+
"CosmosDBVectorStore": ("ashmatics_tools.vector_stores.cosmosdb_store", "CosmosDBVectorStore"),
|
|
49
|
+
"PgVectorStore": ("ashmatics_tools.vector_stores.pgvector_store", "PgVectorStore"),
|
|
50
|
+
"QdrantVectorStore": ("ashmatics_tools.vector_stores.qdrant_store", "QdrantVectorStore"),
|
|
51
|
+
"VectorIndexManager": ("ashmatics_tools.vector_stores.index_manager", "VectorIndexManager"),
|
|
52
|
+
"VectorCollectionStats": ("ashmatics_tools.vector_stores.index_manager", "VectorCollectionStats"),
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
def __getattr__(name: str):
|
|
56
|
+
"""Lazy import for heavy modules."""
|
|
57
|
+
if name in _LAZY_IMPORTS:
|
|
58
|
+
module_path, attr_name = _LAZY_IMPORTS[name]
|
|
59
|
+
module = importlib.import_module(module_path)
|
|
60
|
+
return getattr(module, attr_name)
|
|
61
|
+
raise AttributeError(f"module 'ashmatics_tools' has no attribute '{name}'")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# =============================================================================
|
|
65
|
+
# EAGERLY IMPORTED: Lightweight core modules
|
|
66
|
+
# These are always available and don't pull in heavy dependencies
|
|
67
|
+
# =============================================================================
|
|
68
|
+
|
|
69
|
+
# Chunkers - Base classes and factory (lightweight)
|
|
70
|
+
from .chunkers import (
|
|
71
|
+
ChunkingConfig,
|
|
72
|
+
ChunkingStrategy,
|
|
73
|
+
DocumentChunk,
|
|
74
|
+
create_chunker,
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Document Storage - Artifact storage managers
|
|
78
|
+
from .document_storage import (
|
|
79
|
+
FigureStorageManager,
|
|
80
|
+
ProcessedFigure,
|
|
81
|
+
StoredTable,
|
|
82
|
+
TableStorageManager,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
# Embedders - Base classes and factory (lightweight)
|
|
86
|
+
from .embedders import EmbeddingConfig, EmbeddingProvider, create_embedder
|
|
87
|
+
|
|
88
|
+
# Embedding pipelines - MongoDB workflows
|
|
89
|
+
from .embedding import MongoDBEmbeddingPipeline
|
|
90
|
+
from .embedding.specialized import (
|
|
91
|
+
create_ai_card_pipeline,
|
|
92
|
+
create_framework_pipeline,
|
|
93
|
+
create_manufacturer_card_pipeline,
|
|
94
|
+
create_usecase_pipeline,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Enrichers - Document enrichment components
|
|
98
|
+
from .enrichers import (
|
|
99
|
+
ConsolidatedTable,
|
|
100
|
+
DatasetCharacteristics,
|
|
101
|
+
DomainKnowledgeProvider,
|
|
102
|
+
ExtractedMetric,
|
|
103
|
+
ExtractedStudy,
|
|
104
|
+
MetricsExtractionResult,
|
|
105
|
+
MetricsExtractor,
|
|
106
|
+
PatientDemographics,
|
|
107
|
+
TableCandidate,
|
|
108
|
+
TableCategory,
|
|
109
|
+
TableClassifier,
|
|
110
|
+
TableConsolidator,
|
|
111
|
+
TrainingDataExtractor,
|
|
112
|
+
TrainingDataResult,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# External APIs - External data source clients
|
|
116
|
+
from .external_apis import (
|
|
117
|
+
APIProvider,
|
|
118
|
+
BaseAPIClient,
|
|
119
|
+
BaseAPIConfig,
|
|
120
|
+
OpenFDAClient,
|
|
121
|
+
OpenFDAConfig,
|
|
122
|
+
OpenFDAEndpoint,
|
|
123
|
+
create_api_client,
|
|
124
|
+
list_api_providers,
|
|
125
|
+
register_api_provider,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# GraphQL client
|
|
129
|
+
from .graphql.client import GraphQLClient
|
|
130
|
+
|
|
131
|
+
# LLM - Language model clients (lightweight, uses httpx)
|
|
132
|
+
from .llm import (
|
|
133
|
+
AzureOpenAIClient,
|
|
134
|
+
AzureOpenAIConfig,
|
|
135
|
+
BaseLLMClient,
|
|
136
|
+
LlamaCppClient,
|
|
137
|
+
LlamaCppConfig,
|
|
138
|
+
LLMAPIError,
|
|
139
|
+
LLMContextLengthError,
|
|
140
|
+
LLMError,
|
|
141
|
+
LLMMessage,
|
|
142
|
+
LLMRateLimitError,
|
|
143
|
+
LLMResponse,
|
|
144
|
+
OllamaClient,
|
|
145
|
+
OllamaConfig,
|
|
146
|
+
OpenAIClient,
|
|
147
|
+
OpenAIConfig,
|
|
148
|
+
TokenUsage,
|
|
149
|
+
create_llm_client,
|
|
150
|
+
get_config_class,
|
|
151
|
+
list_llm_providers,
|
|
152
|
+
register_llm_provider,
|
|
153
|
+
unregister_llm_provider,
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
# MCP Servers - Model Context Protocol servers
|
|
157
|
+
from .mcp_servers import (
|
|
158
|
+
BaseMCPServer,
|
|
159
|
+
MCPServerConfig,
|
|
160
|
+
OpenFDAMCPConfig,
|
|
161
|
+
OpenFDAMCPServer,
|
|
162
|
+
create_mcp_server,
|
|
163
|
+
list_mcp_servers,
|
|
164
|
+
register_mcp_server,
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
# Ontology - Term and ontology management
|
|
168
|
+
from .ontology import (
|
|
169
|
+
AshmaticsOntology,
|
|
170
|
+
BioPortalClient,
|
|
171
|
+
CategoryManager,
|
|
172
|
+
TermResolver,
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# Parsers - Base classes and factory (lightweight)
|
|
176
|
+
from .parsers import (
|
|
177
|
+
DocumentParser,
|
|
178
|
+
FigureData,
|
|
179
|
+
ParsedDocument,
|
|
180
|
+
ParsedSection,
|
|
181
|
+
ParseError,
|
|
182
|
+
ParserCapabilities,
|
|
183
|
+
ParserConfig,
|
|
184
|
+
ParserType,
|
|
185
|
+
TableData,
|
|
186
|
+
create_parser,
|
|
187
|
+
get_available_parsers,
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
# Processors - Document processing base
|
|
191
|
+
from .processors.base import DocumentProcessor
|
|
192
|
+
|
|
193
|
+
# Storage - Cloud storage abstraction (lightweight)
|
|
194
|
+
from .storage import (
|
|
195
|
+
ADLSStorageClient,
|
|
196
|
+
AuthType,
|
|
197
|
+
MinIOStorageClient,
|
|
198
|
+
StorageClient,
|
|
199
|
+
StorageConfig,
|
|
200
|
+
StorageObject,
|
|
201
|
+
StorageProvider,
|
|
202
|
+
create_storage_client,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
# Utils
|
|
206
|
+
from .utils.export_utils import DataExporter
|
|
207
|
+
from .utils.import_utils import KBImporter
|
|
208
|
+
from .utils.schema_utils import SchemaInspector
|
|
209
|
+
|
|
210
|
+
# Vector stores - Base classes and factory (lightweight)
|
|
211
|
+
from .vector_stores import VectorStore, VectorStoreProvider, create_vector_store
|
|
212
|
+
from .vector_stores.base import (
|
|
213
|
+
DistanceMetric,
|
|
214
|
+
IndexInfo,
|
|
215
|
+
IndexType,
|
|
216
|
+
SearchResult,
|
|
217
|
+
VectorStoreConfig,
|
|
218
|
+
)
|
|
219
|
+
|
|
220
|
+
__all__ = [
|
|
221
|
+
# Version
|
|
222
|
+
"__version__",
|
|
223
|
+
# Core utilities
|
|
224
|
+
"KBImporter",
|
|
225
|
+
"DataExporter",
|
|
226
|
+
"SchemaInspector",
|
|
227
|
+
"GraphQLClient",
|
|
228
|
+
"DocumentProcessor",
|
|
229
|
+
# Parsers - Base/Factory (always available)
|
|
230
|
+
"create_parser",
|
|
231
|
+
"get_available_parsers",
|
|
232
|
+
"DocumentParser",
|
|
233
|
+
"ParsedDocument",
|
|
234
|
+
"ParsedSection",
|
|
235
|
+
"TableData",
|
|
236
|
+
"FigureData",
|
|
237
|
+
"ParserConfig",
|
|
238
|
+
"ParserType",
|
|
239
|
+
"ParseError",
|
|
240
|
+
"ParserCapabilities",
|
|
241
|
+
# Parsers - Implementations (lazy loaded)
|
|
242
|
+
"SimpleParser",
|
|
243
|
+
"DoclingParser",
|
|
244
|
+
"LlamaParser",
|
|
245
|
+
# Chunkers - Base/Factory (always available)
|
|
246
|
+
"create_chunker",
|
|
247
|
+
"ChunkingConfig",
|
|
248
|
+
"ChunkingStrategy",
|
|
249
|
+
"DocumentChunk",
|
|
250
|
+
# Chunkers - Implementations (lazy loaded)
|
|
251
|
+
"SimpleChunker",
|
|
252
|
+
"AzureChunker",
|
|
253
|
+
"DoclingChunker",
|
|
254
|
+
# Embedders - Base/Factory (always available)
|
|
255
|
+
"create_embedder",
|
|
256
|
+
"EmbeddingConfig",
|
|
257
|
+
"EmbeddingProvider",
|
|
258
|
+
# Embedders - Implementations (lazy loaded)
|
|
259
|
+
"AzureEmbedder",
|
|
260
|
+
"OpenAIEmbedder",
|
|
261
|
+
# Embedding pipelines
|
|
262
|
+
"MongoDBEmbeddingPipeline",
|
|
263
|
+
"create_framework_pipeline",
|
|
264
|
+
"create_usecase_pipeline",
|
|
265
|
+
"create_ai_card_pipeline",
|
|
266
|
+
"create_manufacturer_card_pipeline",
|
|
267
|
+
# Vector stores - Base/Factory (always available)
|
|
268
|
+
"create_vector_store",
|
|
269
|
+
"VectorStore",
|
|
270
|
+
"VectorStoreProvider",
|
|
271
|
+
"VectorStoreConfig",
|
|
272
|
+
"SearchResult",
|
|
273
|
+
"IndexInfo",
|
|
274
|
+
"DistanceMetric",
|
|
275
|
+
"IndexType",
|
|
276
|
+
# Vector stores - Implementations (lazy loaded)
|
|
277
|
+
"VectorIndexManager",
|
|
278
|
+
"VectorCollectionStats",
|
|
279
|
+
"CosmosDBVectorStore",
|
|
280
|
+
"PgVectorStore",
|
|
281
|
+
"QdrantVectorStore",
|
|
282
|
+
# Storage
|
|
283
|
+
"create_storage_client",
|
|
284
|
+
"StorageClient",
|
|
285
|
+
"StorageConfig",
|
|
286
|
+
"StorageObject",
|
|
287
|
+
"StorageProvider",
|
|
288
|
+
"AuthType",
|
|
289
|
+
"ADLSStorageClient",
|
|
290
|
+
"MinIOStorageClient",
|
|
291
|
+
# LLM
|
|
292
|
+
"create_llm_client",
|
|
293
|
+
"register_llm_provider",
|
|
294
|
+
"unregister_llm_provider",
|
|
295
|
+
"list_llm_providers",
|
|
296
|
+
"get_config_class",
|
|
297
|
+
"BaseLLMClient",
|
|
298
|
+
"LLMMessage",
|
|
299
|
+
"LLMResponse",
|
|
300
|
+
"TokenUsage",
|
|
301
|
+
"LLMError",
|
|
302
|
+
"LLMAPIError",
|
|
303
|
+
"LLMRateLimitError",
|
|
304
|
+
"LLMContextLengthError",
|
|
305
|
+
"AzureOpenAIClient",
|
|
306
|
+
"AzureOpenAIConfig",
|
|
307
|
+
"OpenAIClient",
|
|
308
|
+
"OpenAIConfig",
|
|
309
|
+
"OllamaClient",
|
|
310
|
+
"OllamaConfig",
|
|
311
|
+
"LlamaCppClient",
|
|
312
|
+
"LlamaCppConfig",
|
|
313
|
+
# Ontology
|
|
314
|
+
"TermResolver",
|
|
315
|
+
"CategoryManager",
|
|
316
|
+
"BioPortalClient",
|
|
317
|
+
"AshmaticsOntology",
|
|
318
|
+
# External APIs
|
|
319
|
+
"create_api_client",
|
|
320
|
+
"list_api_providers",
|
|
321
|
+
"register_api_provider",
|
|
322
|
+
"BaseAPIClient",
|
|
323
|
+
"BaseAPIConfig",
|
|
324
|
+
"APIProvider",
|
|
325
|
+
"OpenFDAClient",
|
|
326
|
+
"OpenFDAConfig",
|
|
327
|
+
"OpenFDAEndpoint",
|
|
328
|
+
# MCP Servers
|
|
329
|
+
"create_mcp_server",
|
|
330
|
+
"list_mcp_servers",
|
|
331
|
+
"register_mcp_server",
|
|
332
|
+
"BaseMCPServer",
|
|
333
|
+
"MCPServerConfig",
|
|
334
|
+
"OpenFDAMCPServer",
|
|
335
|
+
"OpenFDAMCPConfig",
|
|
336
|
+
# Enrichers
|
|
337
|
+
"TableClassifier",
|
|
338
|
+
"TableCategory",
|
|
339
|
+
"TableConsolidator",
|
|
340
|
+
"TableCandidate",
|
|
341
|
+
"ConsolidatedTable",
|
|
342
|
+
"MetricsExtractor",
|
|
343
|
+
"MetricsExtractionResult",
|
|
344
|
+
"ExtractedMetric",
|
|
345
|
+
"ExtractedStudy",
|
|
346
|
+
"DomainKnowledgeProvider",
|
|
347
|
+
"TrainingDataExtractor",
|
|
348
|
+
"TrainingDataResult",
|
|
349
|
+
"DatasetCharacteristics",
|
|
350
|
+
"PatientDemographics",
|
|
351
|
+
# Document Storage
|
|
352
|
+
"FigureStorageManager",
|
|
353
|
+
"ProcessedFigure",
|
|
354
|
+
"TableStorageManager",
|
|
355
|
+
"StoredTable",
|
|
356
|
+
]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""Document chunking utilities with pluggable chunker implementations.
|
|
2
|
+
|
|
3
|
+
This module provides abstract base classes and concrete implementations for
|
|
4
|
+
chunking documents into smaller pieces suitable for embedding and retrieval.
|
|
5
|
+
|
|
6
|
+
Supported Chunkers:
|
|
7
|
+
- DoclingChunker: Uses Docling's HybridChunker for token-aware semantic chunking
|
|
8
|
+
- SimpleChunker: Basic paragraph-based chunking without Docling dependency
|
|
9
|
+
- FixedSizeChunker: Simple fixed-size chunking with overlap
|
|
10
|
+
- AzureChunker: Azure-compatible chunker with tiktoken and multiple strategies
|
|
11
|
+
|
|
12
|
+
Usage:
|
|
13
|
+
from common.chunkers import create_chunker, ChunkingConfig
|
|
14
|
+
|
|
15
|
+
# Create a chunker
|
|
16
|
+
config = ChunkingConfig(max_tokens=512, use_semantic_splitting=True)
|
|
17
|
+
chunker = create_chunker(config)
|
|
18
|
+
|
|
19
|
+
# Chunk a document
|
|
20
|
+
chunks = await chunker.chunk_document(
|
|
21
|
+
content=markdown_text,
|
|
22
|
+
title="Document Title",
|
|
23
|
+
source="document.pdf"
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
Copyright (c) 2025 Asher Informatics PBC. All Rights Reserved.
|
|
27
|
+
See LICENSE file for full license details.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
from .base import (
|
|
31
|
+
ChunkingConfig,
|
|
32
|
+
ChunkingStrategy,
|
|
33
|
+
DocumentChunk,
|
|
34
|
+
)
|
|
35
|
+
from .factory import create_chunker
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"ChunkingConfig",
|
|
39
|
+
"DocumentChunk",
|
|
40
|
+
"ChunkingStrategy",
|
|
41
|
+
"create_chunker",
|
|
42
|
+
]
|