AI Chat Assistant

Setting Up AI Providers

Setting Up AI Providers

Before you can use WhoDB's AI Chat Assistant, you need to configure at least one AI provider. This guide walks you through setting up each supported provider and choosing the right model for your needs.

Accessing the AI Configuration

Navigate to the Chat page in WhoDB to access AI provider settings:

Chat Initial Page

The provider configuration is located at the top of the Chat interface with two dropdowns:

  1. AI Provider: Select your provider (OpenAI, Anthropic, Gemini, Ollama, LM Studio, etc.)
  2. AI Model: Choose the specific model to use

Choosing Your AI Provider

Different providers offer different trade-offs between accuracy, speed, cost, and privacy:

OpenAI

Best for: Most users, general-purpose queries

  • Industry-leading accuracy
  • Fast response times
  • Pay-per-use pricing
Anthropic

Best for: Complex reasoning, large contexts

  • Excellent with sophisticated queries
  • Very large context windows
  • Strong safety features
Gemini

Best for: Google Cloud users, general-purpose queries

  • Strong reasoning and SQL generation
  • Competitive pricing
  • Pay-per-use pricing
Ollama / LM Studio

Best for: Privacy, zero API costs

  • Complete data privacy
  • No internet required
  • Free to use
Custom

Best for: Enterprise deployments

  • Self-hosted models
  • Organization-specific configurations
  • Complete control

Setting Up OpenAI

OpenAI provides GPT models that offer excellent SQL generation capabilities with fast response times.

Prerequisites

Before configuring OpenAI:

  1. Create an OpenAI account at https://platform.openai.com/
  2. Add payment method to your account
  3. Generate an API key from https://platform.openai.com/api-keys

Configuration Steps

Cost Considerations

OpenAI charges based on tokens used. Costs vary by model, schema size, and conversation length. See OpenAI's pricing page for current rates and monitor usage in your OpenAI dashboard.

Setting Up Anthropic (Claude)

Anthropic's Claude models excel at complex reasoning and handle large database schemas exceptionally well.

Prerequisites

  1. Create an Anthropic account at https://console.anthropic.com/
  2. Add payment method
  3. Generate an API key from the console

Configuration Steps

When to Use Claude

Claude excels in these scenarios:

  • Large Schemas: Handles databases with hundreds of tables
  • Complex Joins: Better at understanding multi-table relationships
  • Contextual Queries: Superior at maintaining long conversation contexts
  • Ambiguous Requests: Better at asking clarifying questions

Setting Up Google Gemini

Gemini models offer strong SQL generation with competitive pricing.

Prerequisites

  1. Create a Google AI Studio account at https://aistudio.google.com/
  2. Generate an API key from the AI Studio console

Configuration Steps

Setting Up Ollama (Local Models)

Ollama allows you to run AI models locally on your machine, providing complete privacy with zero API costs.

Prerequisites

Configuring Ollama in WhoDB

Model
Size
RAM Required
Best For
Download Command
Llama 3.1 (8B)
4.7 GB
8 GB
General use, good balance
ollama run llama3.1
CodeLlama (7B)
3.8 GB
8 GB
Code/SQL generation
ollama run codellama
Mistral (7B)
4.1 GB
8 GB
Fast responses
ollama run mistral
Llama 3.1 (70B)
40 GB
64 GB
Maximum accuracy
ollama run llama3.1:70b

Ollama Performance Optimization

Ollama Privacy Benefits

Complete Data Privacy

Your database schema never leaves your machine

No Internet Required

Works in air-gapped or offline environments

Zero Ongoing Costs

No API charges regardless of usage

Full Control

Choose models, control updates, customize behavior

Setting Up LM Studio (Local Models)

LM Studio is another local option with a desktop app for downloading and managing models.

Advanced Configuration

Multiple Providers

You can configure multiple AI providers and switch between them:

Removing Providers

Built-In Providers via Environment Variables

You can preconfigure the built-in providers on the server so users don't need to enter API keys in the UI:

Variable
Description
WHODB_OPENAI_API_KEY
OpenAI API key
WHODB_OPENAI_ENDPOINT
Custom OpenAI-compatible endpoint (optional)
WHODB_OPENAI_NAME
Display name override (optional)
WHODB_ANTHROPIC_API_KEY
Anthropic API key
WHODB_ANTHROPIC_ENDPOINT
Custom Anthropic endpoint (optional)
WHODB_ANTHROPIC_NAME
Display name override (optional)
WHODB_GEMINI_ENDPOINT
Custom Gemini endpoint (optional)
WHODB_OLLAMA_HOST / WHODB_OLLAMA_PORT
Ollama host and port (default: localhost:11434)
WHODB_OLLAMA_NAME
Display name override (optional)
WHODB_LMSTUDIO_BASE_URL
LM Studio server URL (default: http://localhost:1234)
WHODB_LMSTUDIO_API_KEY
LM Studio API key, if required (optional)
WHODB_LMSTUDIO_NAME
Display name override (optional)
WHODB_BLOCK_INTERNAL_AI_ENDPOINTS
Set to true to block AI requests to internal/private network endpoints (SSRF protection for hosted deployments)

Custom Providers via Environment Variables

You can connect any OpenAI-compatible AI provider (LM Studio, OpenRouter, vLLM, etc.) using WHODB_AI_GENERIC_<ID>_* environment variables. This is useful for Docker deployments, self-hosted models, or providers not built into the UI.

Each provider needs a unique <ID> (e.g., LMSTUDIO, OPENROUTER) and up to six variables:

Variable
Required
Default
Description
WHODB_AI_GENERIC_<ID>_NAME
No
<ID>
Display name shown in the provider dropdown
WHODB_AI_GENERIC_<ID>_TYPE
No
openai-generic
Client type (leave default for OpenAI-compatible APIs)
WHODB_AI_GENERIC_<ID>_BASE_URL
Yes
API base URL (e.g., http://localhost:1234/v1)
WHODB_AI_GENERIC_<ID>_API_KEY
No
API key if required by the provider
WHODB_AI_GENERIC_<ID>_MODELS
Yes
Comma-separated list of model names
WHODB_AI_GENERIC_<ID>_ICON
No
URL of an icon to show in the provider dropdown
export WHODB_AI_GENERIC_LMSTUDIO_NAME="LM Studio"
export WHODB_AI_GENERIC_LMSTUDIO_BASE_URL="http://localhost:1234/v1"
export WHODB_AI_GENERIC_LMSTUDIO_MODELS="mistral-7b,llama-3-8b"

Provider Comparison

Choose the right provider for your needs:

Feature
OpenAI
Anthropic
Ollama
Setup Complexity
Easy
Easy
Moderate
Cost
Pay per use
Pay per use
Free
Privacy
External
External
Complete
Speed
Fast
Medium
Varies
Accuracy
Excellent
Excellent
Good
Internet Required
Yes
Yes
No
Best For
General use
Complex queries
Privacy/Cost

Troubleshooting

Security Best Practices

Next Steps

Querying Data

Learn how to ask questions and retrieve data using your configured provider

Your First AI Query

Step-by-step tutorial to get started with the AI assistant

Conversation Features

Master multi-turn conversations and context management

Best Practices

Learn optimal patterns for using the AI assistant