Skip to content

Commit

Permalink
Add required package docstring_parser to setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
DavdGao committed Feb 4, 2024
1 parent 39b301d commit 43eca62
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/agentscope/service/sql_query/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ 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`):
The name of the database to use.
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`):
Expand Down
2 changes: 1 addition & 1 deletion src/agentscope/service/sql_query/sqlite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`):
Expand Down
30 changes: 13 additions & 17 deletions tests/service_factory_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 43eca62

Please sign in to comment.