cocoindex 0.1.22__cp313-cp313-macosx_11_0_arm64.whl → 0.1.23__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.
Binary file
cocoindex/functions.py CHANGED
@@ -5,6 +5,9 @@ import sentence_transformers
5
5
  from .typing import Float32, Vector, TypeAttr
6
6
  from . import op, llm
7
7
 
8
+ class ParseJson(op.FunctionSpec):
9
+ """Parse a text into a JSON object."""
10
+
8
11
  class SplitRecursively(op.FunctionSpec):
9
12
  """Split a document (in string) recursively."""
10
13
 
cocoindex/storages.py CHANGED
@@ -29,7 +29,7 @@ class Neo4jConnection:
29
29
  db: str | None = None
30
30
 
31
31
  @dataclass
32
- class Neo4jFieldMapping:
32
+ class GraphFieldMapping:
33
33
  """Mapping for a Neo4j field."""
34
34
  field_name: str
35
35
  # Field name for the node in the Knowledge Graph.
@@ -37,36 +37,36 @@ class Neo4jFieldMapping:
37
37
  node_field_name: str | None = None
38
38
 
39
39
  @dataclass
40
- class Neo4jRelationshipEnd:
40
+ class GraphRelationshipEnd:
41
41
  """Spec for a Neo4j node type."""
42
42
  label: str
43
- fields: list[Neo4jFieldMapping]
43
+ fields: list[GraphFieldMapping]
44
44
 
45
45
  @dataclass
46
- class Neo4jRelationshipNode:
46
+ class GraphRelationshipNode:
47
47
  """Spec for a Neo4j node type."""
48
48
  primary_key_fields: Sequence[str]
49
49
  vector_indexes: Sequence[index.VectorIndexDef] = ()
50
50
 
51
51
  @dataclass
52
- class Neo4jNode:
52
+ class GraphNode:
53
53
  """Spec for a Neo4j node type."""
54
54
  kind = "Node"
55
55
 
56
56
  label: str
57
57
 
58
58
  @dataclass
59
- class Neo4jRelationship:
59
+ class GraphRelationship:
60
60
  """Spec for a Neo4j relationship."""
61
61
  kind = "Relationship"
62
62
 
63
63
  rel_type: str
64
- source: Neo4jRelationshipEnd
65
- target: Neo4jRelationshipEnd
66
- nodes: dict[str, Neo4jRelationshipNode] | None = None
64
+ source: GraphRelationshipEnd
65
+ target: GraphRelationshipEnd
66
+ nodes: dict[str, GraphRelationshipNode] | None = None
67
67
 
68
68
  class Neo4j(op.StorageSpec):
69
69
  """Graph storage powered by Neo4j."""
70
70
 
71
71
  connection: AuthEntryReference
72
- mapping: Neo4jNode | Neo4jRelationship
72
+ mapping: GraphNode | GraphRelationship
cocoindex/typing.py CHANGED
@@ -183,11 +183,7 @@ def _encode_type(type_info: AnalyzedTypeInfo) -> dict[str, Any]:
183
183
  if type_info.elem_type is None:
184
184
  raise ValueError(f"{type_info.kind} type must have an element type")
185
185
  row_type_info = analyze_type_info(type_info.elem_type)
186
- if row_type_info.dataclass_type is None:
187
- raise ValueError(f"{type_info.kind} type must have a dataclass type")
188
- encoded_type['row'] = {
189
- 'fields': _encode_fields_schema(row_type_info.dataclass_type),
190
- }
186
+ encoded_type['row'] = _encode_type(row_type_info)
191
187
 
192
188
  return encoded_type
193
189
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cocoindex
3
- Version: 0.1.22
3
+ Version: 0.1.23
4
4
  Requires-Dist: sentence-transformers>=3.3.1
5
5
  Requires-Dist: click>=8.1.8
6
6
  Requires-Dist: pytest ; extra == 'test'
@@ -1,7 +1,7 @@
1
- cocoindex-0.1.22.dist-info/METADATA,sha256=fF2xNGwxJBVg-npfcaYtCZ8mJujJe6kjDSMnwJ5-cIk,8066
2
- cocoindex-0.1.22.dist-info/WHEEL,sha256=_czbP61TsBkf9T201RekHMHlqESnWn7yJwXBJC9P-w0,104
3
- cocoindex-0.1.22.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
- cocoindex/functions.py,sha256=uukmig7qtOIda3lrM7tNSfGqx22e0EANfWWZjuhE_5E,1579
1
+ cocoindex-0.1.23.dist-info/METADATA,sha256=IcyNWcJi0ycAqXknL1KbV-tsNRQqNf3a097Xrpbe4g8,8066
2
+ cocoindex-0.1.23.dist-info/WHEEL,sha256=_czbP61TsBkf9T201RekHMHlqESnWn7yJwXBJC9P-w0,104
3
+ cocoindex-0.1.23.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
+ cocoindex/functions.py,sha256=xcAeRQTy9JObfxpjyMn-dPY2y7XhVWjB7759xVyup6o,1657
5
5
  cocoindex/query.py,sha256=XsVY5cBJJ3a70qazkcCHjWZLE1zBqzMQ4HVSulicGMA,3273
6
6
  cocoindex/index.py,sha256=LssEOuZi6AqhwKtZM3QFeQpa9T-0ELi8G5DsrYKECvc,534
7
7
  cocoindex/lib.py,sha256=kyfzkaanrMHVwWjd2UWgLr8ArS_vjlK64qb4TbNTbbs,3464
@@ -17,7 +17,7 @@ cocoindex/sources.py,sha256=wZFU8lwSXjyofJR-syySH9fTyPnBlAPJ6-1hQNX8fGA,936
17
17
  cocoindex/setup.py,sha256=W1HshwYk_K2aeLOVn_e62ZOXBO9yWsoUboRiH4SjF48,496
18
18
  cocoindex/cli.py,sha256=jRwGCPuqkBz_cIp7LKARCRAiDsPm91bsduKzfYJohJ4,6931
19
19
  cocoindex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- cocoindex/typing.py,sha256=EZstkCKOFTRST23ia8R8PV7rZbQiNWFblzzRIQ3vVcQ,7472
21
- cocoindex/storages.py,sha256=m6Y9-r1XgQClWUrI8a0VHd0X6ZMYDlchVJFwWew01_M,1718
22
- cocoindex/_engine.cpython-313-darwin.so,sha256=CbuA8iVnxo5lZvClKQgdp5La3kqlV8aNOQR6McV413k,58986432
23
- cocoindex-0.1.22.dist-info/RECORD,,
20
+ cocoindex/typing.py,sha256=4mP9VXS75s3VMfF1LDc1LXsBng7uGdR5aD73N8iaeSM,7282
21
+ cocoindex/storages.py,sha256=ZWpQABuUWTs6BdPcTBWDOiRXVGxS87Uh2i_C1wtkXYQ,1718
22
+ cocoindex/_engine.cpython-313-darwin.so,sha256=M2BCjW1OKxXPytPLWXhJBZio30rROEaj1Edt-z2tFIs,59027024
23
+ cocoindex-0.1.23.dist-info/RECORD,,