Skip to main content

A persistent implementation of BM25 retrieval.

Project description

persistent_bm25

persistent_bm25 is a Python package that provides a persistent implementation of BM25 retrieval.

Installation

You can install it via pip:

pip install persistent_bm25

Usage

from persistent_bm25 import PersistentBM25Retriever
from langchain_core.documents import Document
docs = [
    Document(page_content="LangChain makes AI powerful"),
    Document(page_content="BM25 is a ranking function for search"),
]

# Create retriever
bm25_retriever = PersistentBM25Retriever.from_documents(docs)
bm25_retriever.persist("./bm25_retriever")

loaded_bm25_retriever = PersistentBM25Retriever.from_persist_dir("./bm25_retriever")

results = loaded_bm25_retriever.get_relevant_documents("AI search")
print(results)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

persistent_bm25_v2-1.0.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

persistent_bm25_v2-1.0.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file persistent_bm25_v2-1.0.1.tar.gz.

File metadata

  • Download URL: persistent_bm25_v2-1.0.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.7

File hashes

Hashes for persistent_bm25_v2-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c90fdccfbc146b165acb7ee2c8b0d713b02826debe9e5ccda36840a8a6e9f60f
MD5 7194b74a5c151b45dced3ea0f0fdc9e5
BLAKE2b-256 156ce08b087b2edf4be6bd644f81645bd00c534d9814f00a86e0c0e859fe627f

See more details on using hashes here.

File details

Details for the file persistent_bm25_v2-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for persistent_bm25_v2-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2530859629d0d9e3581f3fd6878a2a90c7bb0a7ca9ca8fc7ab7cdd87eaf2df4d
MD5 fbebd9c84c48649700e9a34438ed96c1
BLAKE2b-256 f00fae02484d9993057c8e246b6e820323b760f490717896fd079ab7fc7bbcdc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page