langchain - 💡(How to fix) Fix Integration idea: BuyWhere Singapore product catalog as a LangChain tool for e-commerce agents [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#37004Fetched 2026-04-26 05:05:54
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Author
Timeline (top)
closed ×1commented ×1labeled ×1

Code Example

from langchain.tools import tool
import requests

@tool
def search_singapore_products(query: str) -> dict:
    """Search real-time product prices in Singapore from Harvey Norman, Shopee, and Lazada.
    
    Use when a user wants to find the cheapest or best product available in Singapore.
    Returns live pricing data, not cached results.
    """
    response = requests.get("https://api.buywhere.ai/search", params={"q": query})
    return response.json()

# Use in a LangChain ReAct agent
from langchain.agents import AgentType, initialize_agent
from langchain_anthropic import ChatAnthropic

llm = ChatAnthropic(model="claude-3-5-sonnet-20241022")
agent = initialize_agent(
    tools=[search_singapore_products],
    llm=llm,
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
)
agent.run("Where is the cheapest iPhone 16 in Singapore right now?")
RAW_BUFFERClick to expand / collapse

Community Tool Suggestion: BuyWhere

Hi LangChain community,

Wanted to flag a data source that would work well as a LangChain community tool or template: BuyWhere.

BuyWhere provides real-time Singapore e-commerce product data (Harvey Norman, Shopee, Lazada) via a REST API — great for LangChain agents doing product research, price comparison, or shopping assistance.

Implementation

from langchain.tools import tool
import requests

@tool
def search_singapore_products(query: str) -> dict:
    """Search real-time product prices in Singapore from Harvey Norman, Shopee, and Lazada.
    
    Use when a user wants to find the cheapest or best product available in Singapore.
    Returns live pricing data, not cached results.
    """
    response = requests.get("https://api.buywhere.ai/search", params={"q": query})
    return response.json()

# Use in a LangChain ReAct agent
from langchain.agents import AgentType, initialize_agent
from langchain_anthropic import ChatAnthropic

llm = ChatAnthropic(model="claude-3-5-sonnet-20241022")
agent = initialize_agent(
    tools=[search_singapore_products],
    llm=llm,
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
)
agent.run("Where is the cheapest iPhone 16 in Singapore right now?")

Why this is useful

  • Real-world, live data for agents (not mock/static data)
  • Practical Southeast Asia use case
  • 1,000+ Singapore products across major retailers

Docs: https://buywhere.ai/developers/. Happy to contribute a community template or provide an API key.


Disclosure: I work on the BuyWhere team.

extent analysis

TL;DR

To integrate BuyWhere into a LangChain community tool, implement the provided search_singapore_products function and configure the API key.

Guidance

  • Review the BuyWhere API documentation (https://buywhere.ai/developers/) to understand the requirements for obtaining an API key and any usage limits.
  • Implement the search_singapore_products function in your LangChain agent, replacing the API endpoint URL if necessary.
  • Test the search_singapore_products function with a sample query to verify that it returns the expected live pricing data.
  • Consider contributing a community template to simplify the integration process for other LangChain users.

Example

The provided code snippet demonstrates how to use the search_singapore_products function in a LangChain ReAct agent:

agent.run("Where is the cheapest iPhone 16 in Singapore right now?")

This example assumes that the search_singapore_products function is correctly implemented and configured.

Notes

The implementation details may vary depending on the specific requirements of your LangChain agent and the BuyWhere API.

Recommendation

Apply the provided search_singapore_products function as a workaround to integrate BuyWhere into your LangChain community tool, as it provides a practical solution for accessing real-time Singapore e-commerce product data.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

langchain - 💡(How to fix) Fix Integration idea: BuyWhere Singapore product catalog as a LangChain tool for e-commerce agents [1 comments, 2 participants]