diff --git a/src/agentscope/service/sql_query/mongodb.py b/src/agentscope/service/sql_query/mongodb.py index 09ff4f3c4..a1d1ec2d6 100644 --- a/src/agentscope/service/sql_query/mongodb.py +++ b/src/agentscope/service/sql_query/mongodb.py @@ -20,7 +20,7 @@ def query_mongodb( maxcount_results: Optional[int] = None, **kwargs: Any, ) -> ServiceResponse: - """Searches the MongoDB database for documents matching the query. + """Execute query within MongoDB database. Args: database (`str`): @@ -28,7 +28,7 @@ def query_mongodb( collection (`str`): The name of the collection to use in mongodb. query (`dict`): - The mongodb query to execute. Note that the query is a dictionary. + The mongodb query to execute. host (`str`): The hostname or IP address of the MongoDB server. port (`int`): diff --git a/src/agentscope/service/sql_query/sqlite.py b/src/agentscope/service/sql_query/sqlite.py index d921f2af1..52bed0f39 100644 --- a/src/agentscope/service/sql_query/sqlite.py +++ b/src/agentscope/service/sql_query/sqlite.py @@ -20,7 +20,7 @@ def query_sqlite( maxcount_results: Optional[int] = None, **kwargs: Any, ) -> ServiceResponse: - """Executes a query on a sqlite database and returns the results. + """Executes query within sqlite database. Args: database (`str`): diff --git a/tests/service_factory_test.py b/tests/service_factory_test.py index 9df195de9..85fcb3b63 100644 --- a/tests/service_factory_test.py +++ b/tests/service_factory_test.py @@ -27,45 +27,41 @@ def test_bing_search(self) -> None: """Test bing_search.""" # api_key is specified by developer, while question and num_results # are specified by model - _, doc_dict = ServiceFactory.get(bing_search, bing_api_key="xxx") - + _, doc_dict = ServiceFactory.get(bing_search, api_key="xxx") + print(json.dumps(doc_dict, indent=4)) self.assertDictEqual( doc_dict, { "type": "function", "function": { "name": "bing_search", - "description": ( - "Search question in Bing Search API and " - "return the searching results" - ), + "description": "Search question in Bing Search API and return the searching results", "parameters": { "type": "object", "properties": { "num_results": { "type": "number", - "description": ( - "The number of search " - "results to return." - ), - "default": 10, + "description": "The number of search results to return.", + "default": 10 }, "question": { "type": "string", - "description": "The search query string.", + "description": "The search query string." }, }, - "required": ["question"], - }, - }, - }, + "required": [ + "question" + ] + } + } + } ) # Set num_results by developer rather than model _, doc_dict = ServiceFactory.get( bing_search, num_results=3, - bing_api_key="xxx", + api_key="xxx", ) self.assertDictEqual(