-
Notifications
You must be signed in to change notification settings - Fork 0
/
bing_search.flow.json
117 lines (117 loc) · 3.32 KB
/
bing_search.flow.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
{
"name": "bing_search",
"type": "serial",
"description": "Search relevant information from billions of web documents using Bing.",
"input": {
"schema": {
"input": {
"type": "object",
"required": [
"query"
],
"properties": {
"endpoint": {
"type": "string",
"description": "The HTTP request URI.",
"default": "https://api.bing.microsoft.com/v7.0/search"
},
"subscription_key": {
"type": "string",
"description": "The user's search query term.",
"default": "${getenv(\"BING_SEARCH_V7_SUBSCRIPTION_KEY\")}"
},
"query": {
"type": "string",
"description": "The user's search query term."
},
"market": {
"type": "string",
"description": "The market where the results come from.",
"default": "en-US"
},
"offset": {
"type": "integer",
"description": "The zero-based offset that indicates the number of search results to skip before returning results. The default is 0.",
"default": 0
},
"count": {
"type": "integer",
"description": "The number of search results to return in the response. The default is 10 and the maximum value is 50.",
"default": 10
}
}
},
"output": {
"type": "object",
"properties": {
"webPages": {
"type": "object",
"properties": {
"value": {
"type": "array",
"items": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"name": {
"type": "string"
},
"snippet": {
"type": "string"
}
}
}
}
}
}
}
}
},
"tasks": [
{
"name": "search",
"type": "http",
"input": {
"query": {
"q": "${input.query}",
"mkt": "${input.market or \"en-US\"}",
"offset": "${0 if input.offset == None else input.offset}",
"count": "${10 if input.count == None else input.count}"
},
"header": {
"Ocp-Apim-Subscription-Key": [
"${input.subscription_key or getenv(\"BING_SEARCH_V7_SUBSCRIPTION_KEY\")}"
]
},
"method": "GET",
"uri": "${input.endpoint or \"https://api.bing.microsoft.com/v7.0/search\"}"
}
},
{
"name": "success",
"type": "decision",
"input": {
"expression": "${str(search.status == 200)}",
"cases": {
"True": {
"name": "response",
"type": "terminate",
"input": {
"output": "${search.body}"
}
},
"False": {
"name": "failure",
"type": "terminate",
"input": {
"error": "${search.body.error.message}"
}
}
}
}
}
]
}
}