Repository navigation
[Feat] Memory embeddings auto-wire to Cloudflare Workers AI - #3616
pridemusvaire wants to merge 4 commits into
Conversation
Cloudflare-only deployments already had a Workers AI token that speaks OpenAI-compatible embeddings, but Memory still required an OpenAI or OpenRouter key for semantic recall.
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
|
No new code issues found. Both earlier routing findings are addressed: Cloudflare-model requests stay on Workers AI when a provider key is added, while OpenAI-model requests retain the provider path. An isolated resolver probe passed for both OpenAI and OpenRouter coexistence, cache isolation, and explicit-upstream precedence. CI tests and the app Docker build are still running. See session
Reviewed 7fc18b1 |
…are also set. Workers AI embeddings auto-wire only when no OpenAI or OpenRouter Memory key is configured, so an existing corpus pinned to text-embedding-3-small is not forwarded to Cloudflare.
A corpus pinned to @cf/baai/bge-m3 must stay on Cloudflare even after an OpenAI or OpenRouter chat/task key is configured, instead of forwarding that model id to the provider.
Knip failed on CloudflareWorkersAiEmbeddings because it is only used inside the credential reader.
|
Closing this. Memory embeddings should be wired with the documented |
Why this PR exists
Memory Settings currently warns "Memory has no embeddings provider, so it can only match keywords" on Cloudflare-only deployments. Those deployments already have a Workers AI token that speaks OpenAI-compatible embeddings, but Memory only treated an explicit embeddings upstream URL or an OpenAI/OpenRouter key as an embeddings provider.
What changed
Memory embeddings auto-wire to Cloudflare Workers AI when
CLOUDFLARE_WORKERS_AI_API_TOKENand a 32-hexCLOUDFLARE_WORKERS_AI_ACCOUNT_IDare set. Semantic recall no longer needs a separate OpenAI or OpenRouter key.R_BRAIN_EMBEDDINGS_UPSTREAM_URLstill wins.https://api.cloudflare.com/client/v4/accounts/{account}/ai; Roomote appends/v1/embeddings.R_BRAIN_EMBEDDING_MODEL=@cf/baai/bge-m3andR_BRAIN_EMBEDDING_DIMENSIONS=1024before Memory's first boot.How it was tested
isBrainEmbeddingAvailableandresolveBrainEmbeddingsUpstream(URL wins, CF/aibase, invalid account including 32-char non-hex, token/account missing, 30s cache on hits and misses)incompletewithout embeddings andconnectedwhen embeddings are availablecheck-types:fast(27/27), knip, gitleaks: passChecklist
[Fix],[Feat],[Improve],[Refactor],[Docs], or[Chore]followed by a user-facing descriptionpnpm lintandpnpm check-typespass locallypnpm changeset