mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-21 06:14:37 +00:00
Signed-off-by: Filip Haltmayer <filip.haltmayer@zilliz.com> Signed-off-by: Frank Liu <frank.liu@zilliz.com> Co-authored-by: Filip Haltmayer <81822489+filip-halt@users.noreply.github.com> Co-authored-by: Frank Liu <frank@frankzliu.com>
19 lines
546 B
Python
19 lines
546 B
Python
"""Fake Embedding class for testing purposes."""
|
|
from typing import List
|
|
|
|
from langchain.embeddings.base import Embeddings
|
|
|
|
fake_texts = ["foo", "bar", "baz"]
|
|
|
|
|
|
class FakeEmbeddings(Embeddings):
|
|
"""Fake embeddings functionality for testing."""
|
|
|
|
def embed_documents(self, texts: List[str]) -> List[List[float]]:
|
|
"""Return simple embeddings."""
|
|
return [[1.0] * 9 + [i] for i in range(len(texts))]
|
|
|
|
def embed_query(self, text: str) -> List[float]:
|
|
"""Return simple embeddings."""
|
|
return [1.0] * 9 + [0.0]
|