feat(embedding): pluggable OpenAI-compatible embedding provider#178
Open
asperty567 wants to merge 1 commit intogarrytan:masterfrom
Open
feat(embedding): pluggable OpenAI-compatible embedding provider#178asperty567 wants to merge 1 commit intogarrytan:masterfrom
asperty567 wants to merge 1 commit intogarrytan:masterfrom
Conversation
Adds three env overrides so gbrain can run against any
OpenAI-compatible /v1/embeddings endpoint (LM Studio, Ollama,
vLLM, Together, self-hosted) instead of hardcoded OpenAI.
Environment variables:
EMBEDDING_BASE_URL custom endpoint (optional)
EMBEDDING_API_KEY api key (falls back to OPENAI_API_KEY)
EMBEDDING_MODEL model name (default: text-embedding-3-large)
EMBEDDING_DIMENSIONS vector dimension (default: 1536)
EMBEDDING_SEND_DIMENSIONS auto (default): sends dimensions only
when MODEL starts with text-embedding-3
Schema templates (pglite-schema.ts, schema-embedded.ts) now
interpolate EMBEDDING_MODEL and EMBEDDING_DIMENSIONS so the
pgvector column and config metadata match at gbrain init time.
Forces encoding_format: float in the request. The OpenAI SDK
defaults to base64 which LM Studio mis-decodes (returns 192
floats for a 768-dim nomic vector). float is spec-compliant
and all providers support it.
Verified end-to-end against LM Studio with
text-embedding-nomic-embed-text-v1.5 (768 dim): import,
embed, vector search all pass. Existing embed tests still
green.
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.
Adds three env overrides so gbrain can run against any OpenAI-compatible /v1/embeddings endpoint (LM Studio, Ollama, vLLM, Together, self-hosted) instead of hardcoded OpenAI.
Environment variables:
EMBEDDING_BASE_URL custom endpoint (optional)
EMBEDDING_API_KEY api key (falls back to OPENAI_API_KEY)
EMBEDDING_MODEL model name (default: text-embedding-3-large)
EMBEDDING_DIMENSIONS vector dimension (default: 1536)
EMBEDDING_SEND_DIMENSIONS auto (default): sends dimensions only
when MODEL starts with text-embedding-3
Schema templates (pglite-schema.ts, schema-embedded.ts) now interpolate EMBEDDING_MODEL and EMBEDDING_DIMENSIONS so the pgvector column and config metadata match at gbrain init time.
Forces encoding_format: float in the request. The OpenAI SDK defaults to base64 which LM Studio mis-decodes (returns 192 floats for a 768-dim nomic vector). float is spec-compliant and all providers support it.
Verified end-to-end against LM Studio with
text-embedding-nomic-embed-text-v1.5 (768 dim): import, embed, vector search all pass. Existing embed tests still green.