langchain/libs/community/tests/integration_tests/retrievers/test_breebs.py
ccurme c010ec8b71
patch: deprecate (a)get_relevant_documents (#20477)
- `.get_relevant_documents(query)` -> `.invoke(query)`
- `.get_relevant_documents(query=query)` -> `.invoke(query)`
- `.get_relevant_documents(query, callbacks=callbacks)` ->
`.invoke(query, config={"callbacks": callbacks})`
- `.get_relevant_documents(query, **kwargs)` -> `.invoke(query,
**kwargs)`

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
2024-04-22 11:14:53 -04:00

19 lines
778 B
Python

from typing import List
from langchain_core.documents import Document
from langchain_community.retrievers.breebs import BreebsRetriever
class TestBreebsRetriever:
def test_breeb_query(self) -> None:
breeb_key = "Parivoyage"
query = "What are the best churches to visit in Paris?"
breeb_retriever = BreebsRetriever(breeb_key)
documents: List[Document] = breeb_retriever.invoke(query)
assert isinstance(documents, list), "Documents should be a list"
for doc in documents:
assert doc.page_content, "Document page_content should not be None"
assert doc.metadata["source"], "Document metadata should contain 'source'"
assert doc.metadata["score"] == 1, "Document score should be equal to 1"