Inspiration

Finding the best place to eat—especially with how expensive it is to eat out nowadays—can be a challenge. Whether you’re traveling in a place you've never been before, in a group of friends who can't seem to decide what they want to eat, or simply looking to try something new, the Yelp AI API is a powerful solution.

But not everyone wants to open a new app or browser tab just to talk to a chatbot and figure out where to eat—especially if they’re relaying all this information back and forth between a group chat and the chatbot. That’s where the Yelp/LINE chatbot comes in!

By integrating with the most popular chat app in countries like Japan and Taiwan, you can now interact with the Yelp AI API directly within your LINE chat.

What it does

The Yelp/LINE chatbot integrates directly into your LINE chat—whether in a direct message or a group conversation—and can incorporate both individual and group preferences when making recommendations.

We achieve this through a combination of prompt engineering and two types of preferences:

  1. User-defined preferences
    These are explicitly set by users via commands like:

    /diet gluten-free
    

    or

    /allergies shellfish
    

    These preferences, if they exist, are passed for each user in either a direct message or group chat.

  2. Behavioral preferences
    When the bot recommends a place, anyone in the conversation can like or dislike the recommendation. These reactions are stored in a Neo4j graph database and aggregated to create per-group “preference summaries” that are also passed to the Yelp AI API.

User-defined preferences follow the user across chats, while behavioral preferences are scoped per group chat.

This system provides the Yelp AI API with rich preference context, reducing the back-and-forth between users and the chatbot. The bot also maintains a rolling window of chat history and Yelp AI API chat sessions for six hours to optimize context size for both the OpenAI agent and the Yelp API. Sessions reset after six hours to account for new locations and preference changes.

To preserve access to older conversations, we use an MCP with vector embedding search in Postgres—so a query like “What were the sushi places you recommended yesterday?” can still retrieve the right messages.

How we built it

I utilized the OpenAI API to create an agent that parses user queries to determine the query type.

If the user is asking for:

  • A suggestion
  • Information
  • A recall

then the OpenAI agent uses MCP tools to gather user preferences or past chat history to build context before prompting the Yelp AI API. The response is then formatted into a LINE Flex Message that displays the information cleanly and interactively.

Challenges we ran into

We encountered several challenges when working with the OpenAI agent. LLMs are inherently non-deterministic, which makes it difficult to decide which MCPs to use and when to call the Yelp API. We solved this by classifying queries by type and invoking specific tools for each category—for example, using the chat history MCP for recall queries or pulling preference data for suggestion queries.

Another challenge was the limitations imposed by the LINE Messaging API. For example, in the behavioral feedback loop, users can like or dislike recommendations, but the buttons do not visually indicate whether they've already been pressed. To work around this, the bot sends message updates showing the current vote state.

What we learned

This project introduced me to several new technologies. Integrating MCPs with LLM agents required careful prompt engineering and came with plenty of growing pains. While I’ve used prompt engineering in other projects like RAG chatbots, working within a messaging platform meant I also had to focus on latency and performance.

I also used a graph database for the first time. Defining relationships was straightforward, but getting the agent to understand the data without passing every detail into context required experimentation. Ultimately, the solution was to store aggregated summaries in Postgres for each conversation, outlining cuisines the group liked or disliked.

What’s next for the Yelp LINE bot

If I were to expand this project, the first priority would be reducing latency. API latency is often the biggest bottleneck for chatbot applications, but with more users, caching would provide significant benefits. This could be done by hashing combination keys—such as preferences, location, and target (e.g., “Japanese,” “beer,” “dinner”)—into a Redis key.

Another fun addition would be analytics. Currently, the landing page serves as a demo and info hub, but it would be exciting to introduce features like leaderboards—for example, “spiciest eater” or “most diverse palate.” This could culminate in an annual “Wrapped”-style summary showing how your preferences evolved, your favorite spots, top cuisines, and more.

Built With

Share this project:

Updates