Skip to content

Add multilingual-e5-base as an optional model, served over HTTP - #34

Merged
woodthom2 merged 1 commit into
mainfrom
delosis/e5-embedder
Oct 4, 2026
Merged

woodthom2 merged 1 commit into
mainfrom
delosis/e5-embedder

Conversation

@ronnyTodgers

Copy link
Copy Markdown
Contributor

Summary

Adds intfloat/multilingual-e5-base as an optional matching model, without loading another model in-process: vectors come from an external embedding service over HTTP (768-d, L2-normalised). Stock deployments are unchanged. Unless HARMONY_E5_EMBEDDER_URL is set, the model is listed but reported as unavailable.

  • constants: DELOSIS_E5_BASE, appended to ALL_HARMONY_API_MODELS
  • settings: HARMONY_E5_EMBEDDER_URL, plus an optional HARMONY_E5_EMBEDDER_TOKEN sent as a bearer token
  • services/delosis_e5_embeddings: batched, retrying HTTP client
  • helpers: availability check and vectorisation dispatch

MHC and catalogue matching stay MiniLM-only, exactly as before. The vectors cache is already keyed by (framework, model), so E5 and MiniLM vectors never mix.

The embedding service it calls

POST {HARMONY_E5_EMBEDDER_URL}/text/embed with {"texts": [...], "prefix": ""}, returning {"vectors": [[...], ...]} (or "embeddings"), one vector per text. The client adds E5's query: prefix itself, to both sides of each item-to-item match, which is E5's recommendation for symmetric tasks. prefix: "" tells the service not to add one of its own.

⚠️ Match thresholds need raising for E5

E5's cosine similarities sit in a much narrower, higher band than MiniLM's. For example, it scores nervous / anxious at about 0.96, but also nervous / trouble sleeping at about 0.89. At the usual 70% match threshold, almost every pair matches. If E5 is offered in a frontend, it needs a higher default threshold, or the scores rescaled, before it's a sensible choice.

Independent of the other PRs.

🤖 Generated with Claude Code

Adds an E5 option to the model list without loading another model
in-process: vectors come from an external embedding service
(intfloat/multilingual-e5-base, 768-d, L2-normalised) over HTTP. Both
sides of an item-to-item match get the "query: " prefix, the E5
recommendation for symmetric tasks.

- constants: DELOSIS_E5_BASE, appended to ALL_HARMONY_API_MODELS
- settings: HARMONY_E5_EMBEDDER_URL (+ optional bearer token)
- services/delosis_e5_embeddings: batched, retrying HTTP client
- helpers: availability (only when the URL is configured, so stock
  deployments list it as unavailable and are otherwise unchanged) and
  vectorisation dispatch

MHC and catalogue matching stay MiniLM-only exactly as before; the
vectors cache is already keyed by (framework, model).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@woodthom2
woodthom2 merged commit b6ab447 into main Oct 4, 2026
1 check passed
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.

2 participants