DataForSEO
DataForSeo provides comprehensive SEO and digital marketing data solutions via API.
This page provides instructions on how to use the DataForSEO search APIs within LangChain.
Installation and Setupβ
Get a DataForSEO API Access login and password, and set them as environment variables
(DATAFORSEO_LOGIN
and DATAFORSEO_PASSWORD
respectively).
import os
os.environ["DATAFORSEO_LOGIN"] = "your_login"
os.environ["DATAFORSEO_PASSWORD"] = "your_password"
Utilityβ
The DataForSEO utility wraps the API. To import this utility, use:
from langchain_community.utilities.dataforseo_api_search import DataForSeoAPIWrapper
API Reference:DataForSeoAPIWrapper
For a detailed walkthrough of this wrapper, see this notebook.
Toolβ
You can also load this wrapper as a Tool to use with an Agent:
from langchain.agents import load_tools
tools = load_tools(["dataforseo-api-search"])
API Reference:load_tools
Example usageβ
dataforseo = DataForSeoAPIWrapper(api_login="your_login", api_password="your_password")
result = dataforseo.run("Bill Gates")
print(result)