From 39815d6a7aeee983ea0b6c23f0980faa66925696 Mon Sep 17 00:00:00 2001 From: Christopher Bo Date: Mon, 3 Jun 2024 10:47:36 -0700 Subject: [PATCH] Python: Fix Bing Connector Setting Usage --- .../connectors/search_engine/bing_connector.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/semantic_kernel/connectors/search_engine/bing_connector.py b/python/semantic_kernel/connectors/search_engine/bing_connector.py index bcfca0867681..3d2b82cbdfac 100644 --- a/python/semantic_kernel/connectors/search_engine/bing_connector.py +++ b/python/semantic_kernel/connectors/search_engine/bing_connector.py @@ -62,11 +62,16 @@ async def search(self, query: str, num_results: int = 1, offset: int = 0) -> lis _base_url = ( "https://api.bing.microsoft.com/v7.0/custom/search" - if self._custom_config + if self._settings.custom_config else "https://api.bing.microsoft.com/v7.0/search" ) - _request_url = f"{_base_url}?q={urllib.parse.quote_plus(query)}&count={num_results}&offset={offset}" + ( - f"&customConfig={self._custom_config}" if self._custom_config else "" + _request_url = ( + f"{_base_url}?q={urllib.parse.quote_plus(query)}&count={num_results}&offset={offset}" + + ( + f"&customConfig={self._settings.custom_config}" + if self._settings.custom_config + else "" + ) ) logger.info(f"Sending GET request to {_request_url}")