From 8c5fbab72d91641b2c0fa42d6d4118b5f4e0a50c Mon Sep 17 00:00:00 2001 From: Noah Gundotra Date: Fri, 17 Feb 2023 18:18:09 -0500 Subject: [PATCH] [Integration Tests] Cast fake embeddings to ALL float values (#1102) Pydantic validation breaks tests for example (`test_qdrant.py`) because fake embeddings contain an integer. This PR casts the embeddings array to all floats. Now the `qdrant` test passes, `poetry run pytest tests/integration_tests/vectorstores/test_qdrant.py` --- tests/integration_tests/vectorstores/fake_embeddings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration_tests/vectorstores/fake_embeddings.py b/tests/integration_tests/vectorstores/fake_embeddings.py index c7b571e8..e5a5fcd3 100644 --- a/tests/integration_tests/vectorstores/fake_embeddings.py +++ b/tests/integration_tests/vectorstores/fake_embeddings.py @@ -11,8 +11,8 @@ class FakeEmbeddings(Embeddings): def embed_documents(self, texts: List[str]) -> List[List[float]]: """Return simple embeddings.""" - return [[1.0] * 9 + [i] for i in range(len(texts))] + return [[float(1.0)] * 9 + [float(i)] for i in range(len(texts))] def embed_query(self, text: str) -> List[float]: """Return simple embeddings.""" - return [1.0] * 9 + [0.0] + return [float(1.0)] * 9 + [float(0.0)]