Harrison/modelscope (#5156)

Co-authored-by: thomas-yanxin <yx20001210@163.com>
Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
This commit is contained in:
Harrison Chase
2023-05-24 08:06:45 -07:00
committed by GitHub
parent 2d5588c5f0
commit 11c26ebb55
5 changed files with 195 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
"""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