Skip to content

feat(server): inspect resident prompts and report installed models - #1180

Open
Allegro-ma-non-troppo wants to merge 5 commits into
ROCm:mainfrom
Allegro-ma-non-troppo:wp-11-aux-endpoints
Open

Allegro-ma-non-troppo wants to merge 5 commits into
ROCm:mainfrom
Allegro-ma-non-troppo:wp-11-aux-endpoints

Conversation

@Allegro-ma-non-troppo

Copy link
Copy Markdown
Collaborator

Why

Clients could list models FLM knows about, but could not tell which packages were available locally or retrieve one model by ID. Inspecting the input to a chat turn required running inference.

What changes

  • GET /health returns 200 for a ready chat model and 503 when none is ready. An active generation is not a readiness failure.
  • GET /v1/models keeps the full catalog and existing metadata. Each entry adds installed, based on local package files, required base and version compatibility. Use ?installed=true to filter, /v1/models/{id} for one entry, or /api/ps to find the resident model. Discovery does not pull files or hash the weights.
  • POST /apply-template, /tokenize and /detokenize inspect the resident built-in Qwen3 text frontend without entering the accelerator queue. Previewing does not generate, switch models, or alter the conversation cache. Unknown IDs return 404, known nonresident IDs 409, and unsupported resident frontends 501. Unsupported media and tokenizer settings return 400 rather than an approximate result.

Behavior compared with other servers

Request Reference behavior FLM before This PR
GET /health llama.cpp distinguishes ready from loading Route not found Ready or unavailable, without queuing behind generation
List or retrieve models OpenAI SDK supports both operations Catalog only Preserve the catalog; add one-model retrieval and an installed filter
Inspect a prompt llama.cpp exposes template and token inspection; vLLM also exposes tokenization Routes not found Inspect the verified resident frontend without using the accelerator

Verification

  • Windows Release build and host tests: route classification, catalog and package status, error handling and extension frontend. Checked empty and malformed local stores, repair of invalid local versions and simultaneous reads while a pull has selected another source.
  • On a Windows NPU, compared preview token IDs with the actual Qwen3 chat input before cache trimming for six cases: plain text, developer instructions and tools, disabled tool choice, tool history, reasoning disabled and assistant continuation.
  • Exercised OpenAI SDK model discovery, reads during an active stream, switching between Qwen3 and Qwen3.5, and a real Pi tool-result turn. A follow-up chat reused all 145 cached prompt tokens both with and without diagnostics between turns. Windows GPU chat and model metadata also passed with Gemma3 on OGA/hip-ep.

The generation path already exposed the template renderer, so the preview reuses it rather than adding a competing formatter. Exact pre-cache input IDs, not generated token counts, are the parity check.

Linux serving and other diagnostic frontends were not validated. Extending prompt inspection to another frontend requires its own parity test. This change does not implement /metrics, change /api/tags, or change when a generation request may download a missing model.

This branch is waiting to be deployed

1 waiting deployment
npu-approval — a3a946c4 Waiting Nov 29, 2026 by Allegro-ma-non-troppo via npu-approve #803
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant