Search Yelp and Fetch Business Reviews
Yelp Tool connects to Yelp and allows agents to search for businesses and fetch reviews.
Why it matters
Leverage Yelp's extensive business data to find relevant establishments and retrieve customer reviews. This tool empowers agents to perform targeted local business research and gather insights directly from user feedback.
Outcomes
What it gets done
Search for businesses using natural language queries.
Retrieve detailed reviews for specific businesses using their ID.
Integrate Yelp data into agent-driven workflows for local business analysis.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/li-tool-tools-yelp | bash Overview
Yelp Tool
Yelp Tool connects to Yelp and allows agents to search for businesses and fetch reviews. It provides two functions: business_search uses a natural language query to search for businesses, and business_reviews uses a business ID to fetch reviews. The tool is designed to be used as a way to load data as a Tool in an Agent. Use Yelp Tool when you need to search for businesses or fetch reviews from Yelp. The source material demonstrates queries like "what good restaurants are in toronto" and "what are the details of lao lao bar."
What it does
Yelp Tool connects to Yelp and allows agents to search for businesses and fetch reviews. The tool provides business_search to search for businesses using natural language queries and business_reviews to fetch reviews using a business ID.
When to use - and when NOT to
Use Yelp Tool when you need to search for businesses or fetch reviews from Yelp. The source material demonstrates queries like "what good restaurants are in toronto" and "what are the details of lao lao bar."
Do not use this tool if you need capabilities beyond business search and review retrieval, as only these two functions are documented in the source material.
Inputs and outputs
The tool requires a Yelp API key and client ID during initialization. It provides two functions: business_search uses a natural language query to search for businesses, and business_reviews uses a business ID to fetch reviews.
Integrations
The source material shows YelpToolSpec being used with FunctionAgent and OpenAI. The tool is designed to be used as a way to load data as a Tool in an Agent.
from llama_index.tools.yelp import YelpToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
tool_spec = YelpToolSpec(api_key="your-key", client_id="your-id")
agent = FunctionAgent(
tools=tool_spec.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
print(await agent.run("what good restaurants are in toronto"))
print(await agent.run("what are the details of lao lao bar"))
Source README
Yelp Tool
This tool connects to Yelp and allows the Agent to search for business and fetch the reviews.
Usage
This tool has more extensive example usage documented in a Jupyter notebook here
Here's an example usage of the YelpToolSpec.
from llama_index.tools.yelp import YelpToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI
tool_spec = YelpToolSpec(api_key="your-key", client_id="your-id")
agent = FunctionAgent(
tools=tool_spec.to_tool_list(),
llm=OpenAI(model="gpt-4.1"),
)
print(await agent.run("what good restaurants are in toronto"))
print(await agent.run("what are the details of lao lao bar"))
business_search: Use a natural language query to search for businessesbusiness_reviews: Use a business id to fetch reviews
This loader is designed to be used as a way to load data as a Tool in a Agent.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.