File size: 1,227 Bytes
a573bfb e2523de a573bfb a516261 a573bfb e2523de a573bfb e2523de a573bfb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
from smolagents import Tool
from my_base_wiki_api import MyWikiAPI
#AUTHORIZED_TYPES = [
# "string",
# "boolean",
# "integer",
# "number",
# "image",
# "audio",
# "array",
# "object",
# "any",
# "null",
#]
class MyWikiFeaturedArticles(Tool):
name = "_my_tool_wiki_featured_articles"
description = """
Extracts a list of nominators and summaries of featured Wikipedia articles for the provided month and year
To invoke the tool use code as below
<code>
featured_articles = _my_tool_wiki_featured_articles(month='January', year=2005)
</code>
"""
inputs = {
"month": {
"type": "string",
"description": "name of the month for example January",
},
"year": {
"type": "integer",
"description": "Year expressed in 4 digit notation, for example 2009",
},
}
output_type = "string"
is_initialized = True
def __init__(self):
print(f"***KS*** Wiki featured articles tool initializing ...")
self.wiki = MyWikiAPI()
def forward(self, month, year):
result = self.wiki.get_featured_articles(month, year)
return result
|