Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversAmazon KendraArcee RetrieverArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArrayElasticSearch BM25Google Cloud Enterprise SearchGoogle DriveGoogle Vertex AI SearchKay.aikNNLOTR (Merger Retriever)MetalPinecone Hybrid SearchPubMedRePhraseQuerySEC filingSelf-querying retrieverSVMTavily Search APITF-IDFVespaWeaviate Hybrid SearchWikipediayou-retrieverZepToolsAgents and toolkitsMemoryCallbacksChat loadersComponentsRetrieversRePhraseQueryOn this pageRePhraseQueryRePhraseQuery is a simple retriever that applies an LLM between the user input and the query passed by the retriever.It can be used to pre-process the user input in any way.Example‚ÄãSetting up‚ÄãCreate a vector store.import loggingfrom langchain.document_loaders import WebBaseLoaderfrom langchain.text_splitter import RecursiveCharacterTextSplitterfrom langchain.vectorstores import Chromafrom langchain.embeddings import OpenAIEmbeddingsfrom langchain.chat_models import ChatOpenAIfrom langchain.retrievers import RePhraseQueryRetrieverlogging.basicConfig()logging.getLogger("langchain.retrievers.re_phraser").setLevel(logging.INFO)loader = WebBaseLoader("https://lilianweng.github.io/posts/2023-06-23-agent/")data = loader.load()text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0)all_splits = text_splitter.split_documents(data)vectorstore = Chroma.from_documents(documents=all_splits, embedding=OpenAIEmbeddings())Using the default prompt‚ÄãThe default prompt used in the from_llm classmethod:DEFAULT_TEMPLATE = """You are an assistant tasked with taking a natural language \query from a user and converting it into a query for a vectorstore. \In this process, you strip out information that is not relevant
RePhraseQuery is a simple retriever that applies an LLM between the user input and the query passed by the retriever.
RePhraseQuery is a simple retriever that applies an LLM between the user input and the query passed by the retriever. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversAmazon KendraArcee RetrieverArxivAzure Cognitive SearchBM25ChaindeskChatGPT PluginCohere RerankerDocArrayElasticSearch BM25Google Cloud Enterprise SearchGoogle DriveGoogle Vertex AI SearchKay.aikNNLOTR (Merger Retriever)MetalPinecone Hybrid SearchPubMedRePhraseQuerySEC filingSelf-querying retrieverSVMTavily Search APITF-IDFVespaWeaviate Hybrid SearchWikipediayou-retrieverZepToolsAgents and toolkitsMemoryCallbacksChat loadersComponentsRetrieversRePhraseQueryOn this pageRePhraseQueryRePhraseQuery is a simple retriever that applies an LLM between the user input and the query passed by the retriever.It can be used to pre-process the user input in any way.Example‚ÄãSetting up‚ÄãCreate a vector store.import loggingfrom langchain.document_loaders import WebBaseLoaderfrom langchain.text_splitter import RecursiveCharacterTextSplitterfrom langchain.vectorstores import Chromafrom langchain.embeddings import OpenAIEmbeddingsfrom langchain.chat_models import ChatOpenAIfrom langchain.retrievers import RePhraseQueryRetrieverlogging.basicConfig()logging.getLogger("langchain.retrievers.re_phraser").setLevel(logging.INFO)loader = WebBaseLoader("https://lilianweng.github.io/posts/2023-06-23-agent/")data = loader.load()text_splitter = RecursiveCharacterTextSplitter(chunk_size=500, chunk_overlap=0)all_splits = text_splitter.split_documents(data)vectorstore = Chroma.from_documents(documents=all_splits, embedding=OpenAIEmbeddings())Using the default prompt‚ÄãThe default prompt used in the from_llm classmethod:DEFAULT_TEMPLATE = """You are an assistant tasked with taking a natural language \query from a user and converting it into a query for a vectorstore. \In this process, you strip out information that is not relevant