Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalDocument loadersDocument transformersText embedding modelsVector storesRetrieversMultiQueryRetrieverContextual compressionEnsemble RetrieverMultiVector RetrieverParent Document RetrieverSelf-queryingTime-weighted vector store retrieverVector store-backed retrieverWebResearchRetrieverIndexingChainsMemoryAgentsCallbacksModulesSecurityGuidesMoreModulesRetrievalRetrieversWebResearchRetrieverOn this pageWebResearchRetrieverGiven a query, this retriever will: Formulate a set of relate Google searchesSearch for each Load all the resulting URLsThen embed and perform similarity search with the query on the consolidate page contentfrom langchain.retrievers.web_research import WebResearchRetrieverSimple usage‚ÄãSpecify the LLM to use for Google search query generation.import osfrom langchain.vectorstores import Chromafrom langchain.embeddings import OpenAIEmbeddingsfrom langchain.chat_models.openai import ChatOpenAIfrom langchain.utilities import GoogleSearchAPIWrapper# Vectorstorevectorstore = Chroma(embedding_function=OpenAIEmbeddings(),persist_directory="./chroma_db_oai")# LLMllm = ChatOpenAI(temperature=0)# Search os.environ["GOOGLE_CSE_ID"] = "xxx"os.environ["GOOGLE_API_KEY"] = "xxx"search = GoogleSearchAPIWrapper()# Initializeweb_research_retriever = WebResearchRetriever.from_llm(    vectorstore=vectorstore,    llm=llm,     search=search, )Run with citations‚ÄãWe can use RetrievalQAWithSourcesChain to retrieve docs and provide citations.from langchain.chains import RetrievalQAWithSourcesChainuser_input = "How do LLM Powered Autonomous Agents work?"qa_chain = RetrievalQAWithSourcesChain.from_chain_type(llm,retriever=web_research_retriever)result = qa_chain({"question":
Given a query, this retriever will:
Given a query, this retriever will: ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKGet startedIntroductionInstallationQuickstartLangChain Expression LanguageInterfaceHow toCookbookLangChain Expression Language (LCEL)Why use LCEL?ModulesModel I/‚ÄãORetrievalDocument loadersDocument transformersText embedding modelsVector storesRetrieversMultiQueryRetrieverContextual compressionEnsemble RetrieverMultiVector RetrieverParent Document RetrieverSelf-queryingTime-weighted vector store retrieverVector store-backed retrieverWebResearchRetrieverIndexingChainsMemoryAgentsCallbacksModulesSecurityGuidesMoreModulesRetrievalRetrieversWebResearchRetrieverOn this pageWebResearchRetrieverGiven a query, this retriever will: Formulate a set of relate Google searchesSearch for each Load all the resulting URLsThen embed and perform similarity search with the query on the consolidate page contentfrom langchain.retrievers.web_research import WebResearchRetrieverSimple usage‚ÄãSpecify the LLM to use for Google search query generation.import osfrom langchain.vectorstores import Chromafrom langchain.embeddings import OpenAIEmbeddingsfrom langchain.chat_models.openai import ChatOpenAIfrom langchain.utilities import GoogleSearchAPIWrapper# Vectorstorevectorstore = Chroma(embedding_function=OpenAIEmbeddings(),persist_directory="./chroma_db_oai")# LLMllm = ChatOpenAI(temperature=0)# Search os.environ["GOOGLE_CSE_ID"] = "xxx"os.environ["GOOGLE_API_KEY"] = "xxx"search = GoogleSearchAPIWrapper()# Initializeweb_research_retriever = WebResearchRetriever.from_llm(    vectorstore=vectorstore,    llm=llm,     search=search, )Run with citations‚ÄãWe can use RetrievalQAWithSourcesChain to retrieve docs and provide citations.from langchain.chains import RetrievalQAWithSourcesChainuser_input = "How do LLM Powered Autonomous Agents work?"qa_chain = RetrievalQAWithSourcesChain.from_chain_type(llm,retriever=web_research_retriever)result = qa_chain({"question":