cocoindex 0.1.66__cp313-cp313-macosx_11_0_arm64.whl → 0.1.67__cp313-cp313-macosx_11_0_arm64.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/_engine.cpython-313-darwin.so +0 -0
- cocoindex/functions.py +7 -13
- {cocoindex-0.1.66.dist-info → cocoindex-0.1.67.dist-info}/METADATA +3 -1
- {cocoindex-0.1.66.dist-info → cocoindex-0.1.67.dist-info}/RECORD +7 -7
- {cocoindex-0.1.66.dist-info → cocoindex-0.1.67.dist-info}/WHEEL +0 -0
- {cocoindex-0.1.66.dist-info → cocoindex-0.1.67.dist-info}/entry_points.txt +0 -0
- {cocoindex-0.1.66.dist-info → cocoindex-0.1.67.dist-info}/licenses/LICENSE +0 -0
Binary file
|
cocoindex/functions.py
CHANGED
@@ -9,14 +9,6 @@ from numpy.typing import NDArray
|
|
9
9
|
from . import llm, op
|
10
10
|
from .typing import TypeAttr, Vector
|
11
11
|
|
12
|
-
# Check if sentence_transformers is available
|
13
|
-
try:
|
14
|
-
import sentence_transformers # type: ignore
|
15
|
-
|
16
|
-
_SENTENCE_TRANSFORMERS_AVAILABLE = True
|
17
|
-
except ImportError:
|
18
|
-
_SENTENCE_TRANSFORMERS_AVAILABLE = False
|
19
|
-
|
20
12
|
|
21
13
|
class ParseJson(op.FunctionSpec):
|
22
14
|
"""Parse a text into a JSON object."""
|
@@ -79,18 +71,19 @@ class SentenceTransformerEmbedExecutor:
|
|
79
71
|
"""Executor for SentenceTransformerEmbed."""
|
80
72
|
|
81
73
|
spec: SentenceTransformerEmbed
|
82
|
-
_model:
|
74
|
+
_model: Any | None = None
|
83
75
|
|
84
76
|
def analyze(self, text: Any) -> type:
|
85
|
-
|
77
|
+
try:
|
78
|
+
# Only import sentence_transformers locally when it's needed, as its import is very slow.
|
79
|
+
import sentence_transformers # pylint: disable=import-outside-toplevel
|
80
|
+
except ImportError as e:
|
86
81
|
raise ImportError(
|
87
82
|
"sentence_transformers is required for SentenceTransformerEmbed function. "
|
88
83
|
"Install it with one of these commands:\n"
|
89
84
|
" pip install 'cocoindex[embeddings]'\n"
|
90
85
|
" pip install sentence-transformers"
|
91
|
-
)
|
92
|
-
|
93
|
-
import sentence_transformers # pylint: disable=import-outside-toplevel
|
86
|
+
) from e
|
94
87
|
|
95
88
|
args = self.spec.args or {}
|
96
89
|
self._model = sentence_transformers.SentenceTransformer(self.spec.model, **args)
|
@@ -102,5 +95,6 @@ class SentenceTransformerEmbedExecutor:
|
|
102
95
|
return result
|
103
96
|
|
104
97
|
def __call__(self, text: str) -> NDArray[np.float32]:
|
98
|
+
assert self._model is not None
|
105
99
|
result: NDArray[np.float32] = self._model.encode(text, convert_to_numpy=True)
|
106
100
|
return result
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: cocoindex
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.67
|
4
4
|
Requires-Dist: click>=8.1.8
|
5
5
|
Requires-Dist: rich>=14.0.0
|
6
6
|
Requires-Dist: python-dotenv>=1.1.0
|
@@ -10,9 +10,11 @@ Requires-Dist: pytest ; extra == 'test'
|
|
10
10
|
Requires-Dist: ruff ; extra == 'dev'
|
11
11
|
Requires-Dist: pre-commit ; extra == 'dev'
|
12
12
|
Requires-Dist: sentence-transformers>=3.3.1 ; extra == 'embeddings'
|
13
|
+
Requires-Dist: cocoindex[embeddings] ; extra == 'all'
|
13
14
|
Provides-Extra: test
|
14
15
|
Provides-Extra: dev
|
15
16
|
Provides-Extra: embeddings
|
17
|
+
Provides-Extra: all
|
16
18
|
License-File: LICENSE
|
17
19
|
Summary: With CocoIndex, users declare the transformation, CocoIndex creates & maintains an index, and keeps the derived index up to date based on source update, with minimal computation and changes.
|
18
20
|
Author-email: CocoIndex <cocoindex.io@gmail.com>
|
@@ -1,14 +1,14 @@
|
|
1
|
-
cocoindex-0.1.
|
2
|
-
cocoindex-0.1.
|
3
|
-
cocoindex-0.1.
|
4
|
-
cocoindex-0.1.
|
1
|
+
cocoindex-0.1.67.dist-info/METADATA,sha256=SJIeiMwnbmOKiJSenH-DSoPatDM3bh6SD7B08GdI5Xs,10172
|
2
|
+
cocoindex-0.1.67.dist-info/WHEEL,sha256=ZlnHGE4Mo7ps1v16zvcAfrDnL3ds3Klm21sZZ52w3vY,104
|
3
|
+
cocoindex-0.1.67.dist-info/entry_points.txt,sha256=_NretjYVzBdNTn7dK-zgwr7YfG2afz1u1uSE-5bZXF8,46
|
4
|
+
cocoindex-0.1.67.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
5
5
|
cocoindex/__init__.py,sha256=nr-W-LX0e9EX6ZVMbf0MRF0EhtntqADOdwc9F2nwfWw,2004
|
6
|
-
cocoindex/_engine.cpython-313-darwin.so,sha256=
|
6
|
+
cocoindex/_engine.cpython-313-darwin.so,sha256=ADERPLopodjUBwfyjAXUqTXkgP0KDUCAq-tHeFquXXY,61479024
|
7
7
|
cocoindex/auth_registry.py,sha256=1XqO7ibjmBBd8i11XSJTvTgdz8p1ptW-ZpuSgo_5zzk,716
|
8
8
|
cocoindex/cli.py,sha256=-gp639JSyQN6YjnhGqCakIzYoSSqXxQMbxbkcYGP0QY,22359
|
9
9
|
cocoindex/convert.py,sha256=RYfRUungabr-dHakG4k2kDvYambxHFljAmTuPQeQths,13117
|
10
10
|
cocoindex/flow.py,sha256=MFPtfJBVTjQ56d7vUn2LvtY30Vg4q2rY6nqvjjJL1kQ,35085
|
11
|
-
cocoindex/functions.py,sha256=
|
11
|
+
cocoindex/functions.py,sha256=Ih1rtaTvZzQ2wucCOSpzSUu2-eu0mgtBVi1mh9M-Buw,3162
|
12
12
|
cocoindex/index.py,sha256=j93B9jEvvLXHtpzKWL88SY6wCGEoPgpsQhEGHlyYGFg,540
|
13
13
|
cocoindex/lib.py,sha256=f--9dAYd84CZosbDZqNW0oGbBLsY3dXiUTR1VrfQ_QY,817
|
14
14
|
cocoindex/llm.py,sha256=WxmWUbNcf9HOCM5xkbDeFs9lF67M3mr810B7deDDc-8,673
|
@@ -25,4 +25,4 @@ cocoindex/tests/test_optional_database.py,sha256=snAmkNa6wtOSaxoZE1HgjvL5v_ylitt
|
|
25
25
|
cocoindex/tests/test_typing.py,sha256=NB4nUzoumOF_wGFa4D2Xf6d0bUVtOiSXyb78M1pYSG4,14827
|
26
26
|
cocoindex/typing.py,sha256=MO9HkrNpargvMPvpkd7jgSu2R-21KE_NaB9-WI4YOZA,13241
|
27
27
|
cocoindex/utils.py,sha256=hUhX-XV6XGCtJSEIpBOuDv6VvqImwPlgBxztBTw7u0U,598
|
28
|
-
cocoindex-0.1.
|
28
|
+
cocoindex-0.1.67.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|