Conversation
Add strict fail-closed HTTP adapters for Qwen embedding and reranking, preserve full response validation, reduce native 2560-dimensional embeddings to the normalized 1024-dimensional MRL prefix, and prevent local model fallback. Includes routing, fingerprint, cache, CLI, trust, transaction-safety, and regression tests.
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.
Summary
Adds strict, fail-closed HTTP backends for shared embedding and reranking services while preserving QMD's existing local model-string behavior.
This draft is intentionally narrower than the complete generation + embedding + reranking backend requested in #620. It contributes a hardened embedding/reranking path for a concrete Qwen3 deployment:
POST /v1/embeddingsPOST /v1/rerankMotivation
Multiple QMD clients should be able to reuse one embedding model and one reranking model without each process loading duplicate GGUF models.
The important correctness boundary is stronger than transport compatibility: vectors from different producers, preprocessing paths, dimensions, or normalization pipelines must never be silently mixed under one identity. Remote failure therefore fails closed rather than falling back to a local GGUF model.
Configuration
Plain model strings remain local configurations, including strings that happen to look like HTTP URLs. Remote mode requires the explicit structured form.
Embedding safety contract
index, never response position.node-llama-cppor silently falls back locally in remote mode.Reranking safety contract
documentsand maps results by returned document index.relevance_scoredirectly without applying a second sigmoid.failurePolicy: fail-closedand never initializes/falls back to a local reranker in remote mode.CLI and configuration behavior
Structured configuration is validated before status, doctor, pull, trust, update, embed preflight, and runtime use. Malformed remote configuration does not degrade into a local path. Diagnostics redact API keys, URL credentials/query secrets, response bodies, and raw transport causes.
Relation to existing work
This draft overlaps with and is informed by:
It specifically addresses correctness concerns raised during review of those PRs:
This is submitted as a draft because the Qwen3 2,560→1,024 MRL contract is intentionally explicit and opinionated. Maintainer guidance is welcome on whether to retain this strict profile, generalize the structured transform fields, or extract parts into the broader #620 implementation.
Verification
Focused local test lanes:
git diff --check: passedFull Vitest run:
MCP HTTP Transport > POST /mcp initialize still works for 2025-era clients (no session id)That MCP failure was reproduced on the untouched base commit and is unrelated to this change; this PR does not claim a completely green full suite.
Additional isolated endpoint verification against llama.cpp services confirmed:
No production database, generated index, credential, benchmark artifact, or deployment configuration is included in this PR.