greggg's profile picture
greggg

web-search

Public

Forked from zexigh/web-search

Give your local model web search. DuckDuckGo backend works out of the box (no API key); SearXNG backend lets you point at your own privacy-respecting metasearch instance (Google Bing Brave DuckDuckGo combined).

3.9K Downloads

5 stars

README

web-search

LM Studio plugin that lets the model search the web. Two backends:

  • DuckDuckGo (default) — no setup, no API key, no instance to host. Scrapes the public HTML endpoint.
  • SearXNG — privacy-respecting metasearch (Google + Bing + DuckDuckGo + Brave + …) via your own instance.

Without it, models reply "I don't have access to the internet." With it, they can answer questions about current events, recent releases, prices, biographies of living people, and software docs that may have changed.

Tools

  • search_web(query, max_results?) — runs a search through the configured backend and returns ranked results.

Result shape (DuckDuckGo backend):

{
  "query": "lm studio plugin sdk",
  "backend": "duckduckgo",
  "results": [
    {
      "title": "...",
      "url": "https://...",
      "content": "snippet...",
      "source": "lmstudio.ai"
    }
  ]
}

SearXNG backend additionally returns answers, infoboxes, suggestions, and unresponsive_engines when the instance provides them.

Configuration

Per-chat

FieldTypeDefaultNotes
Search backendselectDuckDuckGoDuckDuckGo or SearXNG.
Max resultsnumeric8Caps the number of results returned to the model (1–20).
SearXNG languagestringautoSearXNG-only. e.g. fr, en-US, auto.
SearXNG safe searchselectModerateSearXNG-only. Off, Moderate, or Strict.

Global

FieldTypeDefaultNotes
SearXNG instance URLstring(empty)SearXNG-only. Base URL of an instance with JSON output enabled. Leave empty if you only use DuckDuckGo.
Request timeout (ms)numeric10000How long to wait for the search backend before giving up.

Backends

DuckDuckGo

Zero setup. The plugin POSTs to html.duckduckgo.com/html/ and parses the result page. Caveats:

  • DuckDuckGo rate-limits aggressive use and may serve a CAPTCHA page (the plugin detects this and returns an error message).
  • This is HTML scraping, not an official API. The tool may break if DuckDuckGo changes their layout.

For occasional use it's perfectly fine. For high volume, switch to SearXNG.

SearXNG

Requires an instance whose settings.yml has the json format enabled under search.formats. Most public instances disable it to discourage scraping, so you usually need to either:

  • Self-host SearXNG (see searxng/searxng-docker) and add json to the formats list in settings.yml.
  • Find a public instance that allows JSON. searx.space lists public instances; verify by hitting https://<instance>/search?q=test&format=json in your browser.

If you get the error SearXNG did not return JSON, the instance has the JSON format disabled — pick another one or self-host.

Install

One-click (macOS, Windows): Run in LM Studio

Linux (AppImage): the lmstudio:// deep link doesn't work out of the box because the AppImage doesn't register a scheme handler. Use the CLI instead:

lms clone zexigh/web-search
cd web-search
lms dev -i          # -i / --install: install the plugin into LM Studio

To fix the deep link permanently, create ~/.local/share/applications/lmstudio.desktop:

[Desktop Entry]
Name=LM Studio
Exec=/absolute/path/to/LM-Studio.AppImage %u
Type=Application
MimeType=x-scheme-handler/lmstudio;
Categories=Development;

Then:

update-desktop-database ~/.local/share/applications/
xdg-mime default lmstudio.desktop x-scheme-handler/lmstudio

After install: the plugin isn't enabled in chats by default. In any chat, click the tools button (bottom right of the chat input) and enable web-search.

License

MIT