Add support for remote OpenAI-compatible embeddings#480
Closed
Add support for remote OpenAI-compatible embeddings#480
Conversation
Replace the rerank() stub with a real listwise reranker using gpt-4o-mini. - Sends top candidates with query to gpt-4o-mini as a ranking task - Parses comma-separated index output, handles missing/duplicate indices - Skips API call for ≤2 documents (not worth the latency) - Falls back to original order on API failure - Cost: ~$0.001 per rerank call - Updated qmd.ts to route through OpenAI reranker instead of skipping The full qmd query pipeline with OpenAI now: 1. Query expansion (gpt-4o-mini) 2. BM25 + vector search (parallel) 3. RRF fusion 4. Cross-encoder reranking (gpt-4o-mini) ← NEW 5. Position-aware blending
jaylfc
pushed a commit
to jaylfc/qmd
that referenced
this pull request
Apr 4, 2026
Add `qmd serve` command that runs a lightweight HTTP server exposing embedding, reranking, and query expansion endpoints. Multiple QMD clients can share a single set of loaded models over the network instead of each loading their own into RAM. Changes: - New `src/serve.ts`: HTTP server wrapping LlamaCpp (embed/rerank/expand/tokenize) - New `src/llm-remote.ts`: RemoteLLM class implementing LLM interface via HTTP - Updated LLM interface: added embedBatch, tokenize, intent option - Updated store.ts: use LLM interface instead of concrete LlamaCpp type - CLI: added `serve` command, `--server` flag, and QMD_SERVER env var - README: documented remote model server usage and multi-agent setup Addresses: tobi#489 tobi#490 tobi#502 tobi#480 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
jaylfc
added a commit
to jaylfc/qmd
that referenced
this pull request
Apr 5, 2026
Add `qmd serve` command that runs a lightweight HTTP server exposing embedding, reranking, and query expansion endpoints. Multiple QMD clients can share a single set of loaded models over the network instead of each loading their own into RAM. Changes: - New `src/serve.ts`: HTTP server wrapping LlamaCpp (embed/rerank/expand/tokenize) - New `src/llm-remote.ts`: RemoteLLM class implementing LLM interface via HTTP - Updated LLM interface: added embedBatch, tokenize, intent option - Updated store.ts: use LLM interface instead of concrete LlamaCpp type - CLI: added `serve` command, `--server` flag, and QMD_SERVER env var - README: documented remote model server usage and multi-agent setup Addresses: tobi#489 tobi#490 tobi#502 tobi#480 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
jaylfc
added a commit
to jaylfc/qmd
that referenced
this pull request
Apr 5, 2026
Add `qmd serve` command that runs a lightweight HTTP server exposing embedding, reranking, and query expansion endpoints. Multiple QMD clients can share a single set of loaded models over the network instead of each loading their own into RAM. Changes: - New `src/serve.ts`: HTTP server wrapping LlamaCpp (embed/rerank/expand/tokenize) - New `src/llm-remote.ts`: RemoteLLM class implementing LLM interface via HTTP - Updated LLM interface: added embedBatch, tokenize, intent option - Updated store.ts: use LLM interface instead of concrete LlamaCpp type - CLI: added `serve` command, `--server` flag, and QMD_SERVER env var - README: documented remote model server usage and multi-agent setup Addresses: tobi#489 tobi#490 tobi#502 tobi#480
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.
This is mainly a tidy-up of #116, which fell behind main, but adds support for configurable remote endpoints.
There are many Issues and PRs already, requesting that support for remote, OpenAI-compatible endpoints is re-added to the code base, so I apologise for creating a new one, but it's clearly quite a popular request!
PRs
A lot of these are endpoint-specific in nature, either for Voyager, Gemini, OpenRouter. This PR is generic, allowing the use of any embedding provider that follows OpenAI's API-specification for embeddings.
Issues
I went through a few of them, and thought that @jonesj38's version was the closest to what I wanted. I made some minor changes, before it fell behind
mainand needed some clean merging. I created a PR to his repository, but it became quite messy and I have received no feedback from that in a couple of weeks.Summary
Clearly there are a lot of use-cases for remote endpoints. My use-case, as mentioned in a couple existing PRs and Issues, is that
node-llama-cppdoes not build in docker on Mac Silicon. Even if it did, it wouldn't have support for Apple's GPU.So, I need to host the models in Docker Model Runner, which is treated as an OpenAI-compatible remote endpoint.
Either way, I am using this fork, but I would much prefer if it was merged upstream so I can benefit from any future code changes, too. (It wasn't easy rebasing the fork on main!)