Skip to main content
Version: 0.1.0

AI Provider Configuration

RaisinDB integrates with major LLM and embedding providers out of the box. Each tenant configures AI independently, so different teams or applications on the same instance can use different providers and models.

Supported Providers

ProviderModelsNotes
OpenAIGPT-4, GPT-3.5, text-embedding-3-small/largeDefault provider
AnthropicClaude model family
Google GeminiGemini 1.5, 2.0Tool calling support
Azure OpenAIAzure-hosted OpenAI modelsEnterprise deployments
GroqOpen-source models (Llama, Mixtral)Fast inference
OpenRouterMulti-provider routerUnified API for many models
AWS BedrockClaude, Nova, LlamaVia AWS credentials
OllamaAny local modelSelf-hosted, no API key needed
CustomAny OpenAI-compatible endpointCustom deployments

Configuring a Provider

Provider configuration is stored per-tenant in the system workspace. Set it via the REST API or SQL:

-- Configure OpenAI as the default provider
INSERT INTO 'raisin:system' (name, path, node_type, properties) VALUES (
'ai-config',
'/config/ai',
'raisin:AIConfig',
'{
"providers": [
{
"provider": "openai",
"api_key": "sk-your-api-key-here",
"enabled": true,
"models": ["gpt-4", "text-embedding-3-small"]
}
]
}'
);

API Key Security

API keys are encrypted at rest using AES-256-GCM before being stored. The master encryption key should be managed through your secrets infrastructure (environment variables, AWS Secrets Manager, HashiCorp Vault, etc.).

  • Encrypted keys are never returned to API clients
  • Keys are decrypted only at the moment of use
  • Each tenant's keys are isolated from other tenants

Multiple Providers

You can configure multiple providers simultaneously. This is useful for using different models for different tasks (e.g., OpenAI for embeddings, Anthropic for generation):

# In your tenant configuration
providers:
- provider: openai
api_key: "sk-..."
enabled: true
models:
- text-embedding-3-small
- text-embedding-3-large

- provider: anthropic
api_key: "sk-ant-..."
enabled: true
models:
- claude-sonnet-4-20250514

- provider: ollama
api_endpoint: "http://localhost:11434"
enabled: true
models:
- llama3
- nomic-embed-text

Embedding Configuration

Embeddings power vector search and RAG patterns. RaisinDB generates embeddings automatically when configured.

Auto-Embedding

When a provider with embedding models is configured, RaisinDB can automatically generate embeddings when nodes are created or updated. Embedding generation runs asynchronously through the job system, so it doesn't block write operations.

Embedding Dimensions

Different models produce different vector dimensions:

ModelDimensionsProvider
text-embedding-3-small1536OpenAI
text-embedding-3-large3072OpenAI
nomic-embed-text768Ollama

The HNSW vector index is configured with a fixed dimension size at startup. Make sure your embedding model dimensions match the configured index dimensions.

Text Chunking

For long documents, RaisinDB automatically splits content into chunks before generating embeddings. Chunking is configurable:

  • By tokens — split at token boundaries (recommended for most models)
  • By sentences — preserve sentence boundaries
  • By paragraphs — keep paragraphs intact

Chunk overlap is configurable to ensure context is preserved across chunk boundaries.

Local Inference with Ollama

For environments where data cannot leave the network, use Ollama for fully local inference:

providers:
- provider: ollama
api_endpoint: "http://localhost:11434"
enabled: true
models:
- llama3
- nomic-embed-text

No API key is required for Ollama. Make sure the Ollama server is running and the models are pulled before use.

Local Inference with Candle

RaisinDB also supports local inference via the Candle framework for specialized models like CLIP and BLIP (image understanding). This requires the candle feature flag on the server build and downloads models from HuggingFace automatically.

Per-Tenant Isolation

Each tenant has its own AI configuration, meaning:

  • Tenant A can use OpenAI while Tenant B uses Anthropic
  • API keys are scoped to a single tenant
  • Usage and billing are naturally separated
  • Model availability can differ per tenant

Default Model Settings

You can set default models for different operations:

defaults:
embedding_model: "text-embedding-3-small"
embedding_provider: "openai"
generation_model: "claude-sonnet-4-20250514"
generation_provider: "anthropic"
chunking:
strategy: "tokens"
chunk_size: 512
chunk_overlap: 50

These defaults are used when no specific model is requested in an API call or function invocation.

Next Steps