#wq42
MEET YOUR WQ42 CREW! (part 2)

All of these wonderful people are what make Wicked Queer happen every year. Whether they're combing through film festival submissions or coordinating with theaters, this is the crew that makes it work.

#wickedqueer #wq42
March 17, 2026 at 7:46 PM
MEET YOUR WQ42 CREW! (part 1)

All of these wonderful people are what make Wicked Queer happen every year. Whether they're combing through film festival submissions or coordinating with theaters, this is the crew that makes it work.

#wickedqueer #wq42
March 16, 2026 at 4:53 PM
ERUPCJA - dir. Pete Ohs has been Selected for Wicked Queer: Boston's LGBTQ+ Film Festival.
WQ42 is April 3rd-16th, 2026
March 8, 2026 at 3:03 PM
When someone uses ai to finish a project. (Multiply this by 1000 if they use ai for the whole project). #FuckAI #Pixar #Cars #Disney

www.youtube.com/watch?v=Wq42...
Cars 2006 movie Clip 2
YouTube video by Nora Diaries
www.youtube.com
April 27, 2026 at 12:31 PM
WQ42: konverzujte s Wikidaty
**Wikidata, svobodná databáze znalostí, jsou někdy chápána jako nějaké tajemné místo za Wikipedií, pro jejichž používání a úpravy je potřeba mít nějaké zvláštní znalosti. A to i mezi wikimediány. Ale představte si, že byste se mohli na obsah Wikidat dotazovat přímo v přirozeném jazyce a ve stejně srozumitelné formě dostat i odpověď. A přesně to umožňuje projekt WQ42.** ## **Co jsou Wikidata** Zjednodušeně si Wikidata můžete představit jako obrovskou, svobodnou a společně vytvářenou databázi faktů, kterou mohou využívat lidé i počítače. Místo souvislých článků, jaké známe z Wikipedie, ukládají informace v přehledné a strojově čitelné podobě: například že Brno je město, leží v ČR a má určitý počet obyvatel. Jednotlivé údaje jsou přitom vzájemně propojené, takže z Wikidat vzniká jakási síť znalostí o lidech, místech, událostech, dílech a mnoha dalších tématech. Stejně jako Wikipedii je může kdokoliv používat a také pomáhat vylepšovat. Popisují všechny možné významné entity, které existují – každou vydanou knihu, každý existující jazyk, zvolené politiky, města nebo ovoce. Nejjednodušeji to lze vidět na mezijazykových odkazech na Wikipedii. Každý článek na Wikipedii je propojený s určitou položkou na Wikidatech – například článek „Brno“ je spojený s položkou s číslem Q14960. Díky tomuto spojení je jasné, že německý článek o stejném tématu je „Brünn“, protože i on je propojený se stejnou položkou na Wikidatech. Navíc k tomu je každá položka na Wikidatech popsaná pomocí jiných položek. To se provádí pomocí takzvaných tvrzení. Každé tvrzení si lze představit jako jednoduchou větu, která vždycky nějak popisuje danou položku. Například „Brno – [je] instance (čeho) – město v Česku“. Nebo „Brno – nachází se v administrativní jednotce – okres Brno-město“. Takto je možné popsat jakékoli vztahy ohledně vlastností, které daná položka má, například ovládané jazyky, rodičovství, různé činnosti a mnoho dalšího. Tato tvrzení jsou navíc nezávislá na jazyce, existují prakticky ve všech jazycích současně a není třeba je překládat jednotlivě. ## **Co je WQ42** WQ42 je projekt dostupný na wq42.toolforge.org, který vytvořil vývojář Nadace Wikimedia Santhosh Thottingal. Funguje jako rozhraní pro přístup k informacím uloženým ve Wikidatech a jeho prostřednictvím je možné Wikidatům klást otázky nebo jim dát instrukce v přirozeném jazyce – a stejným způsobem dostat i odpověď. Je třeba poznamenat, že toto rozhraní je určené jen pro čtení dat z Wikidat a samo nedokáže obsah Wikidat jakkoliv měnit. Aby WQ42 dokázalo reagovat na dotazy v přirozeném jazyce, používá na pozadí velký jazykový model, jehož cílem je pochopit otázku nebo příkaz, rozhodnout, které položky potřebuje navštívit, a zformulovat odpověď. Ve svém původním nastavení používá jazykový model Gemini 2.5 Flash, ale protože je program svobodný, může ho každý sám provozovat i s jinými jazykovými modely s otevřenými vahami nebo s jazykovými modely zcela otevřenými. Jazykový model dostává přísné instrukce, podle kterých smí odpovídat jen na základě informací nalezených na Wikidatech, a tak by neměl halucinovat nebo odpovídat podle informací, na kterých byl vytrénovaný. Také vždycky zmiňuje položky, ze kterých své informace čerpá, což uživatelům připomíná, že informace pocházejí z Wikidat. Halucinace a neuvádění původu poskytnutých informací jsou často zmiňované problémy chatbotů obecně. ## **Omezení použití** Z tak přísného omezení, aby chatbot odpovídal vždy jen na základě informací z Wikidat, samozřejmě plynou i určitá omezení. Pokud nějaká informace na Wikidatech opravdu chybí – protože ji nikdo do Wikidat ještě nepřidal – chatbot nedokáže na otázku odpovědět, i když jde o fakt pro lidi zcela evidentní. V odpovědi na otázku „Jakou barvu má obloha?“ jazykový model předpokládal, že jako stroj nedokáže vidět oblohu a rovnou odpověděl tím, že není schopný vidět oblohu a ani se na Wikidata nepodíval. Ale i když jsem mu přímo zadal, aby se podíval na příslušnou položku na Wikidatech, nedokázal na otázku odpovědět, protože v položce o obloze se její barva skutečně nenachází. Nicméně je dobré, že chatbot nemá problém odpovědět, že neví, místo aby se neřídil instrukcemi a odpověděl na základě svých trénovacích dat nebo si odpověď přímo vyhalucinoval. Je třeba poznamenat, že chatbot uživateli zobrazuje každý krok, který provede prostřednictvím nástrojů, které má k dispozici. V tomto případě tedy vidíme, že chatbot vyhledal položku „obloha“ a následně ji navštívil. Zároveň neprovedl žádnou akci, která by nesouvisela se zadaným úkolem. Další omezení vyplývá z toho, že chatbot vždy přistupuje k aktuální databázi Wikidat. Pokud by tedy jiný uživatel či uživatelka právě prováděli experimentální úpravy nebo vandalizovali položku, na kterou se v danou chvíli dotazujete, mohou být získané výsledky nepředvídatelné. Chatbot má také k dispozici modul pro programovací jazyk Lua, pomocí něhož může provádět matematické výpočty nebo porovnání. Nicméně úroveň jeho schopností závisí na použitém jazykovém modelu. Z nějakého důvodu si např. nedokáže uvědomit aktuální rok a správně odpovědět na otázku, před kolika lety se narodil Karel Hynek Mácha. Zároveň však dokáže spolehlivě provádět jednoduché matematické výpočty pouze pomocí modulu pro jazyk Lua, aniž by se přitom dotazoval na Wikidata. I když dostal příklad v přirozeném jazyce, správně použil modul jazyka Lua pro výpočet výsledku, který je **67** A nakonec – WQ42 ve svém současném stavu nemá přístup k rozhraní pro SPARQL, takže nedokáže odpovídat na otázky jako „Vypiš všechna města v Jižní Koreji s méně než 50 000 obyvateli.“ Na taková omezení je třeba myslet při používání WQ42 a současně se tyto příklady dají použít pro testování schopností jiných jazykových modelů. ## **Odpovídání čistými fakty** První zřejmou možností využití WQ42 je dotazování na jednoduchá fakta, například na hlavní města států. Jak je vidět na obrázku, chatbot správně odpověděl a poskytl odkaz na příslušnou položku na Wikidatech. Je rovněž možné se zeptat i na jiná fakta, například na hymnu České republiky. Chatbot správně odpověděl, že hymna ČR je píseň Kde domov můj a kromě odkazu poskytl také zvukový soubor s nahrávkou hymny, neboť ta se nachází na Wikimedia Commons. Stejné to je i u jiných multimédií – obrázků a videí. ## **Nacházení a popis vztahů** WQ42 samozřejmě může nejen zodpovědět otázky o faktech o jednotlivých položkách, ale také popsat vztahy mezi dvěma nebo více položkami, pokud je vztah mezi nimi přímý. A v případě potřeby dokáže také navštívit vícero položek bez přímé vazby a popsat jejich společné rysy, pokud to na základě dostupných dat lze. ## **Shrnutí** WQ42 je zajímavým příkladem nástroje, který umožňuje přístup ke znalostem uloženým ve Wikidatech prostřednictvím přirozeného jazyka bez potřeby znát detaily o tom, jak Wikidata na pozadí fungují. Tato závislost na Wikidatech alespoň částečně také řeší problém uvádění zdrojů jazykovými modely a také problém aktuálnosti dat v poskytnutých odpovědích, protože WQ42 nutí jazykový model odkazovat na zdrojové položky na Wikidatech a vždy používá živou a tedy i aktuální databázi Wikidat. Cenou za to je, že jazykový model nemůže používat své vnitřní znalosti, a proto nedokáže odpovídat na otázky, které jsou pro lidi mnohdy triviální. Přesto však může WQ42 přiblížit data z Wikidat i lidem, pro které je forma otázka–odpověď v přirozeném jazyce přístupnější než obvyklé technické rozhraní Wikidat. Zároveň ukazuje, jak lze jazykové modely přímo propojit s lidmi spravovaným zdrojem znalostí. Každou chybějící či nesprávnou informaci mohou lidé na Wikidatech doplnit nebo opravit a tato změna se následně ihned projeví v odpovědích nástroje WQ42. Teď je řada na vás zkusit si s tímto nástrojem „hrát“ a vyzkoušet jeho možnosti a omezení ve vašem vlastním kontextu.
blog.wikimedia.cz
August 21, 2026 at 4:10 AM
WQ42: Converse with Wikidata
**Wikidata, the database of all knowledge, is sometimes understood – even among Wikimedians – as a mysterious place behind Wikipedia that requires some special knowledge to use and edit. But imagine you could ask about the content of Wikidata directly in natural language and receive the answer in the same easy way. This is what the project WQ42 can do.** ## **What is Wikidata** Put simply, you can think of Wikidata as a massive, free, and collaboratively built database of facts that can be used by both humans and computers. Instead of full-text articles like the ones on Wikipedia, it stores information in a structured, machine-readable format — for example, that Brno is a city located in the Czech Republic and it has a specific size of population. These data points are interconnected, creating a knowledge network of people, places, events, works of art, and countless other subjects. Just like Wikipedia, anyone can use it and help improve it. It describes all kinds of notable entities that exist — every published book, every existing language, elected politicians, cities, or even types of fruit. The simplest visible function of Wikidata is providing interlanguage links for Wikipedia. Every Wikipedia article is linked to a certain Wikidata item –for example the article “Brno” is linked to item number Q14960. Thanks to this connection it is clear that the German-language article on the same topic is “Brünn”, because it is linked to the same Wikidata item. In addition to this, every Wikidata item is described through other items. This is done through so called statements. One can think of every statement as a simple phrase that describes the item it belongs to in some way. For example “Brno – is instance of – municipality in the Czech Republic”. Or “Brno – [is] located in the administrative territorial entity – Brno-City District”. This way it is possible to describe any kinds of relationships about the nature of things, languages used, parenthood, diverse activities and much more. Moreover those declarations are language-independent, they exist practically in all languages at once and so one doesn’t need to translate them for their own sake. ## **What is WQ42** WQ42 is a small project available at wq42.toolforge.org and created by software developer Santhosh THOTTINGAL working for the Wikimedia Foundation. It serves as another interface to access the information stored in Wikidata. Through it one can ask Wikidata or give it instructions in natural language – and receive an answer in the same way. It is noteworthy that the interface is made to be read-only and it cannot by itself change the content of Wikidata in any way. To be able to answer questions in natural language, WQ42 uses a large language model (LLM) in the background, whose task is to understand the question or instruction, decide which items it needs to visit, and produce the answer. In its default configuration, it uses the Gemini 2.5 Flash language model, but because the program is free/libre software, one can host it oneself and use it with another open-weight or fully open language model. The language model receives strict instructions, which it is obliged to give its answers based only on the information stored in Wikidata and so it should much less hallucinate or answer according to the information on which it was trained. It also always mentions the items from which it took the information, what reminds its users that the information comes from Wikidata. Hallucinations and non-attribution of sources of the information provided are often mentioned problems of chatbots in general. ## **Limitations of use** Such a strict obligation as that the chatbot always answers only based on the information from Wikidata, naturally brings some limitations. If some information is missing in Wikidata – because nobody has put it there yet – the chatbot cannot answer even if it is a fact, to a human, fully obvious. However, when answering the first question “What is the colour of the sky?” the language model supposed, that as a machine, it cannot see the sky and directly replied that it is unable to answer the question without even looking at Wikidata. But even when I gave it direct instruction to look at the relevant Wikidata item it couldn’t give me the answer, because in the item about the sky the colour of the sky is really not mentioned. It is undoubtedly good that the chatbot had no problem to say that it didn’t know instead of disobeying the instructions and trying to answer based on its training data or directly hallucinate the answer. It’s noteworthy that the chatbot shows the user each usage of its tools. So one can see that it searched for the Wikidata item for “the sky” and that it accessed the item it found, but it didn’t do anything unrelated to its task. Another limitation stems from the fact that the chatbot always accesses the live database of Wikidata. If some random user experiments or directly vandalises the item you have just asked about then you can receive unpredictable answers. The chatbot can also use a module for the Lua programming language. Through this module, it can perform mathematical calculations or comparisons, but its abilities are variable depending on the language model used. Because of this, it cannot answer correctly how many years ago Albert Einstein died. But it can do simple arithmetic calculations well only through the Lua module without need to ask Wikidata about anything. Even when the exercise was given to it in natural language, it used the Lua module well to calculate the result, which is **67** And finally – WQ42 in its current state doesn’t have access to a SPARQL interface, so it cannot answer questions like “Give me a list of all cities and towns in South Korea with more than 50,000 inhabitants.” One should keep these limitations in mind when using WQ42 and those examples can also serve to test the capabilities of other language models used. ## **Answering questions about simple facts** The first evident use for WQ42 is to ask about simple facts, for example about the capitals of countries. As shown in the image the chatbot answered correctly and provided a link to the relevant Wikidata item. It is also possible to answer questions about other basic facts such as the anthem of the Czech Republic. The chatbot correctly answered that the anthem of the Czech Republic is the song Kde domov můj and alongside the link, it also provided a recording of the anthem, because it can be found on Wikimedia Commons. That happens to the other multimedia files too – such as images and videos. ## **Finding and describing relationships** Naturally, WQ42 can not only answer questions on facts about individual items, but of course can describe relationships between two or more items, if the relationship between them is direct. When needed, it can also visit several Wikidata items and draw the answer from them. ## **Summary** WQ42 is an interesting example of a tool that enables access to the knowledge stored in Wikidata through natural language, without the need to know the details of how Wikidata works in the background. This dependency on Wikidata at least partially solves the problem of source attribution as well as the problem of having the answers up-to-date, because WQ42 forces the language model to link to the source items on Wikidata and to use the live and so up-to-date database of Wikidata. The price for this is that the language model cannot use its inner knowledge and so it cannot answer even those questions that are for humans very easy in general. In this way, WQ42 can bring Wikidata closer to people for whom the form of question—answer in natural language is easier than the ordinary technical interface of Wikidata, but it also shows an example how language models can be directly linked to a human-curated knowledge source. Any missing or incorrect information can be added or corrected by humans and the result will be directly visible in the answers of WQ42. Now it’s up to you to “play” with the tool and discover its capabilities and limitations within your own context.
blog.wikimedia.cz
August 21, 2026 at 4:10 AM
WQ42:通过工具调用将大型语言模型扎根于维基数据事实之中

