Make web research follow the question's language - #38
Merged
Merged
Conversation
German questions search German Wikipedia and prefer German DuckDuckGo results. Wikipedia pages are read through MediaWiki instead of the reader, which saves the shared 20-request budget and keeps the sentence that names a current office holder. Search results carry today's date, and the research skill now teaches opening a page when the snippet is not enough. Co-authored-by: Sebastian <devbadya@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Web research was answering German questions from English Wikipedia, dating "today's news" with nothing, and spending two of the reader's 20 requests a minute to open a Wikipedia page MediaWiki already serves with CORS.
This is a different path from #32 and #34, which fold five page-reads into one call and spend most of the keyless budget on a single question. Here the existing
web_search/read_pagepair stays, and the work that does not need the reader moves off it.What one search/read now does
de.wikipedia.orgwhen the query is German (Wer ist…,Was kostet…, umlauts) and falls back to English if that edition has no article. DuckDuckGo getskl=de-de. English who was Ada Lovelace is not mistaken for German, because barewasis also English.read_pageof a*.wikipedia.orgURL goes through MediaWiki (origin=*, verified fromhttps://devbadya.github.io). The extract is truncated here to 8,000 characters. Wikipedia's ownexcharsparameter is capped at 1,200, which cuts off before the sentence that names a current office holder — on the live Bundeskanzler article, Friedrich Merz sits at character 1,539.Searched 2026-08-26 for "…", so "current" and "today's news" have a date without spending a tool round oncurrent_time.Cost
A DuckDuckGo search still spends one reader request. Opening the Wikipedia hit spends none. The five-source research tools spend six.
Verification
pnpm check(936 tests) andpnpm buildpass. New tests cover language detection, the German Wikipedia host, the English fallback, DuckDuckGokl=de-de, MediaWikiread_page, and the date stamp.Live against Wikipedia with
Origin: https://devbadya.github.io: search for Bundeskanzler returns the German articles withAccess-Control-Allow-Origin: *; readingBundeskanzler (Deutschland)and keeping 8,000 characters includes Friedrich Merz; Who was Ada Lovelace still hits English Wikipedia.The model itself is not exercised: this environment has no GPU adapter, and there is no CPU fallback. Routing and tool-use rates still need
/?evalin Chrome on a real GPU.