Skip to content

Commit

Permalink
Also use ref_doc_id to dedup in _ahandle_recursive_retrieval (#14383)
Browse files Browse the repository at this point in the history
* dedup on ref_doc_id

* version bump
  • Loading branch information
Javtor authored Jun 25, 2024
1 parent 6791756 commit 5142603
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions llama-index-core/llama_index/core/base/base_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ async def _ahandle_recursive_retrieval(
else:
retrieved_nodes.append(n)

# remove any duplicates based on hash
# remove any duplicates based on hash and ref_doc_id
seen = set()
return [
n
for n in retrieved_nodes
if not (n.node.hash in seen or seen.add(n.node.hash)) # type: ignore[func-returns-value]
if not ((n.node.hash, n.node.ref_doc_id) in seen or seen.add((n.node.hash, n.node.ref_doc_id))) # type: ignore[func-returns-value]
]

@dispatcher.span
Expand Down
2 changes: 1 addition & 1 deletion llama-index-core/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ name = "llama-index-core"
packages = [{include = "llama_index"}]
readme = "README.md"
repository = "https://github.com/run-llama/llama_index"
version = "0.10.50"
version = "0.10.50.post1"

[tool.poetry.dependencies]
SQLAlchemy = {extras = ["asyncio"], version = ">=1.4.49"}
Expand Down

0 comments on commit 5142603

Please sign in to comment.