https://qian.cx/posts/BAED63D9-6DB8-4FF7-B7DA-F361304637C5
September 15, 2025 at 9:18 AM
🔴💥🇪 🇸 🇹 🇷 🇪 🇳 🇴💥🔴
3️⃣1️⃣🎇1️⃣2️⃣🎆‍2️⃣4️⃣ ⌚17:30
💥🌎⌨️🆕🇫 🇱 🇦 🇸 🇭🆕⌨️🌍💥
⛔️SOMOS RADIO AM 530
🔵Sandra Russo
🔴"Jugo de Limón"
www.youtube.com/watch?v=wq42...
SOMOS RADIO EN VIVO - JUGO DE LIMÓN - AM530
YouTube video by Somos Radio AM 530 - EN VIVO
www.youtube.com
December 31, 2024 at 8:30 PM
WQ42: Как Современные Языковые Модели Поддерживаются Фактами из Wikidata с Помощью Tool Calling

https://kripta.biz/posts/8F57005D-FBDA-4690-A01D-7727F2E0A1DA
September 15, 2025 at 9:19 AM
WQ42: Grounding LLMs in Wikidata Facts via Tool Calling
Integrating Knowledge Graphs (KGs) with Large Language Models (LLMs) is a well-explored research field. KGs are vast, structured databases storing factual associations as graph edges. KGs can help LLMs for tasks like question answering, drawing on the structured, often up-to-date information within KGs, thereby mitigating the risk of hallucination. For instance, an LLM that can query Wikidata—a prominent KG project—instead of solely depending on its training data becomes significantly more reliable and useful. The paper “Large Language Models, Knowledge Graphs and Search Engines: A Crossroads for Answering Users’ Questions,” co-authored by Wikidata founder Denny Vrandečić, introduces a taxonomy of user information needs, guiding the exploration of the pros, cons, and potential synergies between LLMs, KGs, and Search Engines. The authors argue that these technologies are complementary, and integrating them allows the strengths of one to compensate for the weaknesses of others. (Image credits: Large Language Models, Knowledge Graphs and Search Engines: A Crossroads for Answering Users’ Questions) A wealth of published research explores various approaches for integrating KGs with LLMs. While an exhaustive list is beyond our scope, let’s touch upon a few key strategies: 1. **Textualize KGs** into formats like JSON, plain text, Markdown, or even custom structures. Embed these textual representations using vector embedding techniques. For tasks like question answering, employ Retrieval Augmented Generation (RAG). Typically, this involves injecting the retrieved (and textualized) KG data into an LLM’s prompt at a later stage. Hence, these are often termed prompt-based methods. The LLM itself isn’t typically trained or fine-tuned directly with the KG in this approach. (Image credits: https://knowledge-nlp.github.io/naacl2025/papers/39.pdf) 2. **Parameterized or Model-Integrated KGs** : Here, the LLM is fine-tuned _with_ KG data. One example is KG-Adapter, a parameter-level KG integration method leveraging parameter-efficient fine-tuning (PEFT). Another intriguing example comes from “Injecting Knowledge Graphs into Large Language Models.” This research integrates graph embeddings as tokens within the LLM’s input, extending the paradigm to the KG domain by leveraging Knowledge Graph Embedding (KGE) models. (Image credits: https://aclanthology.org/2024.findings-acl.229.pdf) Both approaches—preparing embedding models for RAG or fine-tuning LLMs—demand significant effort, investment, and ongoing maintenance. In this article, I’ll explore a distinct yet related approach. It sidesteps KG embedding and empowers LLMs with basic analytical capabilities through tool calling (often referred to as agentic AI). I’ll showcase a tool enabling users to pose natural language questions directly to Wikidata. > For those eager to dive straight in, you can try the tool yourself at: https://wq42.toolforge.org ## Textualization Textualization—the conversion of a knowledge graph into a textual format consumable by ML techniques (like vector embedding or LLM prompting)—presents a significant hurdle with Wikidata. A straightforward API to retrieve _all_ information linked to a specific QID (e.g., Q405 for the Moon) is conspicuously absent. In my previous two articles, I detailed how I developed a web API to fetch JSON-formatted data for a given item (qjson: Fetching all properties of a wikidata item in a single API call) and subsequently transformed this data into an LLM-friendly Markdown format (qrender: Render wikidata item in different formats). The paper **KG-LLM-Bench: A Scalable Benchmark for Evaluating LLM Reasoning on Textualized Knowledge Graphs** (https://knowledge-nlp.github.io/naacl2025/papers/39.pdf) evaluates various data formats suitable for textualization. I came across this paper after developing `qrender`. My approach utilizes Markdown, incorporating links, images, and headings to represent the information associated with a given QID. A unique aspect of my method is the logical grouping of properties, ensuring similar attributes are clustered. For instance, when dealing with a person, details like various names (first, last, family, official, nickname), family connections, employment history, and awards are grouped cohesively. I’ve found this grouping crucial, as it significantly impacts the LLM’s output quality. Scattered or distracting information can heavily degrade LLM generation quality—a phenomenon recently dubbed ‘context rot.’ ## Tool Calling So, how do we integrate an arbitrary LLM with the textualized form of a QID? First, the LLM must identify the appropriate QID(s) to answer a given question. Depending on the query, multiple QIDs might be necessary. For example, to answer “Which river is longer, the Nile or the Amazon?”, information for both “Nile” (Q3392) and “Amazon River” (Q3783) is required. Wikidata provides a web API to retrieve the QID for a given title in any supported language. For example, to get the QID associated with Berlin, you can call: https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Berlin&language=en&limit=10&format=json. However, this API requires the entity’s title. For a given natural language question, how do we extract these titles? This is where LLMs shine. Without them, this would typically be a Named Entity Recognition (NER) task in NLP. For modern LLMs, it’s a relatively straightforward task. We instruct the LLM to identify potential titles (one or more) and then use them to call the Wikidata API to fetch the corresponding QIDs. This requires an LLM configured for tool calling. LLMs, by themselves, don’t autonomously execute tool calls. Instead, when provided with a set of available tools—along with their descriptions, capabilities, and required parameters—an LLM can determine _which_ tool to call and _what_ parameters to pass. So, I defined a tool as follows: * **Tool name** : `get_wikidata_qid_for_title` * **Description** : Retrieves potential Wikidata QIDs for a given title. For example, ‘Nile’ might return Q20631734 (male given name) and Q3392 (river), along with descriptions for disambiguation. * **Parameters** : { "type": "object", "properties": { "title": { "type": "string", "description": "The title for which we need a QID. Examples: San Francisco, Kerala, James Webb Space Telescope" } }, "required": ["title"] } Once the LLM indicates this tool should be called and provides the necessary parameters, the orchestrating program executes the actual API call. The tool’s output (e.g., the JSON response from the Wikidata API) is then fed back to the LLM. In our scenario, this would be the direct output from the `wbsearchentities` API call. A single title can match multiple QIDs. Therefore, we pass all matches along with their descriptions back to the LLM, allowing it to select the most relevant QID based on the question’s context. For instance, if the question concerns the Nile River, the API call https://www.wikidata.org/w/api.php?action=wbsearchentities&search=Nile&language=en&limit=10&format=json will return multiple matches: 1. Q660835: Nile, American death metal band 2. Q20631734: Nile, male given name 3. Q3392: Nile, Major river in northeastern Africa 4. … The LLM is generally adept enough to discern that Q3392 is the relevant entity for a question about the river. Next, we need the textualized information for the selected QID (e.g., Q3392). We use the `qrender` library, outputting in Markdown format as previously discussed. This Markdown content is then passed back to the LLM. Crucially, each interaction with the LLM must include the history (original question, previous tool calls, and their responses), as these LLM calls are typically stateless. To enable the LLM to use `qrender`, we must define it as another available tool: * **Tool name** : `get_wikidata_information_for_qid` * **Description** : Fetches comprehensive information from Wikidata for a given QID to help answer a question. The output is in Markdown format. * **Parameters** : { "type": "object", "properties": { "qid": { "type": "string", "description": "The wikidata QID. Example: Q42" } }, "required": ["qid"] } With the `qrender` output, the LLM should have the necessary information to formulate an answer. As mentioned, some questions necessitate multiple tool calls. For instance, comparing the lengths of the Nile and Amazon rivers requires fetching data for both QIDs, likely involving separate sequences of `get_wikidata_qid_for_title` and `get_wikidata_information_for_qid` calls for each river. ## Code Execution But can we trust an LLM to perform, say, a length comparison accurately? Analytical tasks, especially mathematical reasoning, are not inherently strong suits for many LLMs. The classic “How many ‘r’s are in ‘strawberry’?” puzzle often stumps them. Similarly, direct queries about which value is greater, or anything requiring precise calculation, can lead to unreliable LLM-generated answers. To address this weakness, we instruct the LLM not to perform calculations itself, but to delegate to a tool. What kind of tool? A simple calculator might not suffice for more complex logic. I opted to equip the LLM with a more versatile tool: I instruct the LLM to generate code (in Lua, in this case) to perform these calculations. This generated code is then executed, and its result is returned to the LLM. I chose Lua because LLMs are generally proficient at writing small scripts, particularly in straightforward languages like it. * **Tool name** : `run_lua_script` * **Description** : Executes a given Lua script and returns its output. This should be used for mathematical, comparative, or analytical questions where precise computation is needed. * **Parameters** : { "type": "object", "properties": { "script": { "type": "string", "description": "The Lua script to execute. Make sure to return the results. Printing the results has no effect." } }, "required": ["script"] } To illustrate, let’s revisit the “How many ‘r’s are in ‘strawberry’?” question. The LLM would be prompted to call `run_lua_script` with the following Lua code: local subject = "strawberry" local count = 0 for i = 1, #subject do if string.sub(subject, i, i) == "r" then count = count + 1 end end return count The Lua script, when executed, returns `3`. This result is then passed back to the LLM. The LLM can then confidently state: “There are 3 ‘r’s in ‘strawberry.’” This, of course, requires a sandboxed Lua runtime environment for safe execution. Lua is an embeddable scripting language, and for this project, I integrated a Lua runtime within my Rust application. ## The Prompt Here’s the core prompt guiding WQ42: You are WQ42, a Wikidata assistant. Answer user questions using ONLY provided tools. * **Data-Driven:** Base answers strictly on Wikidata data from tool calls. * **Concise & Clear:** Be informative but brief. * **QID Attribution:** Include Wikidata QIDs as Markdown links: `title`. * **Multimedia:** For links, audio, and video, present them in Markdown as follows: Use `!alt text` for images. `<audio controls><source src="audio_url"></audio>` for audio. `<video controls><source src="video_url"></video>` for video. * **Wikipedia Articles:** When asked to generate article-like content, synthesize information in a Wikipedia style, using all available data and citing QIDs. Incorporate images, audio, and video where relevant and available. * **Honest Limitations:** Respond "I don't know" if data is missing. Suggest Wikidata edits if information seems incomplete. **Workflow:** 1. Get user query. 2. Use `get_wikidata_qid_for_title` to find QID (if needed). * **If the FIRST `get_wikidata_qid_for_title` call fails (returns no results), try `get_wikidata_qid_for_title` again using a more general term from the query.** For example, if the query is "What is the national anthem of India?" and "National anthem of India" fails, try "India". 3. Use `get_wikidata_information_for_qid` to get data. 4. For any mathematical or analytical questions, generate Lua code and use `run_lua_script` to execute it. Use the output from code execution to answer the question. For example, when asked "How many 'r's are there in 'raspberry'?" or "Which is longest?" etc., generate Lua code to calculate and return the answer. 5. Answer concisely, with QIDs and media. Avoid making assumptions. Prioritize accuracy. If Wikidata's data appears incomplete or outdated, politely suggest the user consider contributing to Wikidata. For this experiment, I utilized the “google/gemini-2.5-flash-preview” model via OpenRouter. ## Examples and Screenshots You can experience the tool firsthand at https://wq42.toolforge.org. Below are a few screenshots demonstrating its capabilities. **Question:** What are the books written by Douglas Adams? This is a straightforward query. The process involves finding the QID for Douglas Adams, retrieving the textualized information via `qrender`, and presenting the relevant data. **Qn:** “Among the following countries, which country gained independence first: Keya, Singapore, or India?” This is a multi-hop question, requiring information from multiple entities. WQ42 is designed to fetch information for all three countries. I intentionally misspelled “Kenya” as “Keya” to test the LLM’s Named Entity Recognition robustness. The answer provided is correct. However, I anticipated the comparison logic would be offloaded to Lua code execution rather than being handled directly by the LLM’s reasoning. There’s also a minor formatting issue in the example output: the links aren’t rendered correctly. **Qn** : What is the national anthem of Japan? This is a simple question. Note the presentation of answer though. A user can play the national anthem right away. **Qn** : Write an essay about Kanchenjunga. This is a test to see how LLM can paraphrase all the information available. One of the challenge for LLMs for this kind of task is avoid deviate from supplied information to LLM’s own information. As I had instructed in prompt, links are provided wherever possible. Image is also provided. **Qn** : What does a Lion’s sound like? This is a simple question. Instead of providing the link as text, an audio player is given as instructed in prompt. **Qn** : Which river is the longest? Nile river or Amazon river? This is an analytical, multi-hop question. After fetching required information, Lua code is written and executed to find which is longer. Qn: Where did Singapore’s Prime minister graduate? This is a multi-hop question. First, wq42 fetches information from Prime minister of Singapore item. From there, LLM picks the current prime minister’s QID. Fetches information about it and answers the question. Using “Prime minister of Singapore” as title for searching is LLM’s skill. **Qn** : Which word has more number of ‘r’? strawberry or blackberry? This has nothing to with Wikidata, but given as an example for Lua code execution. **Qn** : How old is Will Smith. The Wikidata item about Will Smith will give date of birth. From it, we get Year too. But to calculate age, a small math operation is needed based on current date. LLM writes Lua code and executes as expected. ## Discussion One of the defining characteristics of WQ42 is its deliberate avoidance of vector databases. This design choice also means there’s no inherent knowledge cut-off date; the system sources its information dynamically and directly from Wikidata (barring any potential caching by the underlying qjson library). This ensures responses are based on the most current data available in the knowledge graph. The efficacy of tool calling can indeed vary depending on the specific LLM employed. While less sophisticated models might occasionally hesitate or fail to invoke a tool when one is clearly required, this issue is notably less prevalent with more advanced models, such as Google’s Gemini series. The reliability of the LLM’s decision-making in tool invocation is critical for consistent performance. There is a set of problems that WQ42 cannot address right now. One set of such questions are the ones that require data beyond Wikidata(obviously!). Wikidata only has facts and there is wast amount of knowledge outside the facts. “How do snakes move?”, “How do I tie a Windsor Knot?” are some examples. Multihop and analytical questions are not fully solved with the system. Even though I shared some examples of simple math, analytical and multi hop questions. For example, “Which Turing Award winners were born in Latin America?” WQ42 Answers: _“I’m sorry, I cannot answer which Turing Award winners were born in Latin America. While I can find information about theTuring Award and its laureates, I don’t have the ability to filter laureates by their birthplace”_ This response, while commendably honest and even providing a helpful link to the Turing Award’s Wikidata page, ultimately doesn’t satisfy the user’s specific information need. Answering this require designing more tools carefully and figuring out smart ways to procure the raw information to use with that tools. The paper I linked in the beginning of this article has many examples and very elaborate classification of these questions. If anybody interested in solving these limitations, please contact me. Finally, WQ42 is presented here as an exploratory project—an ongoing dive into a fascinating and complex problem—rather than a polished, production-ready application. Thanks for reading! 😊 ## Source code Source code: https://gitlab.wikimedia.org/toolforge-repos/wq42 The tool is written in Rust programming language. ## Disclaimer I work at the Wikimedia Foundation. However, this project, its exploration, and the opinions expressed are entirely my own and do not reflect my employer’s views. This is not an official Wikimedia Foundation project.
thottingal.in
June 21, 2025 at 4:42 PM