mirror of https://github.com/hwchase17/langchain
cohere[patch]: Fix cohere rerank (#19624)
Fix cohere rerank inspired by https://github.com/langchain-ai/langchain/pull/19486pull/18393/head
parent
8ab7bb3166
commit
85f57ab4cd
@ -0,0 +1,16 @@
|
|||||||
|
"""Test Cohere reranks."""
|
||||||
|
from langchain_core.documents import Document
|
||||||
|
|
||||||
|
from langchain_cohere import CohereRerank
|
||||||
|
|
||||||
|
|
||||||
|
def test_langchain_cohere_rerank_documents() -> None:
|
||||||
|
"""Test cohere rerank."""
|
||||||
|
rerank = CohereRerank()
|
||||||
|
test_documents = [
|
||||||
|
Document(page_content="This is a test document."),
|
||||||
|
Document(page_content="Another test document."),
|
||||||
|
]
|
||||||
|
test_query = "Test query"
|
||||||
|
results = rerank.rerank(test_documents, test_query)
|
||||||
|
assert len(results) == 2
|
Loading…
Reference in New Issue