Skip to content

Web search: SearXNG language is hardcoded to all β€” could it be configurable?Β #328

Description

@jborst-graetz

Hi! πŸ‘‹ First off, thank you for @librechat/agents β€” the web-search + scrape + rerank tooling is genuinely lovely to self-host, and the SearXNG integration has been great to work with. πŸ™

I ran into one small thing while self-hosting and wanted to raise it gently, in case it's useful for others too.

What I noticed

The SearXNG search payload hardcodes the language to all:

// src/tools/search/search.ts (~L293)
const params: t.SearxNGSearchPayload = {
  q: query,
  format: 'json',
  pageno: 1,
  categories: category,
  language: 'all',        // <-- always "all"
  safesearch: safeSearch,
  engines: 'google,bing,duckduckgo',
};

Why it's a little tricky for self-hosters

When language=all is sent, SearXNG ignores its own search.default_lang and lets the engines geolocate by the server's IP. So if the instance is hosted outside the user's country, results come back in the wrong region's language.

Concretely: our instance runs in Azure westeurope (Amsterdam, NL), and German queries (e.g. "beste Pizzeria <German town>") return Dutch / North-Holland results. Because the value is hardcoded, there's no way to influence it from LibreChat config or from SearXNG's default_lang β€” the all always wins. (Confirmed by diffing &language=all vs &language=de-DE against the same SearXNG instance.)

Would a small knob be welcome?

Any of these would fully solve it, in rough order of effort β€” very happy to defer to whatever fits the design best:

  1. A config option, e.g. webSearch.searxngLanguage (or a generic searchLanguage), passed straight through to the payload.
  2. Respect the user's LibreChat locale (the UI language) as the search language.
  3. Simplest of all: only set language when a value is provided, so an unset language lets SearXNG's own default_lang take effect.

For now I'm working around it with a tiny reverse-proxy that rewrites the language query arg before it reaches SearXNG β€” works fine, but a first-class option would be much nicer and would help anyone self-hosting outside the US/their target region.

Happy to open a PR for option 1 or 3 if that'd be helpful β€” just let me know what you'd prefer. Thanks again for the great project! πŸ™

Version: @librechat/agents@3.2.46.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions