[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`
This commit is contained in:
Noah Gundotra 2023-02-17 18:18:09 -05:00 committed by GitHub
parent d5f3dfa1e1
commit 8c5fbab72d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,8 +11,8 @@ class FakeEmbeddings(Embeddings):
def embed_documents(self, texts: List[str]) -> List[List[float]]: def embed_documents(self, texts: List[str]) -> List[List[float]]:
"""Return simple embeddings.""" """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]: def embed_query(self, text: str) -> List[float]:
"""Return simple embeddings.""" """Return simple embeddings."""
return [1.0] * 9 + [0.0] return [float(1.0)] * 9 + [float(0.0)]