Skip to content

Embedders

Embedders convert text (code chunks) into vector representations that enable semantic search.

Available Embedders

ProviderTypeProsCons
OllamaLocalPrivacy, free, no internetRequires local resources
LM StudioLocalPrivacy, OpenAI-compatible API, GUIRequires local resources
OpenAICloudHigh quality, fastCosts money, sends code to cloud

Ollama (Local)

Setup

  1. Install Ollama:
Terminal window
# macOS
brew install ollama
# Linux
curl -fsSL https://ollama.com/install.sh | sh
  1. Start the server:
Terminal window
ollama serve
  1. Pull an embedding model:
Terminal window
ollama pull nomic-embed-text

Configuration

embedder:
provider: ollama
model: nomic-embed-text
endpoint: http://localhost:11434
dimensions: 768

Available Models

ModelDimensionsSpeedQuality
nomic-embed-text768FastGood
mxbai-embed-large1024MediumBetter
all-minilm384Very FastBasic
qwen3-embedding:0.6b1024MediumExcellent
embeddinggemma768Very FastBetter

Troubleshooting

Terminal window
# Check if Ollama is running
curl http://localhost:11434/api/tags
# Test embedding
curl http://localhost:11434/api/embeddings -d '{
"model": "nomic-embed-text",
"prompt": "Hello world"
}'

LM Studio (Local)

LM Studio provides an OpenAI-compatible API for running embedding models locally with a user-friendly GUI.

Setup

  1. Download and install LM Studio

  2. Start LM Studio and load an embedding model (e.g., nomic-embed-text)

  3. Enable the local server (default: http://127.0.0.1:1234)

Configuration

embedder:
provider: lmstudio
model: text-embedding-nomic-embed-text-v1.5
endpoint: http://127.0.0.1:1234

Available Models

Any embedding model supported by LM Studio, including:

ModelDimensionsNotes
nomic-embed-text-v1.5768Good general purpose
bge-small-en-v1.5384Fast, smaller
bge-large-en-v1.51024Higher quality

Troubleshooting

Terminal window
# Check if LM Studio server is running
curl http://127.0.0.1:1234/v1/models
# Test embedding
curl http://127.0.0.1:1234/v1/embeddings -d '{
"model": "text-embedding-nomic-embed-text-v1.5",
"input": ["Hello world"]
}'

OpenAI (Cloud)

Setup

  1. Get an API key from OpenAI Platform

  2. Set the environment variable:

Terminal window
export OPENAI_API_KEY=sk-...

Configuration

embedder:
provider: openai
model: text-embedding-3-small
api_key: ${OPENAI_API_KEY}
dimensions: 1536

Azure OpenAI / Microsoft Foundry

For Azure OpenAI or other OpenAI-compatible providers, use a custom endpoint:

embedder:
provider: openai
model: text-embedding-ada-002
endpoint: https://YOUR-RESOURCE.openai.azure.com/v1
api_key: ${AZURE_OPENAI_API_KEY}
dimensions: 1536

Available Models

ModelDimensionsPrice (per 1M tokens)
text-embedding-3-small1536$0.02
text-embedding-3-large3072$0.13

Cost Estimation

For a typical codebase:

  • 10,000 lines of code ≈ 50,000 tokens
  • Initial index: ~$0.001 with text-embedding-3-small
  • Ongoing updates: negligible

Adding a New Embedder

To add a new embedding provider:

  1. Implement the Embedder interface in embedder/:
type Embedder interface {
Embed(ctx context.Context, text string) ([]float32, error)
EmbedBatch(ctx context.Context, texts []string) ([][]float32, error)
Dimensions() int
}
  1. Add configuration in config/config.go

  2. Wire it up in the CLI commands

See Contributing for more details.