Skip to content

Add local Ollama embedding setup for OpenAI-compatible endpoint#112

Closed
alexzhu0 wants to merge 1 commit into
garrytan:masterfrom
alexzhu0:docs/local-ollama-embeddings
Closed

Add local Ollama embedding setup for OpenAI-compatible endpoint#112
alexzhu0 wants to merge 1 commit into
garrytan:masterfrom
alexzhu0:docs/local-ollama-embeddings

Conversation

@alexzhu0

@alexzhu0 alexzhu0 commented Apr 14, 2026

Copy link
Copy Markdown

Summary

  • document how to run GBrain embeddings against a local Ollama server via the OpenAI-compatible /v1/embeddings endpoint
  • make the embedding model and dimensions configurable via environment variables so local models can be used without editing source each time
  • add verification notes about the 1536-dimension schema compatibility caveat

Why

I validated this locally with qwen3-embedding:4b on Ollama. The important detail is that Ollama's native /api/embed can return a model's native dimension, while the OpenAI-compatible endpoint can return 1536 dimensions when requested, which matches GBrain's current schema.

Test Plan

  • bun test test/embed.test.ts
  • verified locally that gbrain embed --stale and gbrain query work against a local Ollama server configured through OPENAI_BASE_URL, OPENAI_EMBED_MODEL, and OPENAI_EMBED_DIMENSIONS

@alexzhu0

Copy link
Copy Markdown
Author

Closing — overtaken by recent provider-config refactor (#1136 README rewrite, #1246 default_headers seam, #1278 env-detection picker). The current approach is more general than what this PR proposed. Thanks!

@alexzhu0 alexzhu0 closed this May 23, 2026
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.

1 participant