promptev-context-engine 0.0.1__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.
- context_engine/__init__.py +147 -0
- context_engine/actions.py +892 -0
- context_engine/chunkers.py +860 -0
- context_engine/cli.py +459 -0
- context_engine/compression.py +1688 -0
- context_engine/config.py +207 -0
- context_engine/crypto.py +67 -0
- context_engine/db.py +44 -0
- context_engine/diagnostics.py +445 -0
- context_engine/django_router.py +157 -0
- context_engine/engine.py +1049 -0
- context_engine/errors.py +27 -0
- context_engine/extraction/__init__.py +305 -0
- context_engine/extraction/_json.py +54 -0
- context_engine/extraction/files.py +314 -0
- context_engine/extraction/ocr.py +533 -0
- context_engine/extraction/pdf.py +305 -0
- context_engine/extraction/pdf_structure.py +120 -0
- context_engine/extraction/vision.py +761 -0
- context_engine/flask_router.py +166 -0
- context_engine/fusion.py +71 -0
- context_engine/graph/__init__.py +89 -0
- context_engine/graph/communities.py +319 -0
- context_engine/graph/entities.py +415 -0
- context_engine/graph/neo4j_client.py +376 -0
- context_engine/graph/retrieval.py +428 -0
- context_engine/graph/schema.py +48 -0
- context_engine/graph/stage.py +67 -0
- context_engine/hooks.py +92 -0
- context_engine/ingest.py +1905 -0
- context_engine/mcp_server.py +214 -0
- context_engine/migrations/__init__.py +0 -0
- context_engine/migrations/env.py +71 -0
- context_engine/migrations/script.py.mako +28 -0
- context_engine/migrations/versions/0001_initial.py +338 -0
- context_engine/migrations/versions/0002_graph.py +168 -0
- context_engine/migrations/versions/0003_tools.py +161 -0
- context_engine/migrations/versions/0004_acl_indexes.py +59 -0
- context_engine/migrations/versions/__init__.py +0 -0
- context_engine/models.py +330 -0
- context_engine/providers/__init__.py +14 -0
- context_engine/providers/batch.py +139 -0
- context_engine/providers/embeddings.py +230 -0
- context_engine/providers/llm.py +472 -0
- context_engine/providers/reranker.py +128 -0
- context_engine/py.typed +0 -0
- context_engine/redaction.py +459 -0
- context_engine/redaction_presidio.py +153 -0
- context_engine/router.py +194 -0
- context_engine/routing_core.py +416 -0
- context_engine/runner.py +113 -0
- context_engine/sandbox.py +875 -0
- context_engine/search.py +646 -0
- context_engine/sentinels.py +53 -0
- context_engine/skills/context-engine/SKILL.md +175 -0
- context_engine/storage.py +840 -0
- context_engine/structured.py +761 -0
- context_engine/text.py +473 -0
- context_engine/tools/__init__.py +10 -0
- context_engine/tools/acl.py +38 -0
- context_engine/tools/approval.py +704 -0
- context_engine/tools/audit.py +263 -0
- context_engine/tools/config.py +295 -0
- context_engine/tools/crypto.py +3 -0
- context_engine/tools/egress.py +207 -0
- context_engine/tools/executors/__init__.py +9 -0
- context_engine/tools/executors/db.py +557 -0
- context_engine/tools/executors/function.py +106 -0
- context_engine/tools/executors/http.py +327 -0
- context_engine/tools/executors/mcp_client.py +745 -0
- context_engine/tools/governance.py +1237 -0
- context_engine/tools/mcp_oauth.py +697 -0
- context_engine/tools/mcp_tools.py +175 -0
- context_engine/tools/models.py +187 -0
- context_engine/tools/registry.py +195 -0
- context_engine/tools/router.py +878 -0
- context_engine/usage.py +124 -0
- context_engine/version.py +1 -0
- promptev_context_engine-0.0.1.dist-info/METADATA +674 -0
- promptev_context_engine-0.0.1.dist-info/RECORD +84 -0
- promptev_context_engine-0.0.1.dist-info/WHEEL +4 -0
- promptev_context_engine-0.0.1.dist-info/entry_points.txt +2 -0
- promptev_context_engine-0.0.1.dist-info/licenses/LICENSE.md +202 -0
- promptev_context_engine-0.0.1.dist-info/licenses/NOTICE +17 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
from context_engine.actions import compute, get_document_text, list_documents, query_structured
|
|
2
|
+
from context_engine.config import (
|
|
3
|
+
ContextEngineConfig,
|
|
4
|
+
EmbeddingConfig,
|
|
5
|
+
ExtractionConfig,
|
|
6
|
+
FusionConfig,
|
|
7
|
+
GraphConfig,
|
|
8
|
+
LLMConfig,
|
|
9
|
+
RerankerConfig,
|
|
10
|
+
StorageConfig,
|
|
11
|
+
)
|
|
12
|
+
from context_engine.crypto import decrypt_dict, encrypt_dict, get_secret_key
|
|
13
|
+
from context_engine.engine import TRUSTED, UNSET, ContextEngine
|
|
14
|
+
from context_engine.errors import EngineActionError
|
|
15
|
+
from context_engine.extraction import Extracted, extract
|
|
16
|
+
from context_engine.fusion import rrf_fuse
|
|
17
|
+
from context_engine.hooks import Hooks, emit_error, emit_progress, emit_usage
|
|
18
|
+
from context_engine.mcp_server import create_mcp_app
|
|
19
|
+
from context_engine.providers import (
|
|
20
|
+
Embedder,
|
|
21
|
+
LLMClient,
|
|
22
|
+
build_embedder,
|
|
23
|
+
build_llm_client,
|
|
24
|
+
call_llm,
|
|
25
|
+
rerank,
|
|
26
|
+
)
|
|
27
|
+
from context_engine.redaction import RedactionPolicy, RedactionRule, apply_redaction
|
|
28
|
+
from context_engine.search import GraphLegUnavailable, Hit, SearchResult, run_search
|
|
29
|
+
from context_engine.storage import ChunkRow, PostgresBackend, SearchScope, StorageBackend
|
|
30
|
+
from context_engine.structured import (
|
|
31
|
+
ExtractionResult,
|
|
32
|
+
extract_structured_data,
|
|
33
|
+
resolve_fields,
|
|
34
|
+
upsert_registry,
|
|
35
|
+
)
|
|
36
|
+
from context_engine.tools.approval import (
|
|
37
|
+
ApprovalExpired,
|
|
38
|
+
ApprovalNotPending,
|
|
39
|
+
ApprovalRecord,
|
|
40
|
+
resolve_approval,
|
|
41
|
+
)
|
|
42
|
+
from context_engine.tools.config import ToolConfig, ToolKind, config_schema
|
|
43
|
+
from context_engine.usage import (
|
|
44
|
+
DocumentReport,
|
|
45
|
+
IngestReport,
|
|
46
|
+
UsageEvent,
|
|
47
|
+
graph_units,
|
|
48
|
+
units_for_file,
|
|
49
|
+
)
|
|
50
|
+
from context_engine.version import __version__
|
|
51
|
+
|
|
52
|
+
__all__ = [
|
|
53
|
+
"TRUSTED",
|
|
54
|
+
"UNSET",
|
|
55
|
+
"ApprovalExpired",
|
|
56
|
+
"ApprovalNotPending",
|
|
57
|
+
"ApprovalRecord",
|
|
58
|
+
"ChunkRow",
|
|
59
|
+
"ContextEngine",
|
|
60
|
+
"ContextEngineConfig",
|
|
61
|
+
"DocumentReport",
|
|
62
|
+
"Embedder",
|
|
63
|
+
"EmbeddingConfig",
|
|
64
|
+
"EngineActionError",
|
|
65
|
+
"Extracted",
|
|
66
|
+
"ExtractionConfig",
|
|
67
|
+
"ExtractionResult",
|
|
68
|
+
"FusionConfig",
|
|
69
|
+
"GraphConfig",
|
|
70
|
+
"GraphLegUnavailable",
|
|
71
|
+
"Hit",
|
|
72
|
+
"Hooks",
|
|
73
|
+
"IngestReport",
|
|
74
|
+
"LLMClient",
|
|
75
|
+
"LLMConfig",
|
|
76
|
+
"PostgresBackend",
|
|
77
|
+
"RedactionPolicy",
|
|
78
|
+
"RedactionRule",
|
|
79
|
+
"RerankerConfig",
|
|
80
|
+
"SearchResult",
|
|
81
|
+
"SearchScope",
|
|
82
|
+
"StorageBackend",
|
|
83
|
+
"StorageConfig",
|
|
84
|
+
"ToolConfig",
|
|
85
|
+
"ToolKind",
|
|
86
|
+
"UsageEvent",
|
|
87
|
+
"__version__",
|
|
88
|
+
"apply_redaction",
|
|
89
|
+
"build_embedder",
|
|
90
|
+
"build_llm_client",
|
|
91
|
+
"call_llm",
|
|
92
|
+
"compute",
|
|
93
|
+
"config_schema",
|
|
94
|
+
"create_django_urlpatterns",
|
|
95
|
+
"create_flask_blueprint",
|
|
96
|
+
"create_mcp_app",
|
|
97
|
+
"create_router",
|
|
98
|
+
"create_tools_router",
|
|
99
|
+
"decrypt_dict",
|
|
100
|
+
"emit_error",
|
|
101
|
+
"emit_progress",
|
|
102
|
+
"emit_usage",
|
|
103
|
+
"encrypt_dict",
|
|
104
|
+
"extract",
|
|
105
|
+
"extract_structured_data",
|
|
106
|
+
"get_document_text",
|
|
107
|
+
"get_secret_key",
|
|
108
|
+
"graph_units",
|
|
109
|
+
"list_documents",
|
|
110
|
+
"presidio_detector",
|
|
111
|
+
"presidio_detectors",
|
|
112
|
+
"query_structured",
|
|
113
|
+
"rerank",
|
|
114
|
+
"resolve_approval",
|
|
115
|
+
"resolve_fields",
|
|
116
|
+
"rrf_fuse",
|
|
117
|
+
"run_search",
|
|
118
|
+
"units_for_file",
|
|
119
|
+
"upsert_registry",
|
|
120
|
+
]
|
|
121
|
+
|
|
122
|
+
# The web-framework router factories are loaded lazily so that `import
|
|
123
|
+
# context_engine` — and `context-engine migrate`, and any Flask/Django/CLI
|
|
124
|
+
# consumer of the core engine — never imports FastAPI/Flask/Django. Each is
|
|
125
|
+
# pulled in only when the attribute is actually accessed; the underlying
|
|
126
|
+
# module's `_require_*()` guard raises an actionable ImportError if the
|
|
127
|
+
# matching optional extra isn't installed.
|
|
128
|
+
_LAZY_FACTORIES = {
|
|
129
|
+
"create_router": ("context_engine.router", "create_router"),
|
|
130
|
+
"create_tools_router": ("context_engine.tools.router", "create_tools_router"),
|
|
131
|
+
"create_flask_blueprint": ("context_engine.flask_router", "create_flask_blueprint"),
|
|
132
|
+
"create_django_urlpatterns": ("context_engine.django_router", "create_django_urlpatterns"),
|
|
133
|
+
# Presidio adapter — lazy for the same reason: importing it must not pull
|
|
134
|
+
# `presidio_analyzer` (or its spaCy model) into a process that never uses it.
|
|
135
|
+
"presidio_detector": ("context_engine.redaction_presidio", "presidio_detector"),
|
|
136
|
+
"presidio_detectors": ("context_engine.redaction_presidio", "presidio_detectors"),
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def __getattr__(name: str):
|
|
141
|
+
target = _LAZY_FACTORIES.get(name)
|
|
142
|
+
if target is None:
|
|
143
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
144
|
+
import importlib
|
|
145
|
+
|
|
146
|
+
module, attr = target
|
|
147
|
+
return getattr(importlib.import_module(module), attr)
|