Skip to main content

LangChain integration toolkit for the BuyWhere product catalog API

Project description

BuyWhere LangChain Integration

LangChain tools for the BuyWhere product catalog API. Add product search, price comparison, and affiliate links to any LangChain agent.

Installation

pip install buywhere-langchain

Quick Start

from langchain.agents import create_react_agent, AgentExecutor
from langchain_openai import ChatOpenAI
from buywhere_langchain import BuyWhereToolkit

toolkit = BuyWhereToolkit(api_key="bw_live_xxx")
tools = toolkit.get_tools()

llm = ChatOpenAI(model="gpt-4o")
agent = create_react_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools)

result = agent_executor.invoke({"input": "find me a laptop under $1000 in Singapore"})
print(result["output"])

Available Tools

Tool Description
buywhere_search Search products by name, brand, category, price range
buywhere_get_product Get full details for a specific product
buywhere_get_price Get pricing across all merchants
buywhere_compare_prices Compare 2-5 products side by side
buywhere_get_affiliate_link Get an affiliate-tracking URL for a product
buywhere_get_catalog List all product categories
buywhere_find_best_price Find the cheapest listing for a product across all platforms
buywhere_get_deals Find discounted products sorted by discount depth

LangGraph

from langgraph.prebuilt import ToolNode

tool_node = ToolNode(toolkit.get_tools())

Error Handling

Tools return typed errors for auth failures, rate limits, and not-found:

  • BuyWhereError — base exception
  • RateLimitError — retry with backoff
  • AuthenticationError — invalid API key
  • NotFoundError — product/resource not found

Get an API Key

Sign up at buywhere.ai to get your API key.

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

buywhere_langchain-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

buywhere_langchain-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: buywhere_langchain-0.1.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for buywhere_langchain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ad333990303fb666bac89b458cf78d14fb6bbe9ecdc6258420f428e788acc9eb
MD5 c38f083232a919228d17365dd062c17f
BLAKE2b-256 e87917d9d798c47097d1e860fad6ba6876c03573d88b266b3ae30ae8f16f630d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for buywhere_langchain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 15b83fd3112d5daa646d95e462e2385ffa3d6c956c57dd8274109002b89303d7
MD5 4f56963b503bfa5e0b1aea57279e2d30
BLAKE2b-256 827f0dbf3bbaec018a1cc02aaecb8c0df0d8d3839693b916d9999a5c5e07c15d

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