Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAlpha VantageApifyArXivAWS LambdaShell (bash)Bearly Code InterpreterBing SearchBrave SearchChatGPT PluginsDall-E Image GeneratorDataForSeoDuckDuckGo SearchEden AIEleven Labs Text2SpeechFile SystemGolden QueryGoogle DriveGoogle PlacesGoogle SearchGoogle SerperGradioGraphQLHuggingFace Hub ToolsHuman as a toolIFTTT WebHooksLemon AgentMetaphor SearchNuclia UnderstandingOpenWeatherMapPubMedRequestsSceneXplainSearch ToolsSearchApiSearxNG SearchSerpAPITwilioWikipediaWolfram AlphaYahoo Finance NewsYouTubeZapier Natural Language ActionsAgents and toolkitsMemoryCallbacksChat loadersComponentsToolsSearchApiOn this pageSearchApiThis notebook shows examples of how to use SearchApi to search the web. Go to https://www.searchapi.io/ to sign up for a free account and get API key.import osos.environ["SEARCHAPI_API_KEY"] = ""from langchain.utilities import SearchApiAPIWrappersearch = SearchApiAPIWrapper()search.run("Obama's first name?")    'Barack Hussein Obama II'Using as part of a Self Ask With Search Chain‚Äãos.environ["OPENAI_API_KEY"] = ""from langchain.utilities import SearchApiAPIWrapperfrom langchain.llms.openai import OpenAIfrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypellm = OpenAI(temperature=0)search = SearchApiAPIWrapper()tools = [    Tool(        name="Intermediate Answer",        func=search.run,        description="useful for when you need to ask with search"    )]self_ask_with_search = initialize_agent(tools, llm, agent=AgentType.SELF_ASK_WITH_SEARCH, verbose=True)self_ask_with_search.run("Who lived longer: Plato, Socrates, or Aristotle?")            > Entering new AgentExecutor chain...     Yes.    Follow up: How old was Plato when he died?
This notebook shows examples of how to use SearchApi to search the web. Go to https://www.searchapi.io/ to sign up for a free account and get API key.
This notebook shows examples of how to use SearchApi to search the web. Go to https://www.searchapi.io/ to sign up for a free account and get API key. ->: Skip to main contentü¶úÔ∏èüîó LangChainDocsUse casesIntegrationsAPICommunityChat our docsLangSmithJS/TS DocsSearchCTRLKProvidersAnthropicAWSGoogleMicrosoftOpenAIMoreComponentsLLMsChat modelsDocument loadersDocument transformersText embedding modelsVector storesRetrieversToolsAlpha VantageApifyArXivAWS LambdaShell (bash)Bearly Code InterpreterBing SearchBrave SearchChatGPT PluginsDall-E Image GeneratorDataForSeoDuckDuckGo SearchEden AIEleven Labs Text2SpeechFile SystemGolden QueryGoogle DriveGoogle PlacesGoogle SearchGoogle SerperGradioGraphQLHuggingFace Hub ToolsHuman as a toolIFTTT WebHooksLemon AgentMetaphor SearchNuclia UnderstandingOpenWeatherMapPubMedRequestsSceneXplainSearch ToolsSearchApiSearxNG SearchSerpAPITwilioWikipediaWolfram AlphaYahoo Finance NewsYouTubeZapier Natural Language ActionsAgents and toolkitsMemoryCallbacksChat loadersComponentsToolsSearchApiOn this pageSearchApiThis notebook shows examples of how to use SearchApi to search the web. Go to https://www.searchapi.io/ to sign up for a free account and get API key.import osos.environ["SEARCHAPI_API_KEY"] = ""from langchain.utilities import SearchApiAPIWrappersearch = SearchApiAPIWrapper()search.run("Obama's first name?")    'Barack Hussein Obama II'Using as part of a Self Ask With Search Chain‚Äãos.environ["OPENAI_API_KEY"] = ""from langchain.utilities import SearchApiAPIWrapperfrom langchain.llms.openai import OpenAIfrom langchain.agents import initialize_agent, Toolfrom langchain.agents import AgentTypellm = OpenAI(temperature=0)search = SearchApiAPIWrapper()tools = [    Tool(        name="Intermediate Answer",        func=search.run,        description="useful for when you need to ask with search"    )]self_ask_with_search = initialize_agent(tools, llm, agent=AgentType.SELF_ASK_WITH_SEARCH, verbose=True)self_ask_with_search.run("Who lived longer: Plato, Socrates, or Aristotle?")            > Entering new AgentExecutor chain...     Yes.    Follow up: How old was Plato when he died?