langchain/libs/partners/together/tests/integration_tests/test_embeddings.py
2023-12-19 18:48:32 -08:00

20 lines
684 B
Python

"""Test Together embeddings."""
from langchain_together.embeddings import TogetherEmbeddings
def test_langchain_together_embedding_documents() -> None:
"""Test cohere embeddings."""
documents = ["foo bar"]
embedding = TogetherEmbeddings(model="togethercomputer/m2-bert-80M-8k-retrieval")
output = embedding.embed_documents(documents)
assert len(output) == 1
assert len(output[0]) > 0
def test_langchain_together_embedding_query() -> None:
"""Test cohere embeddings."""
document = "foo bar"
embedding = TogetherEmbeddings(model="togethercomputer/m2-bert-80M-8k-retrieval")
output = embedding.embed_query(document)
assert len(output) > 0