Skip to main content

LlamaIndex integration for BuyWhere — search products, discover deals, and browse categories through the BuyWhere product catalog API

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_buywhere-0.1.0.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_buywhere-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_buywhere-0.1.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_tools_buywhere-0.1.0.tar.gz
Algorithm Hash digest
SHA256 95147aeebd0374d0ededa328cd82c464cbfbaeadd60fca89a6b7813b99387c84
MD5 039c62afb28d4750d77c08b55334e877
BLAKE2b-256 edb93a65969233b2015e6ec4eff22679e5873061253567e2a8565b3ad30ba4c8

See more details on using hashes here.

File details

Details for the file llama_index_tools_buywhere-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_buywhere-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9cdbe988a1d998fd548d11282e630d4f9029b955eec3de7e350278a65eb07e6d
MD5 c6fcfab6be449a343e0b740053e63a77
BLAKE2b-256 77d075ebbe559fb2e9537d1678f7f821b7caa116c7ca3b6a3c7936cdc747665a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page