1
0
mirror of https://github.com/hwchase17/langchain.git synced 2025-05-06 15:48:39 +00:00

community[patch]: Fix bug in vdms ()

**Description:** Fix embedding check in vdms
**Contribution maintainer:** [@cwlacewe](https://github.com/cwlacewe)
This commit is contained in:
Chaunte W. Lacewell 2024-03-28 12:54:24 -07:00 committed by GitHub
parent 75173d31db
commit 4a49fc5a95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -746,7 +746,8 @@ class VDMS(VectorStore):
) -> Tuple[List[Dict[str, Any]], List]:
all_blobs: List[Any] = []
blob = embedding2bytes(query_embedding)
all_blobs.append(blob)
if blob is not None:
all_blobs.append(blob)
if constraints is None:
# K results returned
@ -1534,7 +1535,7 @@ def _check_descriptor_exists_by_id(
def embedding2bytes(embedding: Union[List[float], None]) -> Union[bytes, None]:
blob = None
if embedding:
if embedding is not None:
emb = np.array(embedding, dtype="float32")
blob = emb.tobytes()
return blob