feat: pluggable embedding provider — E5 adapter for self-hosted embeddings#150
Open
SZabolotnii wants to merge 2 commits intogarrytan:masterfrom
Open
feat: pluggable embedding provider — E5 adapter for self-hosted embeddings#150SZabolotnii wants to merge 2 commits intogarrytan:masterfrom
SZabolotnii wants to merge 2 commits intogarrytan:masterfrom
Conversation
…dings Add support for self-hosted E5 embedding models (intfloat/multilingual-e5-small) as an alternative to OpenAI. Enables zero-cost embeddings using existing infrastructure (e.g., Ayona's E5 container on VPS). - New provider router in embedding.ts (GBRAIN_EMBEDDING_PROVIDER=e5|openai) - E5 HTTP adapter (embedding-e5.ts) with auto-dimension detection, retry, batch - Extracted OpenAI provider into embedding-openai.ts (no behavior change) - Dynamic vector(N) in schema — 384d for E5, 1536d for OpenAI - Schema dimension substitution in db.ts, postgres-engine.ts, pglite-engine.ts Deployed and verified on VPS: gbrain init with E5 creates vector(384) schema, doctor reports health_score=90, all checks OK. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
12 unit tests for E5 adapter (fetch mock, batching, truncation, dimension detection), OpenAI adapter exports, provider router, and schema dimension substitution. CHANGELOG v0.10.2 entry. CLAUDE.md updated with new files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
GBRAIN_EMBEDDING_PROVIDER=e5|openaiselects between self-hosted E5 and OpenAI. OpenAI remains default.embedding-e5.ts): talks to self-hostedintfloat/multilingual-e5-small(or compatible) endpoint with auto-dimension detection, retry, batch splitting.embedding-openai.ts): same behavior, clean separation.vector(384)for E5 orvector(1536)for OpenAI across PGLite and Postgres engines.gbrain initcreatesvector(384)schema, doctor reportshealth_score=90.Env vars
GBRAIN_EMBEDDING_PROVIDERopenaie5oropenaiGBRAIN_E5_URLhttp://embeddings-e5:8000/embedGBRAIN_E5_BATCH_SIZE16Test plan
bun test— 858 pass, 0 failtest/embedding.test.ts— 12 tests covering all providers🤖 Generated with Claude Code