Skip to content

Commit c97f0ff

Browse files
authored
[Feat] browser should support custom base url for bing search (#2321)
* feat: browser is now support custom base url * fix: replae the base url position. * Update bing_base_url parameter in SimpleTextBrowser class
1 parent 0c5aed0 commit c97f0ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

autogen/browser_utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __init__(
3636
start_page: Optional[str] = None,
3737
viewport_size: Optional[int] = 1024 * 8,
3838
downloads_folder: Optional[Union[str, None]] = None,
39+
bing_base_url: str = "https://api.bing.microsoft.com/v7.0/search",
3940
bing_api_key: Optional[Union[str, None]] = None,
4041
request_kwargs: Optional[Union[Dict[str, Any], None]] = None,
4142
):
@@ -47,6 +48,7 @@ def __init__(
4748
self.viewport_current_page = 0
4849
self.viewport_pages: List[Tuple[int, int]] = list()
4950
self.set_address(self.start_page)
51+
self.bing_base_url = bing_base_url
5052
self.bing_api_key = bing_api_key
5153
self.request_kwargs = request_kwargs
5254

@@ -145,7 +147,7 @@ def _bing_api_call(self, query: str) -> Dict[str, Dict[str, List[Dict[str, Union
145147
request_kwargs["stream"] = False
146148

147149
# Make the request
148-
response = requests.get("https://api.bing.microsoft.com/v7.0/search", **request_kwargs)
150+
response = requests.get(self.bing_base_url, **request_kwargs)
149151
response.raise_for_status()
150152
results = response.json()
151153

0 commit comments

Comments
 (0)