feat(embed): support OpenAI-compatible embedding servers (oMLX, vLLM, LM Studio) - #115
Merged
Merged
Conversation
The embedding client now speaks the OpenAI-compatible embeddings API in
addition to the Ollama API, so servers such as oMLX, llama.cpp, vLLM and
LM Studio can back recall without running Ollama.
- MNEMON_EMBED_PROTOCOL=ollama|openai selects the wire protocol;
auto-detected when the endpoint URL path ends in /v1
- MNEMON_EMBED_API_KEY attaches a Bearer token for OpenAI-compatible
servers (Ollama requires no auth)
- Available() probes /v1/models on the openai path instead of /api/tags
- Embed() parses the {"data":[{"embedding":[...]}]} response shape
- default Ollama behavior is unchanged; verified by make test and a live
end-to-end run against a local oMLX bge-m3-mlx-8bit server (1024 dims)
LiTerBo
force-pushed
the
feat/embed-openai-compatible
branch
from
August 23, 2026 03:13
36509c5 to
ad4def1
Compare
Normalize provider URL paths so trailing-slash endpoints work for both OpenAI-compatible servers and Ollama. Keep the legacy status field while adding protocol-neutral CLI output and guidance. Validation: make test; go build -o mnemon .; GOOS=windows GOARCH=amd64 go build .
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
The embedding client (
internal/memory/embed) currently speaks only the Ollama wire protocol (/api/tags,/api/embed). This PR adds first-class support for OpenAI-compatible embeddings APIs (/v1/models,/v1/embeddings), so local servers such as oMLX, llama.cpp, vLLM and LM Studio can back recall without running Ollama.Changes
MNEMON_EMBED_PROTOCOL=ollama|openaiselects the wire protocol. When unset, the protocol is auto-detected: an endpoint whose URL path ends in/v1is treated as OpenAI-compatible — so an oMLX setup is justMNEMON_EMBED_ENDPOINT=http://127.0.0.1:18000/v1.MNEMON_EMBED_API_KEYattaches aBearertoken for OpenAI-compatible servers (Ollama requires no auth).Available()probes/v1/modelson the openai path instead of/api/tags.Embed()parses the{"data":[{"embedding":[...]}]}response shape (the request body is identical for both protocols).MNEMON_EMBED_PROTOCOLvalues warn and fall back to auto-detect.Verification
make test— all packages pass (20/20), including 5 new focused tests (protocol auto-detect + explicit override, auth header on probe & embed, keyless servers, empty-response error).bge-m3-mlx-8bit(1024 dims):rememberreports"embedded": true; a semantic-paraphrase recall query that shares no keywords scores the right insight at 0.498 with vectors vs 0.386 without, and an unrelated-but-similar insight moves 0.064 → 0.425 when the vector signal is available.embed --statusreportsollama_available: falseand recall degrades to graph+keyword as before.