2023-05-24 15:06:45 +00:00
|
|
|
"""Test modelscope embeddings."""
|
2023-12-11 21:53:30 +00:00
|
|
|
from langchain_community.embeddings.modelscope_hub import ModelScopeEmbeddings
|
2023-05-24 15:06:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_modelscope_embedding_documents() -> None:
|
|
|
|
"""Test modelscope embeddings for documents."""
|
|
|
|
documents = ["foo bar"]
|
|
|
|
embedding = ModelScopeEmbeddings()
|
|
|
|
output = embedding.embed_documents(documents)
|
|
|
|
assert len(output) == 2
|
|
|
|
assert len(output[0]) == 512
|
|
|
|
|
|
|
|
|
|
|
|
def test_modelscope_embedding_query() -> None:
|
|
|
|
"""Test modelscope embeddings for query."""
|
|
|
|
document = "foo bar"
|
|
|
|
embedding = ModelScopeEmbeddings()
|
|
|
|
output = embedding.embed_query(document)
|
|
|
|
assert len(output) == 512
|