Skip to content

Commit

Permalink
Fixed some bugs:
Browse files Browse the repository at this point in the history
- Fixed vector search post like
- Fixed ibis query read_ids
- Fixed native datatype
  • Loading branch information
jieguangzhou committed Sep 23, 2024
1 parent 8a4f309 commit 54ee1bb
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix the bug where shared artifacts are deleted when removing a component.
- Fix compatibility issues with the latest version of pymongo.
- Fix the query parser incompatibility with '.' symbol.
- Fix the post like in the service vector_search.

#### New Features & Functionality

Expand Down
10 changes: 9 additions & 1 deletion plugins/ibis/superduper_ibis/data_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,15 @@ def check_ready_ids(
conditions = []
for key in keys:
conditions.append(query[key].notnull())
docs = query.filter(*conditions).select(query.primary_id).execute()

# TODO: Hotfix, will be removed by the refactor PR
try:
docs = query.filter(*conditions).select(query.primary_id).execute()
except Exception as e:
if "Table not found" in str(e) or "Can't find table" in str(e):
return []
else:
raise e
ready_ids = [doc[query.primary_id] for doc in docs]
self._log_check_ready_ids_message(ids, ready_ids)
return ready_ids
Expand Down
2 changes: 1 addition & 1 deletion plugins/sqlalchemy/superduper_sqlalchemy/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def _init_tables(self):
'ARTIFACT_RELATIONS',
metadata,
Column('uuid', type_string),
Column('artifact_id', type_integer),
Column('artifact_id', type_string),
*component_table_args,
)

Expand Down
2 changes: 2 additions & 0 deletions superduper/components/datatype.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ def get_hash(data):
bytes_ = data.encode()
elif isinstance(data, bytes):
bytes_ = data
elif isinstance(data, Native):
bytes_ = str([type(data), data.x]).encode()
else:
raise ValueError(f'Unsupported data type: {type(data)}')
return hashlib.sha1(bytes_).hexdigest()
Expand Down
6 changes: 5 additions & 1 deletion superduper/vector_search/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ def find_nearest_from_array(
service='vector_search',
data=h,
endpoint='query/search',
args={'vector_index': self.vector_index, 'n': n},
args={
'vector_index': self.vector_index,
'n': n,
"within_ids": ",".join(within_ids) if within_ids else "",
},
)
return response['ids'], response['scores']

Expand Down

0 comments on commit 54ee1bb

Please sign in to comment.