wrolpi/modules/ai
Roland 12cd8355ad
ai: kind-generic search_files / get_file / read_content
Small models carry every tool definition on every request, and the
per-kind trios (four searches, three getters, three readers) cost a
quarter of an 8k context while giving the model near-duplicate choices.
Three generic endpoints replace them:

- POST files/search: one search over videos, archives, and docs with an
  optional kind; channel (name or id), domain, author, subject each
  imply their kind and are ignored for other kinds.  When the term also
  names channels/domains/authors, they are returned as `matches` so the
  model can narrow without a second tool.  Channels resolve by name, so
  the library map already in the prompt is enough: no list call first.
- GET files/{id}: detail by id whatever the kind; videos now report
  has_captions/has_comments and the full description, archives keep
  their snapshot history.
- GET files/{id}/content?part=text|comments: captions, page text, or
  comments, paged; a wrong part for the kind says what the file is.

Inventories take an optional slug on GET /inventories (one tool lists
and fetches).  Listings are slimmed: no derivable captions/text links,
no size/mimetype, duration as H:MM:SS, published as a date.  The
library map gains the tag names.

wrolpi_mcp keeps every existing tool name; the wrappers now call the
generic routes, and search_files/get_file/read_content are exposed too.
The old per-kind endpoints remain until the modes switch over.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-13 20:10:18 -06:00
..
test ai: kind-generic search_files / get_file / read_content 2026-09-13 20:10:18 -06:00
__init__.py ai: package llama-server for all three deployments, with idle unload 2026-09-13 20:10:16 -06:00
agent.py ai: the /api/chat agent loop — SSE streaming, modes, tool execution 2026-09-13 20:10:16 -06:00
api.py ai: kind-generic search_files / get_file / read_content 2026-09-13 20:10:18 -06:00
catalog.py ai: ground answers in a live library map, budget the context 2026-09-13 20:10:17 -06:00
chat.py ai: ground answers in a live library map, budget the context 2026-09-13 20:10:17 -06:00
config.py ai: ground answers in a live library map, budget the context 2026-09-13 20:10:17 -06:00
conftest.py ai: ai.yaml config, model catalog, and the GGUF downloader 2026-09-13 20:10:15 -06:00
context.py ai: kind-generic search_files / get_file / read_content 2026-09-13 20:10:18 -06:00
controller_client.py ai: package llama-server for all three deployments, with idle unload 2026-09-13 20:10:16 -06:00
downloader.py ai: ai.yaml config, model catalog, and the GGUF downloader 2026-09-13 20:10:15 -06:00
errors.py ai: system endpoints — aggregate status, services, logs, disks 2026-09-13 20:10:15 -06:00
help_docs.py ai: live-chat fixes from first real-model run 2026-09-13 20:10:16 -06:00
lib.py ai: kind-generic search_files / get_file / read_content 2026-09-13 20:10:18 -06:00
modes.py ai: kind-generic search_files / get_file / read_content 2026-09-13 20:10:18 -06:00
schema.py ai: kind-generic search_files / get_file / read_content 2026-09-13 20:10:18 -06:00
service.py ai: package llama-server for all three deployments, with idle unload 2026-09-13 20:10:16 -06:00