WeByT3 commited on
Commit
65da152
·
verified ·
1 Parent(s): c7c231e

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +6 -1
tools.py CHANGED
@@ -62,7 +62,12 @@ def wikidata_search_tool(sparql_query: str) -> str:
62
 
63
  Example:
64
  {"message": "How many albums did the Beatles produce between 1965 and 1968?"}
65
- wikidata_search_tool("The Beatles albums")
 
 
 
 
 
66
  """
67
  endpoint_url = "https://query.wikidata.org/sparql"
68
  headers = {"Accept": "application/sparql-results+json"}
 
62
 
63
  Example:
64
  {"message": "How many albums did the Beatles produce between 1965 and 1968?"}
65
+ wikidata_search_tool("SELECT (COUNT(DISTINCT ?album) AS ?albumCount) WHERE {
66
+ ?album wdt:P31 wd:Q482994; # instance of album
67
+ wdt:P175 wd:Q1299; # performer: The Beatles
68
+ wdt:P577 ?publicationDate. # publication date
69
+ FILTER(YEAR(?publicationDate) >= 1965 && YEAR(?publicationDate) <= 1968)
70
+ }")
71
  """
72
  endpoint_url = "https://query.wikidata.org/sparql"
73
  headers = {"Accept": "application/sparql-results+json"}