mirror of
https://github.com/hwchase17/langchain
synced 2024-10-29 17:07:25 +00:00
20 lines
622 B
Python
20 lines
622 B
Python
|
"""Test modelscope embeddings."""
|
||
|
from langchain.embeddings.modelscope_hub import ModelScopeEmbeddings
|
||
|
|
||
|
|
||
|
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
|