Skip to content

Commit fb87288

Browse files
justin-cechmanektylerhutcherson
authored andcommitted
removes vector comparison in tests
1 parent b4c2d35 commit fb87288

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

redisvl/utils/vectorize/text/bedrock.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def __init__(
6060
If not provided, will use environment variables.
6161
dtype (str): the default datatype to use when embedding text as byte arrays.
6262
Used when setting `as_buffer=True` in calls to embed() and embed_many().
63+
Defaults to 'float32'.
6364
6465
Raises:
6566
ValueError: If credentials are not provided in config or environment.

tests/integration/test_vectorizers.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import os
22

3-
import numpy as np
43
import pytest
54

6-
from redisvl.redis.utils import buffer_to_array
75
from redisvl.utils.vectorize import (
86
AzureOpenAITextVectorizer,
97
BedrockTextVectorizer,
@@ -256,7 +254,6 @@ def bad_return_type(text: str) -> str:
256254
def test_dtypes(vector_class, skip_vectorizer):
257255
if skip_vectorizer:
258256
pytest.skip("Skipping vectorizer instantiation...")
259-
words = "test sentence"
260257

261258
# test dtype defaults to float32
262259
if issubclass(vector_class, CustomTextVectorizer):
@@ -269,16 +266,6 @@ def test_dtypes(vector_class, skip_vectorizer):
269266
vectorizer = vector_class()
270267
assert vectorizer.dtype == "float32"
271268

272-
# test that the dtype can be overwriten in the method calls
273-
raw = vectorizer.embed(words, as_buffer=False, input_type="search_query")
274-
embedding = vectorizer.embed(
275-
words, as_buffer=True, dtype="bfloat16", input_type="search_query"
276-
)
277-
assert np.allclose(buffer_to_array(embedding, dtype="bfloat16"), raw, atol=1e-03)
278-
279-
# test that over writing in method calls does not change initialized dtype
280-
assert vectorizer.dtype == "float32"
281-
282269
# test initializing dtype in constructor
283270
for dtype in ["float16", "float32", "float64", "bfloat16"]:
284271
if issubclass(vector_class, CustomTextVectorizer):
@@ -287,7 +274,8 @@ def test_dtypes(vector_class, skip_vectorizer):
287274
vectorizer = vector_class(
288275
model=os.getenv(
289276
"AZURE_OPENAI_DEPLOYMENT_NAME", "text-embedding-ada-002"
290-
)
277+
),
278+
dtype=dtype,
291279
)
292280
else:
293281
vectorizer = vector_class(dtype=dtype)

0 commit comments

Comments
 (0)