Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Feat: support json output for bing-search (#10904)
Xu Song8c2f62fb92b5
diff --git a/api/core/tools/provider/builtin/bing/tools/bing_web_search.py b/api/core/tools/provider/builtin/bing/tools/bing_web_search.pyindex 8bed2c556cf..1afe2f83855 100644--- a/api/core/tools/provider/builtin/bing/tools/bing_web_search.py+++ b/api/core/tools/provider/builtin/bing/tools/bing_web_search.py@@ -66,6 +66,41 @@ class BingSearchTool(BuiltinTool):results.append(self.create_text_message(text=f'{related.get("displayText", "")}{url}'))return results+ elif result_type == "json":+ result = {}+ if search_results:+ result["organic"] = [+ {+ "title": item.get("name", ""),+ "snippet": item.get("snippet", ""),+ "url": item.get("url", ""),+ "siteName": item.get("siteName", ""),+ }+ for item in search_results+ ]++ if computation and "expression" in computation and "value" in computation:+ result["computation"] = {"expression": computation["expression"], "value": computation["value"]}++ if entities:+ result["entities"] = [+ {+ "name": item.get("name", ""),+ "url": item.get("url", ""),+ "description": item.get("description", ""),+ }+ for item in entities+ ]++ if news:+ result["news"] = [{"name": item.get("name", ""), "url": item.get("url", "")} for item in news]++ if related_searches:+ result["related searches"] = [+ {"displayText": item.get("displayText", ""), "url": item.get("webSearchUrl", "")} for item in news+ ]++ return self.create_json_message(result)else:# construct texttext = ""diff --git a/api/core/tools/provider/builtin/bing/tools/bing_web_search.yaml b/api/core/tools/provider/builtin/bing/tools/bing_web_search.yamlindex a3f60bb09b6..f5c932c37b3 100644--- a/api/core/tools/provider/builtin/bing/tools/bing_web_search.yaml+++ b/api/core/tools/provider/builtin/bing/tools/bing_web_search.yaml@@ -113,9 +113,9 @@ parameters:zh_Hans: 结果类型pt_BR: result typehuman_description:- en_US: return a list of links or texts- zh_Hans: 返回一个连接列表还是纯文本内容- pt_BR: return a list of links or texts+ en_US: return a list of links, json or texts+ zh_Hans: 返回一个列表,内容是链接、json还是纯文本+ pt_BR: return a list of links, json or textsdefault: textoptions:- value: link@@ -123,6 +123,11 @@ parameters:en_US: Linkzh_Hans: 链接pt_BR: Link+ - value: json+ label:+ en_US: JSON+ zh_Hans: JSON+ pt_BR: JSON- value: textlabel:en_US: Text