Skip to content

Commit

Permalink
fix: make lint
Browse files Browse the repository at this point in the history
  • Loading branch information
JANHMS committed Nov 16, 2024
1 parent 106a52d commit 1f65a78
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 64 deletions.
3 changes: 3 additions & 0 deletions libs/community/langchain_community/document_loaders/needle.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def add_files(self, files: dict) -> None:
ValueError: If the collection is not properly initialized.
"""
self._get_collection()
assert self.client is not None, "NeedleClient must be initialized."

files_to_add = []
for name, url in files.items():
Expand All @@ -113,6 +114,7 @@ def _fetch_documents(self) -> List[Document]:
ValueError: If the collection is not properly initialized.
"""
self._get_collection()
assert self.client is not None, "NeedleClient must be initialized."

files = self.client.collections.files.list(self.collection_id)
docs = []
Expand All @@ -129,6 +131,7 @@ def _fetch_documents(self) -> List[Document]:
docs.append(doc)
return docs


def load(self) -> List[Document]:
"""
Loads all documents from the Needle collection.
Expand Down
3 changes: 3 additions & 0 deletions libs/community/langchain_community/retrievers/needle.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def _search_collection(self, query: str) -> List[Document]:
List[Document]: A list of documents matching the search query.
"""
self._initialize_client()
if self.client is None:
raise ValueError("Provide a valid API key.")

results = self.client.collections.search(
collection_id=self.collection_id, text=query
)
Expand Down
64 changes: 0 additions & 64 deletions libs/community/tests/unit_tests/document_loaders/test_needle.py

This file was deleted.

0 comments on commit 1f65a78

Please sign in to comment.