cocoindex 0.3.4__cp311-abi3-manylinux_2_28_x86_64.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.
- cocoindex/__init__.py +114 -0
- cocoindex/_engine.abi3.so +0 -0
- cocoindex/auth_registry.py +44 -0
- cocoindex/cli.py +830 -0
- cocoindex/engine_object.py +214 -0
- cocoindex/engine_value.py +550 -0
- cocoindex/flow.py +1281 -0
- cocoindex/functions/__init__.py +40 -0
- cocoindex/functions/_engine_builtin_specs.py +66 -0
- cocoindex/functions/colpali.py +247 -0
- cocoindex/functions/sbert.py +77 -0
- cocoindex/index.py +50 -0
- cocoindex/lib.py +75 -0
- cocoindex/llm.py +47 -0
- cocoindex/op.py +1047 -0
- cocoindex/py.typed +0 -0
- cocoindex/query_handler.py +57 -0
- cocoindex/runtime.py +78 -0
- cocoindex/setting.py +171 -0
- cocoindex/setup.py +92 -0
- cocoindex/sources/__init__.py +5 -0
- cocoindex/sources/_engine_builtin_specs.py +120 -0
- cocoindex/subprocess_exec.py +277 -0
- cocoindex/targets/__init__.py +5 -0
- cocoindex/targets/_engine_builtin_specs.py +153 -0
- cocoindex/targets/lancedb.py +466 -0
- cocoindex/tests/__init__.py +0 -0
- cocoindex/tests/test_engine_object.py +331 -0
- cocoindex/tests/test_engine_value.py +1724 -0
- cocoindex/tests/test_optional_database.py +249 -0
- cocoindex/tests/test_transform_flow.py +300 -0
- cocoindex/tests/test_typing.py +553 -0
- cocoindex/tests/test_validation.py +134 -0
- cocoindex/typing.py +834 -0
- cocoindex/user_app_loader.py +53 -0
- cocoindex/utils.py +20 -0
- cocoindex/validation.py +104 -0
- cocoindex-0.3.4.dist-info/METADATA +288 -0
- cocoindex-0.3.4.dist-info/RECORD +42 -0
- cocoindex-0.3.4.dist-info/WHEEL +4 -0
- cocoindex-0.3.4.dist-info/entry_points.txt +2 -0
- cocoindex-0.3.4.dist-info/licenses/THIRD_PARTY_NOTICES.html +13249 -0
cocoindex/__init__.py
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Cocoindex is a framework for building and running indexing pipelines.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from . import _engine # type: ignore
|
|
6
|
+
from . import functions, sources, targets, cli, utils
|
|
7
|
+
|
|
8
|
+
from . import targets as storages # Deprecated: Use targets instead
|
|
9
|
+
|
|
10
|
+
from .auth_registry import (
|
|
11
|
+
AuthEntryReference,
|
|
12
|
+
add_auth_entry,
|
|
13
|
+
add_transient_auth_entry,
|
|
14
|
+
ref_auth_entry,
|
|
15
|
+
)
|
|
16
|
+
from .flow import FlowBuilder, DataScope, DataSlice, Flow, transform_flow
|
|
17
|
+
from .flow import flow_def
|
|
18
|
+
from .flow import EvaluateAndDumpOptions, GeneratedField
|
|
19
|
+
from .flow import FlowLiveUpdater, FlowLiveUpdaterOptions, FlowUpdaterStatusUpdates
|
|
20
|
+
from .flow import open_flow
|
|
21
|
+
from .flow import add_flow_def, remove_flow # DEPRECATED
|
|
22
|
+
from .flow import update_all_flows_async, setup_all_flows, drop_all_flows
|
|
23
|
+
from .lib import settings, init, start_server, stop
|
|
24
|
+
from .llm import LlmSpec, LlmApiType
|
|
25
|
+
from .index import (
|
|
26
|
+
VectorSimilarityMetric,
|
|
27
|
+
VectorIndexDef,
|
|
28
|
+
IndexOptions,
|
|
29
|
+
HnswVectorIndexMethod,
|
|
30
|
+
IvfFlatVectorIndexMethod,
|
|
31
|
+
)
|
|
32
|
+
from .setting import DatabaseConnectionSpec, Settings, ServerSettings
|
|
33
|
+
from .setting import get_app_namespace
|
|
34
|
+
from .query_handler import QueryHandlerResultFields, QueryInfo, QueryOutput
|
|
35
|
+
from .typing import (
|
|
36
|
+
Int64,
|
|
37
|
+
Float32,
|
|
38
|
+
Float64,
|
|
39
|
+
LocalDateTime,
|
|
40
|
+
OffsetDateTime,
|
|
41
|
+
Range,
|
|
42
|
+
Vector,
|
|
43
|
+
Json,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
_engine.init_pyo3_runtime()
|
|
47
|
+
|
|
48
|
+
__all__ = [
|
|
49
|
+
# Submodules
|
|
50
|
+
"_engine",
|
|
51
|
+
"functions",
|
|
52
|
+
"llm",
|
|
53
|
+
"sources",
|
|
54
|
+
"targets",
|
|
55
|
+
"storages",
|
|
56
|
+
"cli",
|
|
57
|
+
"op",
|
|
58
|
+
"utils",
|
|
59
|
+
# Auth registry
|
|
60
|
+
"AuthEntryReference",
|
|
61
|
+
"add_auth_entry",
|
|
62
|
+
"add_transient_auth_entry",
|
|
63
|
+
"ref_auth_entry",
|
|
64
|
+
# Flow
|
|
65
|
+
"FlowBuilder",
|
|
66
|
+
"DataScope",
|
|
67
|
+
"DataSlice",
|
|
68
|
+
"Flow",
|
|
69
|
+
"transform_flow",
|
|
70
|
+
"flow_def",
|
|
71
|
+
"EvaluateAndDumpOptions",
|
|
72
|
+
"GeneratedField",
|
|
73
|
+
"FlowLiveUpdater",
|
|
74
|
+
"FlowLiveUpdaterOptions",
|
|
75
|
+
"FlowUpdaterStatusUpdates",
|
|
76
|
+
"open_flow",
|
|
77
|
+
"add_flow_def", # DEPRECATED
|
|
78
|
+
"remove_flow", # DEPRECATED
|
|
79
|
+
"update_all_flows_async",
|
|
80
|
+
"setup_all_flows",
|
|
81
|
+
"drop_all_flows",
|
|
82
|
+
# Lib
|
|
83
|
+
"settings",
|
|
84
|
+
"init",
|
|
85
|
+
"start_server",
|
|
86
|
+
"stop",
|
|
87
|
+
# LLM
|
|
88
|
+
"LlmSpec",
|
|
89
|
+
"LlmApiType",
|
|
90
|
+
# Index
|
|
91
|
+
"VectorSimilarityMetric",
|
|
92
|
+
"VectorIndexDef",
|
|
93
|
+
"IndexOptions",
|
|
94
|
+
"HnswVectorIndexMethod",
|
|
95
|
+
"IvfFlatVectorIndexMethod",
|
|
96
|
+
# Settings
|
|
97
|
+
"DatabaseConnectionSpec",
|
|
98
|
+
"Settings",
|
|
99
|
+
"ServerSettings",
|
|
100
|
+
"get_app_namespace",
|
|
101
|
+
# Typing
|
|
102
|
+
"Int64",
|
|
103
|
+
"Float32",
|
|
104
|
+
"Float64",
|
|
105
|
+
"LocalDateTime",
|
|
106
|
+
"OffsetDateTime",
|
|
107
|
+
"Range",
|
|
108
|
+
"Vector",
|
|
109
|
+
"Json",
|
|
110
|
+
# Query handler
|
|
111
|
+
"QueryHandlerResultFields",
|
|
112
|
+
"QueryInfo",
|
|
113
|
+
"QueryOutput",
|
|
114
|
+
]
|
|
Binary file
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Auth registry is used to register and reference auth entries.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from typing import Generic, TypeVar
|
|
7
|
+
|
|
8
|
+
from . import _engine # type: ignore
|
|
9
|
+
from .engine_object import dump_engine_object, load_engine_object
|
|
10
|
+
|
|
11
|
+
T = TypeVar("T")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class TransientAuthEntryReference(Generic[T]):
|
|
16
|
+
"""Reference an auth entry, may or may not have a stable key."""
|
|
17
|
+
|
|
18
|
+
key: str
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class AuthEntryReference(TransientAuthEntryReference[T]):
|
|
22
|
+
"""Reference an auth entry, with a key stable across ."""
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def add_transient_auth_entry(value: T) -> TransientAuthEntryReference[T]:
|
|
26
|
+
"""Add an auth entry to the registry. Returns its reference."""
|
|
27
|
+
key = _engine.add_transient_auth_entry(dump_engine_object(value))
|
|
28
|
+
return TransientAuthEntryReference(key)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def add_auth_entry(key: str, value: T) -> AuthEntryReference[T]:
|
|
32
|
+
"""Add an auth entry to the registry. Returns its reference."""
|
|
33
|
+
_engine.add_auth_entry(key, dump_engine_object(value))
|
|
34
|
+
return AuthEntryReference(key)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def ref_auth_entry(key: str) -> AuthEntryReference[T]:
|
|
38
|
+
"""Reference an auth entry by its key."""
|
|
39
|
+
return AuthEntryReference(key)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def get_auth_entry(cls: type[T], ref: TransientAuthEntryReference[T]) -> T:
|
|
43
|
+
"""Get an auth entry by its key."""
|
|
44
|
+
return load_engine_object(cls, _engine.get_auth_entry(ref.key))
|