Skip to content

fix(embed): fall back to embeddings probe when models route is missing - #127

Merged
Grivn merged 1 commit into
mnemon-dev:masterfrom
spacemolt-molty:fix/embed-openai-models-fallback
Sep 3, 2026
Merged

fix(embed): fall back to embeddings probe when models route is missing#127
Grivn merged 1 commit into
mnemon-dev:masterfrom
spacemolt-molty:fix/embed-openai-models-fallback

Conversation

@spacemolt-molty

Copy link
Copy Markdown
Contributor

What

Available() for OpenAI-compatible servers now falls back to a real embeddings round-trip when the GET <endpoint>/models route is missing (404/405/501).

Why

Availability for OpenAI-compatible providers is currently decided solely by GET /models. Some compatible providers serve embeddings but no models route at all — e.g. Voyage AI returns 404 there while /v1/embeddings works fine. Against such endpoints mnemon reports embedding_available: false and silently runs without semantic recall, even though the embedding endpoint itself is fully functional.

The OpenAI compatibility surface mnemon actually depends on is POST /embeddings, so availability should reflect that route when the conventional discovery route doesn't exist.

Behavior after the change:

  • models route 200 → available (unchanged)
  • models route 404/405/501 → probe POST /embeddings once; available iff it returns a usable embedding
  • auth failures (401), quota (429), server errors (5xx) on either probe → unavailable, so the probe still catches misconfigured keys
  • Ollama protocol path unchanged

Implementation notes: the embeddings round-trip is shared with Embed() via embedWithContext/decodeEmbedResponse, so the probe and the real call cannot drift apart.

Verified end-to-end against the Voyage AI production API (voyage-3.5) and against a local Ollama instance.

Checklist

  • Deterministic tests pass (make test)
  • Relevant E2E/process/Docker boundaries pass (make test-integration, when affected)
  • New/changed behavior is covered by tests
  • Documentation updated (USAGE.md, DESIGN.md, or README) if applicable
  • User-facing release-note impact described in this PR, if applicable

OpenAI-compatible servers were probed for availability via
GET <endpoint>/models and reported unavailable when that route did not
exist. Some compatible providers serve embeddings but no models route at
all — Voyage AI returns 404 there — leaving mnemon silently without
semantic recall against a working endpoint.

When the models route is missing (404/405/501), probe availability with
a real embeddings round-trip instead, so availability reflects the
endpoint the client actually depends on. Auth, quota, and server errors
still report unavailable. The round-trip is shared with Embed via
embedWithContext/decodeEmbedResponse so the probe and the real call
cannot drift apart.

Verified end-to-end against the Voyage AI API (voyage-3.5) and against a
local Ollama instance.
@Grivn
Grivn merged commit 44444ea into mnemon-dev:master Sep 3, 2026
2 checks passed
Grivn added a commit that referenced this pull request Sep 3, 2026
Combine the OpenAI-compatible availability fallback from PR #127 with context-aware embedding cancellation.
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