Opensolr as a LangChain vector store
langchain-opensolr makes an Opensolr Index a LangChain vector store. Your texts and files get their meaning vectors on Opensolr servers, so you configure no embedding model, and the store drops into any chain or agent.
Install and first search
pip install langchain-opensolr
from langchain_opensolr import OpensolrVectorStore
vs = OpensolrVectorStore(
index="my_index",
email="you@example.com",
api_key="YOUR_OPENSOLR_API_KEY",
create_if_missing=True, # creates the index on first use
)
vs.add_texts(["Hybrid search ranks words and meaning together"])
docs = vs.similarity_search("how do keyword and meaning search combine?", k=3, hybrid=True)
What you get
OpensolrVectorStore: add texts and files, search by meaning or by words and meaning together (hybrid=True, withalphafor the balance), metadata filters, a date range, andas_retriever()for any chain.OpensolrEmbeddings: the same meaning vectors, on their own.OpensolrLoader: a file or a folder read into documents, a PDF page by page, scans and pictures through OCR.search_by_image(): search with a photo.ai_answer(): a grounded answer written from the best documents, by Opensolr's own model. No LLM key needed.- A keyword-only mode that uses none of your AI allowance.
Links
- LangChain product page
- PyPI and GitHub, with the full guide in the README.
- No account yet? Use the public demo account.