mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 15:43:54 +00:00
langchain[patch]: Allow async indexing code to work for vectorstores that only defined sync delete (#30869)
`aindex` function should check not only `adelete` method, but `delete` method too **PR title**: "core: fix async indexing issue with adelete/delete checking" **PR message**: Currently `langchain.indexes.aindex` checks if vector store has overrided adelete method. But due to `adelete` default implementation store can have just `delete` overrided to make `adelete` working. --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
parent
bd367ba10c
commit
671e4fd114
@ -646,10 +646,13 @@ async def aindex(
|
||||
)
|
||||
raise ValueError(msg)
|
||||
|
||||
if type(destination).adelete == VectorStore.adelete:
|
||||
# Checking if the vectorstore has overridden the default delete method
|
||||
# implementation which just raises a NotImplementedError
|
||||
msg = "Vectorstore has not implemented the delete method"
|
||||
if (
|
||||
type(destination).adelete == VectorStore.adelete
|
||||
and type(destination).delete == VectorStore.delete
|
||||
):
|
||||
# Checking if the vectorstore has overridden the default adelete or delete
|
||||
# methods implementation which just raises a NotImplementedError
|
||||
msg = "Vectorstore has not implemented the adelete or delete method"
|
||||
raise ValueError(msg)
|
||||
elif isinstance(destination, DocumentIndex):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user