Skip to content

Commit

Permalink
Update BM25 retreiver to use metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi03071991 committed Sep 27, 2024
1 parent a719cee commit 43bc7e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
from llama_index.core.callbacks.base import CallbackManager
from llama_index.core.constants import DEFAULT_SIMILARITY_TOP_K
from llama_index.core.indices.vector_store.base import VectorStoreIndex
from llama_index.core.schema import BaseNode, IndexNode, NodeWithScore, QueryBundle
from llama_index.core.schema import (
BaseNode,
IndexNode,
NodeWithScore,
QueryBundle,
MetadataMode,
)
from llama_index.core.storage.docstore.types import BaseDocumentStore
from llama_index.core.vector_stores.utils import (
node_to_metadata_dict,
Expand Down Expand Up @@ -75,7 +81,7 @@ def __init__(
self.corpus = [node_to_metadata_dict(node) for node in nodes]

corpus_tokens = bm25s.tokenize(
[node.get_content() for node in nodes],
[node.get_content(metadata_mode=MetadataMode.EMBED) for node in nodes],
stopwords=language,
stemmer=self.stemmer,
show_progress=verbose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ exclude = ["**/BUILD"]
license = "MIT"
name = "llama-index-retrievers-bm25"
readme = "README.md"
version = "0.3.0"
version = "0.3.1"

[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
Expand Down

0 comments on commit 43bc7e7

Please sign in to comment.