Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hybrid search capability #258

Open
thusithaC opened this issue Oct 22, 2024 · 1 comment
Open

Hybrid search capability #258

thusithaC opened this issue Oct 22, 2024 · 1 comment
Assignees
Labels
api: alloydb Issues related to the googleapis/langchain-google-alloydb-pg-python API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@thusithaC
Copy link

Is there a plan to introduce Hybrid search (using bm25 or similar algorithm). If not in the pipeline, can you please give some pointers in how best to implement it using the existing patterns within this library?

Thanks!

@product-auto-label product-auto-label bot added the api: alloydb Issues related to the googleapis/langchain-google-alloydb-pg-python API. label Oct 22, 2024
@averikitsch
Copy link
Collaborator

Hi @thusithaC , we are planning updates to support Hybrid Search (for dense and sparse vectors). I currently do not have a timeline for support. Currently, you could do this using the BM25Retriever and EnsembleRetriever, but the BM25Retriever will use sparse vectors stored in-memory:

from langchain_community.retrievers import BM25Retriever
from langchain.retrievers import EnsembleRetriever


store = await AlloyDBVectorStore.create(...)
# store.add_documents(docs)
retriever = store.as_retriever()
bm25_retriever = BM25Retriever.from_documents(docs)

ensemble_retriever = EnsembleRetriever(
    retrievers=[bm25_retriever retriever], weights=[0.5, 0.5]
)

@averikitsch averikitsch added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: alloydb Issues related to the googleapis/langchain-google-alloydb-pg-python API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants