mirror of https://github.com/microsoft/autogen.git
[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
This commit is contained in:
parent
0c5aed0489
commit
c97f0ffc3c
|
@ -36,6 +36,7 @@ class SimpleTextBrowser:
|
|||
start_page: Optional[str] = None,
|
||||
viewport_size: Optional[int] = 1024 * 8,
|
||||
downloads_folder: Optional[Union[str, None]] = None,
|
||||
bing_base_url: str = "https://api.bing.microsoft.com/v7.0/search",
|
||||
bing_api_key: Optional[Union[str, None]] = None,
|
||||
request_kwargs: Optional[Union[Dict[str, Any], None]] = None,
|
||||
):
|
||||
|
@ -47,6 +48,7 @@ class SimpleTextBrowser:
|
|||
self.viewport_current_page = 0
|
||||
self.viewport_pages: List[Tuple[int, int]] = list()
|
||||
self.set_address(self.start_page)
|
||||
self.bing_base_url = bing_base_url
|
||||
self.bing_api_key = bing_api_key
|
||||
self.request_kwargs = request_kwargs
|
||||
|
||||
|
@ -145,7 +147,7 @@ class SimpleTextBrowser:
|
|||
request_kwargs["stream"] = False
|
||||
|
||||
# Make the request
|
||||
response = requests.get("https://api.bing.microsoft.com/v7.0/search", **request_kwargs)
|
||||
response = requests.get(self.bing_base_url, **request_kwargs)
|
||||
response.raise_for_status()
|
||||
results = response.json()
|
||||
|
||||
|
|
Loading…
Reference in New Issue