litellm - 💡(How to fix) Fix Example: Singapore product catalog API (BuyWhere) as an agent tool via LiteLLM [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
BerriAI/litellm#26494Fetched 2026-04-26 05:06:38
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Author
Timeline (top)
commented ×1

Code Example

import litellm

def search_singapore_products(query: str) -> dict:
    import requests
    return requests.get(f"https://api.buywhere.ai/search?q={query}").json()

tools = [{
    "type": "function",
    "function": {
        "name": "search_singapore_products",
        "description": "Search real-time Singapore product prices (Harvey Norman, Shopee, Lazada)",
        "parameters": {"type": "object", "properties": {"query": {"type": "string"}}}
    }
}]

response = litellm.completion(
    model="claude-3-5-sonnet-20241022",
    messages=[{"role": "user", "content": "Where is the cheapest iPhone 16 in Singapore?"}],
    tools=tools
)
RAW_BUFFERClick to expand / collapse

BuyWhere + LiteLLM: Real-time Product Data for AI Agents

Hi LiteLLM team,

Wanted to flag a data source that pairs naturally with LiteLLM for agentic workflows: BuyWhere, a real-time Singapore product catalog API.

BuyWhere lets agents fetch live prices from Singapore e-commerce stores (Harvey Norman, Shopee, Lazada) via a single REST call. Great for demonstrating LiteLLM routing with tool use.

Example Pattern

import litellm

def search_singapore_products(query: str) -> dict:
    import requests
    return requests.get(f"https://api.buywhere.ai/search?q={query}").json()

tools = [{
    "type": "function",
    "function": {
        "name": "search_singapore_products",
        "description": "Search real-time Singapore product prices (Harvey Norman, Shopee, Lazada)",
        "parameters": {"type": "object", "properties": {"query": {"type": "string"}}}
    }
}]

response = litellm.completion(
    model="claude-3-5-sonnet-20241022",
    messages=[{"role": "user", "content": "Where is the cheapest iPhone 16 in Singapore?"}],
    tools=tools
)

Full API docs at https://buywhere.ai/developers/. Happy to contribute a cookbook example or provide an API key for testing.


Disclosure: I work on the BuyWhere team.

extent analysis

TL;DR

To integrate BuyWhere with LiteLLM for real-time product data, use the provided example pattern as a starting point and ensure you have a valid API key from BuyWhere.

Guidance

  • Review the BuyWhere API documentation at https://buywhere.ai/developers/ to understand the requirements for API keys and usage guidelines.
  • Implement the search_singapore_products function as shown in the example, adapting it as necessary for your specific use case.
  • Ensure that the LiteLLM model and tools configuration are correctly set up to utilize the BuyWhere API for real-time product price fetching.
  • Test the integration with a valid API key to verify functionality.

Example

The provided Python code snippet demonstrates how to integrate BuyWhere with LiteLLM:

import requests

def search_singapore_products(query: str) -> dict:
    return requests.get(f"https://api.buywhere.ai/search?q={query}").json()

This example assumes you have a valid API key, which should be included in the API request for authentication.

Notes

The integration requires a valid BuyWhere API key, which is not provided in the issue. You will need to obtain this key from the BuyWhere team or through their developer portal.

Recommendation

Apply the workaround by using the provided example pattern and obtaining a valid BuyWhere API key for testing and production use. This approach allows for real-time product data integration with LiteLLM.

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

litellm - 💡(How to fix) Fix Example: Singapore product catalog API (BuyWhere) as an agent tool via LiteLLM [1 comments, 2 participants]