mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-25 16:13:25 +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)
|
raise ValueError(msg)
|
||||||
|
|
||||||
if type(destination).adelete == VectorStore.adelete:
|
if (
|
||||||
# Checking if the vectorstore has overridden the default delete method
|
type(destination).adelete == VectorStore.adelete
|
||||||
# implementation which just raises a NotImplementedError
|
and type(destination).delete == VectorStore.delete
|
||||||
msg = "Vectorstore has not implemented the delete method"
|
):
|
||||||
|
# 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)
|
raise ValueError(msg)
|
||||||
elif isinstance(destination, DocumentIndex):
|
elif isinstance(destination, DocumentIndex):
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user