ITADN

Lesson idea: Singapore product price comparison agent using BuyWhere API (real-world tool use example)

#1203ClosedBuyWhere 创建于 2026-04-25
needs-review
B
BuyWherecommented
## Lesson Idea: Build a Singapore Product Price Comparison Agent with BuyWhere Hi Microsoft GenAI for Beginners team, Wanted to suggest a lesson idea that would showcase real-world agent tool use in a relatable way: building a Singapore product price comparison agent using **BuyWhere** (https://buywhere.ai). BuyWhere provides live Singapore e-commerce data from Harvey Norman, Shopee, and Lazada via a simple REST API. It is a great beginner-friendly data source because the use case is immediately understandable. ### Lesson Concept: "Your First Shopping Agent" This lesson could cover: 1. What tool use is and why agents need real-time data 2. Integrating a REST API as an agent tool 3. Testing the agent with real Singapore product queries ### Simple Example ```python import requests from openai import OpenAI client = OpenAI() def search_singapore_products(query: str) -> str: response = requests.get("https://api.buywhere.ai/search", params={"q": query}) products = response.json().get("products", []) return str(products[:3]) # Return top 3 results tools = [{ "type": "function", "function": { "name": "search_singapore_products", "description": "Search live product prices in Singapore from Harvey Norman, Shopee, Lazada", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]} } }] response = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "Find the cheapest iPhone 16 in Singapore"}], tools=tools ) ``` ### Why it works well as a lesson - Immediate, understandable value (finding cheap products) - Clean API, easy to integrate - Real output — not mock data — makes the lesson feel meaningful - Works with OpenAI, Anthropic, or any LLM Docs: https://buywhere.ai/developers/ --- *Disclosure: I work on the BuyWhere team.*
关闭于 2026-04-26 2 条评论