Skip to main content

llama-index-tools-buywhere

BuyWhere product catalog tools for LlamaIndex agents. Search products, discover deals, and browse categories across 1.5M+ products from Shopee, Lazada, Amazon, Walmart, and 20+ platforms.

pip install llama-index-tools-buywhere

Quick Start

import os
from llama_index.tools.buywhere import BuyWhereToolSpec
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

os.environ["BUYWHERE_API_KEY"] = "bw_live_xxx"

tool_spec = BuyWhereToolSpec()
agent = FunctionAgent(
    tools=tool_spec.to_tool_list(),
    llm=OpenAI(model="gpt-4o"),
    system_prompt="You are a helpful shopping assistant.",
)

response = agent.run("find wireless headphones under SGD 50 in Singapore")
print(response)

Tools

Tool Description
search_products Full-text search with price, category, merchant, and region filters
get_deals Discounted products sorted by discount percentage
list_categories Browse available product categories with counts

API

BuyWhereToolSpec

Method Returns Description
to_tool_list() list[FunctionTool] All 3 tools as LlamaIndex FunctionTool instances
to_tool_dict() dict[str, FunctionTool] Tools keyed by name

Constructor:

BuyWhereToolSpec(
    api_key: str | None = None,      # API key or BUYWHERE_API_KEY env var
    base_url: str = "https://api.buywhere.ai",
    timeout: float = 30.0,
)

Error Handling

Exception When
BuyWhereAuthError Missing, invalid, or expired API key
BuyWhereNetworkError Timeout, connection failure, or HTTP error
BuyWhereRateLimitError Rate limit exceeded (HTTP 429)

All tool methods return list[Document] — LlamaIndex Document objects with structured metadata for downstream processing.

Metadata

Release files for llama-index-tools-buywhere 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llama-index-tools-buywhere 0.1.0
File Size Uploaded
llama_index_tools_buywhere-0.1.0.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-tools-buywhere 0.1.0
File Interpreter ABI Platform
llama_index_tools_buywhere-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / llama_index_tools_buywhere-0.1.0.tar.gz

Download URL llama_index_tools_buywhere-0.1.0.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
95147aeebd0374d0ededa328cd82c464cbfbaeadd60fca89a6b7813b99387c84
BLAKE2b-256 checksum
How to use checksums
edb93a65969233b2015e6ec4eff22679e5873061253567e2a8565b3ad30ba4c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / llama_index_tools_buywhere-0.1.0-py3-none-any.whl

Download URL llama_index_tools_buywhere-0.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9cdbe988a1d998fd548d11282e630d4f9029b955eec3de7e350278a65eb07e6d
BLAKE2b-256 checksum
How to use checksums
77d075ebbe559fb2e9537d1678f7f821b7caa116c7ca3b6a3c7936cdc747665a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page