Providers Overview

View Source

barrel_embed supports multiple embedding providers, each with different characteristics and use cases.

Cloud Providers

Production-ready cloud embedding APIs with high availability and no infrastructure to manage.

ProviderRequirementsDimensionsBest For
OpenAIAPI key256-3072Production, general purpose
CohereAPI key384-1024Production, input type optimization
Voyage AIAPI key512-1536RAG, retrieval, domain-specific
Jina AIAPI key768-1024Long context (8K), multilingual
MistralAPI key1024EU data residency
Azure OpenAIAzure subscription1536-3072Enterprise, compliance
AWS BedrockAWS credentials1024-1536AWS ecosystem, enterprise
Google Vertex AIGCP project768GCP ecosystem, enterprise

Local Providers

Run embedding models locally without external API calls.

ProviderRequirementsDimensionsBest For
OllamaOllama serverModel-dependentLocal development
LocalPython + sentence-transformersModel-dependentOffline use
FastEmbedPython + fastembedModel-dependentLightweight local

Specialized Providers

Advanced embedding types for specific use cases.

ProviderTypeRequirementsBest For
SPLADESparsePython + transformers + torchHybrid search
ColBERTMulti-vectorPython + transformers + torchFine-grained matching
CLIPCross-modalPython + transformers + torch + pillowImage-text search

Choosing a Provider

For Production

Cloud providers are recommended:

  • OpenAI - Best general-purpose quality
  • Cohere - Input type optimization (search_query vs search_document)
  • Voyage AI - Top retrieval performance, domain-specific models
  • Jina AI - Longest context length (8K tokens)

For Enterprise

Hyperscaler providers with compliance features:

  • Azure OpenAI - SOC 2, HIPAA, regional deployment
  • AWS Bedrock - VPC integration, IAM, CloudWatch
  • Google Vertex AI - VPC-SC, CMEK, BigQuery integration

For EU Data Residency

  • Mistral - EU-based company
  • Azure OpenAI - Deploy in EU regions
  • Google Vertex AI - Deploy in EU regions

For Local Development

Ollama is recommended:

  • No Python dependencies
  • Easy model management
  • Good performance

For Offline/Air-gapped

Local or FastEmbed:

  • No external API calls
  • Full data privacy
  • FastEmbed is lighter (~100MB vs ~2GB)

For Specialized Use Cases

  • Hybrid search: Use SPLADE for sparse + dense combination
  • Passage retrieval: Use ColBERT for token-level matching
  • Image search: Use CLIP for cross-modal embeddings

Provider Chain

Configure fallback providers for high availability:

#{embedder => [
    {voyage, #{api_key => <<"pa-...">>}},      % Primary: best retrieval
    {openai, #{api_key => <<"sk-...">>}},      % Fallback: OpenAI
    {ollama, #{url => <<"http://localhost:11434">>}}  % Offline fallback
]}

Providers are tried in order. If one fails, the next is attempted automatically.

Quick Comparison

FeatureOpenAICohereVoyageJinaMistralAzureBedrockVertex
Batch supportYesYesYesYesYesYesNoYes
Free tierNoLimitedNoYesNoNoNoNo
EU residencyNoNoNoNoYesYesYesYes
Max context8K51232K8K8K8K8K2K
Domain modelsNoNoYesNoNoNoYesNo