# A synchronous browser is available, though it isn't compatible with jupyter.)async_browser = create_async_playwright_browser()toolkit = PlayWrightBrowserToolkit.from_browser(async_browser=async_browser)tools = toolkit.get_tools()tools_by_name = {tool.name: tool for tool in tools}print(tools_by_name.keys())navigate_tool = tools_by_name["navigate_browser"]extract_text = tools_by_name["extract_text"]from langchain.agents import initialize_agent, AgentTypefrom langchain.chat_models import ChatOpenAIfrom langchain.tools import MetaphorSearchResultsllm = ChatOpenAI(model_name="gpt-4", temperature=0.7)metaphor_tool = MetaphorSearchResults(api_wrapper=search)agent_chain = initialize_agent(    [metaphor_tool, extract_text, navigate_tool],    llm,    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,    verbose=True,)agent_chain.run(    "find me an interesting tweet about AI safety using Metaphor, then tell me the first sentence in the post. Do not finish until able to retrieve the first sentence.")PreviousLemon AgentNextNuclia UnderstandingUsing their SDKUse in an agentUsing the tool wrapperCall the APIAdding filtersUse Metaphor as a toolCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
Metaphor is a search engine fully designed to be used by LLMs. You can search and then get the contents for any page.
Metaphor is a search engine fully designed to be used by LLMs. You can search and then get the contents for any page. ->: # A synchronous browser is available, though it isn't compatible with jupyter.)async_browser = create_async_playwright_browser()toolkit = PlayWrightBrowserToolkit.from_browser(async_browser=async_browser)tools = toolkit.get_tools()tools_by_name = {tool.name: tool for tool in tools}print(tools_by_name.keys())navigate_tool = tools_by_name["navigate_browser"]extract_text = tools_by_name["extract_text"]from langchain.agents import initialize_agent, AgentTypefrom langchain.chat_models import ChatOpenAIfrom langchain.tools import MetaphorSearchResultsllm = ChatOpenAI(model_name="gpt-4", temperature=0.7)metaphor_tool = MetaphorSearchResults(api_wrapper=search)agent_chain = initialize_agent(    [metaphor_tool, extract_text, navigate_tool],    llm,    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,    verbose=True,)agent_chain.run(    "find me an interesting tweet about AI safety using Metaphor, then tell me the first sentence in the post. Do not finish until able to retrieve the first sentence.")PreviousLemon AgentNextNuclia UnderstandingUsing their SDKUse in an agentUsing the tool wrapperCall the APIAdding filtersUse Metaphor as a toolCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.