如何在RAG中使用Solr作为检索器
我想用LangChain搭建一个RAG(检索增强生成)服务,检索部分我想用Solr。现在已经有一个Python包叫eurelis-langchain-solr-vectorstore
,可以把Solr和LangChain结合起来使用,但我不知道怎么设置服务器的凭证。而且我的嵌入模型已经在服务器上运行了。我想了一个大概的思路,但不太确定。
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()
1 个回答
暂无回答