Skip to content

Commit

Permalink
handle backward compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
spikechroma committed Sep 12, 2024
1 parent b7e0c08 commit 74a8394
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion chromadb/test/ef/test_multimodal_ef.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Generator, cast
import numpy as np
import pytest
from packaging import version
import chromadb
from chromadb.api.types import (
Embeddable,
Expand All @@ -17,7 +18,10 @@
# then hashes them to a fixed dimension.
class hashing_multimodal_ef(EmbeddingFunction[Embeddable]):
def __init__(self) -> None:
self._hef = hashing_embedding_function(dim=10, dtype=np.float64)
if version.parse(np.__version__) < version.parse("2.0.0"):
self._hef = hashing_embedding_function(dim=10, dtype=np.float_) # type: ignore[attr-defined]
else:
self._hef = hashing_embedding_function(dim=10, dtype=np.float64)

def __call__(self, input: Embeddable) -> Embeddings:
to_texts = [str(i) for i in input]
Expand Down

0 comments on commit 74a8394

Please sign in to comment.