算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
serpapi-core-workflow-b【设计与创意】Design a multi-engine SerpAPI workflow with explicit parameter maps, result adapters, budgets, and provenance. Use when combining Google, Bing, YouTube, News, Shopping, or Maps. Trigger with "build a SerpAPI multi-engine search".
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Model each engine as a distinct contract, then normalize only the fields needed for a cross-engine product.
Use Read, Glob, and Grep to map engine consumers, WebFetch to verify each engine's current parameters and response sections, and Write or Edit for parameter maps, adapters, tests, and redacted receipts.
Engine contracts are not interchangeable. Google, Bing, Google News, and Google Shopping accept q; YouTube uses search_query; Google Maps search uses q with type=search and can use ll. Common result sections include organic_results, video_results, news_results, shopping_results, and local_results, but their records have different shapes.
Supply SERPAPI_KEY only through the server-side gateway. Preserve engine and search ID for provenance, but strip the key and key-bearing URLs from normalized output.
engine, search_id, source URL, rank, and engine-specific payload where required.Return the engine contract table, request map, normalized tagged-union schema, partial-failure policy, budget, per-engine counts and search IDs, and fixture results.
| Condition | Response |
|---|---|
| Wrong query parameter | Reject locally using the engine map. |
| One engine fails | Return an explicit partial result if policy allows; keep failure provenance. |
| Cross-engine duplicate | Retain source-engine ranks and apply a documented canonical-link policy. |
| Engine schema drifts | Quarantine only that engine's adapter and replay its fixture suite. |
ENGINE_MAP = {
"google": ("q", "organic_results"),
"bing": ("q", "organic_results"),
"youtube": ("search_query", "video_results"),
"google_news": ("q", "news_results"),
"google_shopping": ("q", "shopping_results"),
"google_maps": ("q", "local_results"),
}
def build_request(engine, query):
query_key, _ = ENGINE_MAP[engine]
request = {"engine": engine, query_key: query}
if engine == "google_maps":
request["type"] = "search"
return request
Canary each engine separately, then enable the combined workflow within the aggregate search budget.