Skip to content

Commit cbfd83d

Browse files
committed
Add materialization_embeddings option to MaterializationOptions and MaterializeRequest
- Introduced a new boolean field `materialize_embeddings` in `MaterializationOptions` to control the inclusion of embedding columns during materialization. - Updated `MaterializeRequest` to support the new `materialize_embeddings` field, allowing for the creation of HNSW vector indexes in the graph database when set to true. - Adjusted the `to_dict` and `from_dict` methods in `MaterializeRequest` to handle the new field appropriately. These changes enhance the materialization process by providing more control over embedding data handling.
1 parent e2ee130 commit cbfd83d

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎robosystems_client/extensions/materialization_client.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class MaterializationOptions:
2727
ignore_errors: bool = True
2828
rebuild: bool = False
2929
force: bool = False
30+
materialize_embeddings: bool = False
3031
on_progress: Optional[Callable[[str], None]] = None
3132
timeout: Optional[int] = 600 # 10 minute default timeout
3233

@@ -112,6 +113,7 @@ def materialize(
112113
ignore_errors=options.ignore_errors,
113114
rebuild=options.rebuild,
114115
force=options.force,
116+
materialize_embeddings=options.materialize_embeddings,
115117
)
116118

117119
from ..client import AuthenticatedClient

‎robosystems_client/models/materialize_request.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@ class MaterializeRequest:
2222
source (None | str | Unset): Data source for materialization. Auto-detected from graph type if not specified.
2323
'staged' materializes from uploaded files (generic graphs). 'extensions' materializes from the extensions OLTP
2424
database (entity graphs).
25+
materialize_embeddings (bool | Unset): Include embedding columns in materialization and build HNSW vector
26+
indexes in the graph database. When false (default), embedding columns are NULLed out to save space. Set to true
27+
for graphs that need vector search. Default: False.
2528
"""
2629

2730
force: bool | Unset = False
2831
rebuild: bool | Unset = False
2932
ignore_errors: bool | Unset = True
3033
dry_run: bool | Unset = False
3134
source: None | str | Unset = UNSET
35+
materialize_embeddings: bool | Unset = False
3236

3337
def to_dict(self) -> dict[str, Any]:
3438
force = self.force
@@ -45,6 +49,8 @@ def to_dict(self) -> dict[str, Any]:
4549
else:
4650
source = self.source
4751

52+
materialize_embeddings = self.materialize_embeddings
53+
4854
field_dict: dict[str, Any] = {}
4955

5056
field_dict.update({})
@@ -58,6 +64,8 @@ def to_dict(self) -> dict[str, Any]:
5864
field_dict["dry_run"] = dry_run
5965
if source is not UNSET:
6066
field_dict["source"] = source
67+
if materialize_embeddings is not UNSET:
68+
field_dict["materialize_embeddings"] = materialize_embeddings
6169

6270
return field_dict
6371

@@ -81,12 +89,15 @@ def _parse_source(data: object) -> None | str | Unset:
8189

8290
source = _parse_source(d.pop("source", UNSET))
8391

92+
materialize_embeddings = d.pop("materialize_embeddings", UNSET)
93+
8494
materialize_request = cls(
8595
force=force,
8696
rebuild=rebuild,
8797
ignore_errors=ignore_errors,
8898
dry_run=dry_run,
8999
source=source,
100+
materialize_embeddings=materialize_embeddings,
90101
)
91102

92103
return materialize_request

0 commit comments

Comments
 (0)