How to use Solr as retriever in RAG

67 Views Asked by At

I want to build a RAG (Retrieval Augmented Generation) service with LangChain and for the retriever I want to use Solr. There is already a python package eurelis-langchain-solr-vectorstore where you can use Solr in combination with LangChain but how do I define server credentials? And my embedding model is already running on a server. I thought something like this but I don't know

import requests
from eurelis_langchain_solr_vectorstore import Solr

embeddings_model = requests.post("http://server-insight/embeddings/")


solr = Solr(embeddings_model, core_kwargs={
        'page_content_field': 'text_t',  # field containing the text content
        'vector_field': 'vector',        # field containing the embeddings of the text content
        'core_name': 'langchain',        # core name
        'url_base': 'http://localhost:8983/solr' # base url to access solr
    })  # with custom default core configuration


retriever = solr.as_retriever()
0

There are 0 best solutions below