2023-10-27 03:22:50 +00:00
|
|
|
"""Test johnsnowlabs embeddings."""
|
|
|
|
|
2023-12-11 21:53:30 +00:00
|
|
|
from langchain_community.embeddings.johnsnowlabs import JohnSnowLabsEmbeddings
|
2023-10-27 03:22:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_johnsnowlabs_embed_document() -> None:
|
|
|
|
"""Test johnsnowlabs embeddings."""
|
|
|
|
documents = ["foo bar", "bar foo"]
|
|
|
|
embedding = JohnSnowLabsEmbeddings()
|
|
|
|
output = embedding.embed_documents(documents)
|
|
|
|
assert len(output) == 2
|
|
|
|
assert len(output[0]) == 128
|
|
|
|
|
|
|
|
|
|
|
|
def test_johnsnowlabs_embed_query() -> None:
|
|
|
|
"""Test johnsnowlabs embeddings."""
|
|
|
|
document = "foo bar"
|
|
|
|
embedding = JohnSnowLabsEmbeddings()
|
|
|
|
output = embedding.embed_query(document)
|
|
|
|
assert len(output) == 128
|