diff --git a/libs/kotaemon/kotaemon/rerankings/cohere.py b/libs/kotaemon/kotaemon/rerankings/cohere.py index 18785f0..ab35700 100644 --- a/libs/kotaemon/kotaemon/rerankings/cohere.py +++ b/libs/kotaemon/kotaemon/rerankings/cohere.py @@ -1,6 +1,7 @@ from __future__ import annotations import os + from decouple import config from kotaemon.base import Document, Param @@ -25,7 +26,9 @@ class CohereReranking(BaseReranking): required=True, ) base_url: str = Param( - None, help="Rerank API base url. Default is https://api.cohere.com", required=False + None, + help="Rerank API base url. Default is https://api.cohere.com", + required=False, ) def run(self, documents: list[Document], query: str) -> list[Document]: @@ -42,7 +45,9 @@ class CohereReranking(BaseReranking): print("Cohere API key not found. Skipping rerankings.") return documents - cohere_client = cohere.Client(self.cohere_api_key, base_url=self.base_url or os.getenv("CO_API_URL")) + cohere_client = cohere.Client( + self.cohere_api_key, base_url=self.base_url or os.getenv("CO_API_URL") + ) compressed_docs: list[Document] = [] if not documents: # to avoid empty api call diff --git a/libs/kotaemon/kotaemon/storages/docstores/lancedb.py b/libs/kotaemon/kotaemon/storages/docstores/lancedb.py index 36ddb69..11b09a5 100644 --- a/libs/kotaemon/kotaemon/storages/docstores/lancedb.py +++ b/libs/kotaemon/kotaemon/storages/docstores/lancedb.py @@ -114,10 +114,11 @@ class LanceDBDocumentStore(BaseDocumentStore): except (ValueError, FileNotFoundError): docs = [] - # return the documents using the order of original ids (which were ordered by score) + # return the documents using the order of original + # ids (which were ordered by score) doc_dict = { doc["id"]: Document( - d_=doc["id"], + id_=doc["id"], text=doc["text"] if doc["text"] else "", metadata=json.loads(doc["attributes"]), )