Issam9/cohere embeddings (#105)

Add support for cohere embeddings
This commit is contained in:
issam9
2022-11-09 22:44:27 +01:00
committed by GitHub
parent 95dd2f140e
commit 28282ad099
3 changed files with 101 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
"""Test cohere embeddings."""
from langchain.embeddings.cohere import CohereEmbeddings
def test_cohere_embedding_documents() -> None:
"""Test cohere embeddings."""
documents = ["foo bar"]
embedding = CohereEmbeddings()
output = embedding.embed_documents(documents)
assert len(output) == 1
assert len(output[0]) == 2048
def test_cohere_embedding_query() -> None:
"""Test cohere embeddings."""
document = "foo bar"
embedding = CohereEmbeddings()
output = embedding.embed_query(document)
assert len(output) == 2048