User:SpinachBot
This user account is a bot with a bot flag. The bot is operated by HTriedman (WMF). |
This bot is an auto-responding SPARQL generation and question answering bot created by User:HTriedman (WMF) and Stanford's Open Virtual Assistant Lab (OVAL) — specifically Shicheng Liu, Sina Semnani, Jialiang Xu, Isaac Dan Zhao, and Monica Lam.
When tagged and prompted by you, SpinachBot will try to write a SPARQL query based on your input request and send it to Wikidata Query Service. It will then post its response — either a query and result set, or a list of steps it tried that failed. You can tag it to provide feedback on the query and it will iteratively refine the query.
Presently, this agent runs on OpenAI's GPT-4o model. In the future, we may offer a choice of various models and/or distill a smaller, faster local model for this purpose.
You can also interact with the bot in a chat format at https://spinach.genie.stanford.edu/.
User guide
[edit]SpinachBot supports both one-off question answering and conversational back-and-forth with users on-wiki. You can trigger a response from the bot as follows:
- On any Wikidata page where you have a question to ask of SpinachBot, enclose your question in the
spinachbot top
andspinachbot bottom
templates, tag SpinachBot, and hit publish. - In 10-20 minutes, SpinachBot will respond to your query with its best guess of a SPARQL query that answers your question and a set of results from that query. If it cannot answer your question, it will summarize the steps it took and some potential future directions to explore. All SpinachBot responses will be wrapped in
spinachbot response
andspinachbot response end
templates. - Every SpinachBot response will include a link to a "trace of reasonings and actions" page for that query, which shows the query that the bot received and lists every single step it took, as well as intermediate results. Here's an example of a trace of reasonings and actions page.
- If you aren't satisfied with the results of the response from SpinachBot or would like to suggest a new direction for the bot to explore, just add a new line to your
spinachbot top/bottom
block tagging SpinachBot and telling it what you'd like it to do next. It will get back to you soon!
Example
[edit]Below is an example of a back and forth between a user and SpinachBot. In it, you can see an initial query, an initial response from the bot, a slight amendment to that query, and an updated response from the bot.
SpinachBot conversation example | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@SpinachBot Give me a list of the last 7 French prime ministers. HTriedman (WMF) (talk) 17:28, 8 July 2024 (UTC) Here is the SPARQL query and the result for the last seven French prime ministers:
SPARQL Query:[edit]SELECT ?pm ?pmLabel ?start_date ?end_date WHERE {
?pm p:P39 ?statement.
?statement ps:P39 wd:Q1587677;
pq:P580 ?start_date.
OPTIONAL { ?statement pq:P582 ?end_date. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC (?start_date)
LIMIT 7
Result:[edit]
This list includes the last seven individuals who held the position of Prime Minister of France, ordered by the start date of their term. Here's my chain of thought for this request so you can see how I came to this conclusion. SpinachBot (talk) 21:33, 8 July 2024 (UTC) @User:SpinachBot This is pretty cool, but could you actually include the party of each prime minister as well as their name and time in office? HTriedman (WMF) (talk) 21:37, 8 July 2024 (UTC) Here is the SPARQL query and the result for the last seven French prime ministers, including their political party:
SPARQL Query:[edit]SELECT ?pm ?pmLabel ?start_date ?end_date (SAMPLE(?party) AS ?party) (SAMPLE(?partyLabel) AS ?partyLabel) WHERE {
?pm p:P39 ?statement.
?statement ps:P39 wd:Q1587677;
pq:P580 ?start_date.
OPTIONAL { ?statement pq:P582 ?end_date. }
OPTIONAL { ?pm wdt:P102 ?party. }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?pm ?pmLabel ?start_date ?end_date
ORDER BY DESC (?start_date)
LIMIT 7
Result:[edit]
This list includes the last seven individuals who held the position of Prime Minister of France, ordered by the start date of their term, along with their political party. Here's my chain of thought for this request so you can see how I came to this conclusion. SpinachBot (talk) 21:39, 8 July 2024 (UTC) |
More examples:
- What are the plants that are endemic to Australia?
- Who was the 15th mayor of Chicago?
- Which artworks have been displayed at both the MoMA and the Tate?
Background
[edit]SpinachBot is the result of a collaboration between User:HTriedman (WMF) and Stanford's Open Virtual Assistant Lab (OVAL). It uses a large language model (LLM) combined with a limited set of executable actions on Wikidata to achieve agentic behavior in searching Wikidata and creating high-quality SPARQL queries.
SpinachBot is only the latest in a line of Wikimedia project-based LLMs and agents. Under the direction of Monica Lam, OVAL has produced Wikichat (an LLM grounded in Wikipedia content), STORM (an agent that creates Wikipedia-like reports on subjects), and SpinachBot. This bot is the first project that is the result of informal collaboration between the Wikimedia Foundation and OVAL.