Skip to content

Commit f3549e4

Browse files
authored
Update core/indices/base.py to remove depreciation warning (#19990)
1 parent cec9634 commit f3549e4

File tree

1 file changed

+6
-8
lines changed
  • llama-index-core/llama_index/core/indices

1 file changed

+6
-8
lines changed

llama-index-core/llama_index/core/indices/base.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def insert(self, document: Document, **insert_kwargs: Any) -> None:
237237
)
238238

239239
self.insert_nodes(nodes, **insert_kwargs)
240-
self.docstore.set_document_hash(document.get_doc_id(), document.hash)
240+
self.docstore.set_document_hash(document.id_, document.hash)
241241

242242
async def ainsert(self, document: Document, **insert_kwargs: Any) -> None:
243243
"""Asynchronously insert a document."""
@@ -250,7 +250,7 @@ async def ainsert(self, document: Document, **insert_kwargs: Any) -> None:
250250
)
251251

252252
await self.ainsert_nodes(nodes, **insert_kwargs)
253-
await self.docstore.aset_document_hash(document.get_doc_id(), document.hash)
253+
await self.docstore.aset_document_hash(document.id_, document.hash)
254254

255255
@abstractmethod
256256
def _delete_node(self, node_id: str, **delete_kwargs: Any) -> None:
@@ -383,7 +383,7 @@ def update_ref_doc(self, document: Document, **update_kwargs: Any) -> None:
383383
"""
384384
with self._callback_manager.as_trace("update_ref_doc"):
385385
self.delete_ref_doc(
386-
document.get_doc_id(),
386+
document.id_,
387387
delete_from_docstore=True,
388388
**update_kwargs.pop("delete_kwargs", {}),
389389
)
@@ -403,7 +403,7 @@ async def aupdate_ref_doc(self, document: Document, **update_kwargs: Any) -> Non
403403
"""
404404
with self._callback_manager.as_trace("aupdate_ref_doc"):
405405
await self.adelete_ref_doc(
406-
document.get_doc_id(),
406+
document.id_,
407407
delete_from_docstore=True,
408408
**update_kwargs.pop("delete_kwargs", {}),
409409
)
@@ -439,9 +439,7 @@ def refresh_ref_docs(
439439
with self._callback_manager.as_trace("refresh_ref_docs"):
440440
refreshed_documents = [False] * len(documents)
441441
for i, document in enumerate(documents):
442-
existing_doc_hash = self._docstore.get_document_hash(
443-
document.get_doc_id()
444-
)
442+
existing_doc_hash = self._docstore.get_document_hash(document.id_)
445443
if existing_doc_hash is None:
446444
self.insert(document, **update_kwargs.pop("insert_kwargs", {}))
447445
refreshed_documents[i] = True
@@ -467,7 +465,7 @@ async def arefresh_ref_docs(
467465
refreshed_documents = [False] * len(documents)
468466
for i, document in enumerate(documents):
469467
existing_doc_hash = await self._docstore.aget_document_hash(
470-
document.get_doc_id()
468+
document.id_
471469
)
472470
if existing_doc_hash is None:
473471
await self.ainsert(

0 commit comments

Comments
 (0)