Models and Configuration

DBCode uses AI models to provide inline code completion, natural language query generation, and other intelligent features. Understanding how model selection works helps you optimize your experience and manage your setup.

How DBCode Selects Models for Inline Completion

For inline SQL completions, DBCode uses one of two model sources:

  1. GitHub Copilot (if installed and active in VS Code)
  2. DBCode Hosted Model (fallback when Copilot is not available)

Selection process:

  • First use: DBCode checks if GitHub Copilot is installed and active. If available, it’s used automatically. If not, the hosted model is used as fallback.
  • Your choice is saved to dbcode.ai.modelId setting
  • If GitHub Copilot becomes unavailable later (uninstalled, subscription expired), DBCode automatically falls back to the hosted model

Using GitHub Copilot for Inline Completion

Requirements:

  • GitHub Copilot extension installed in VS Code
  • Active GitHub Copilot subscription (Individual, Business, or Enterprise)
  • Inline completion enabled in DBCode settings

When available, DBCode uses Copilot’s models to provide schema-aware SQL suggestions, natural language to SQL conversion, and database-specific syntax completion.

DBCode Hosted Model

When GitHub Copilot is not available, DBCode falls back to its own hosted model that provides SQL completion capabilities.

Important: The hosted model is only used for inline completion. It is not used for Copilot Tools or MCP (those features require GitHub Copilot or an external AI client).

How It Works

The hosted model:

  • Powered by GROQ using the Llama 3.1 8B Instant model
  • Provides schema-aware SQL completions for inline completion only
  • Uses your database schema (table/column names) to generate suggestions
  • Does not require a GitHub Copilot subscription
  • Automatically used as fallback when Copilot is not installed
  • Requires internet connection to GROQ’s API

Limitations

The hosted model has some constraints:

  • Maximum 1024 output tokens per request
  • Simpler completions compared to GitHub Copilot’s advanced models
  • Requires internet connectivity

Note: The hosted model is a fallback option. For the best experience with inline completions, we recommend using GitHub Copilot.

Configuration Settings

Model Selection

To switch between GitHub Copilot and DBCode’s hosted model:

  1. Open the Command Palette (F1 or Cmd/Ctrl + Shift + P)
  2. Run: DBCode: Change AI Model
  3. Select your preferred model

Alternatively, manually edit your settings:

  • Open Settings (Cmd/Ctrl + ,)
  • Search for dbcode.ai.modelId
  • Clear the value to reset and trigger model selection on next use

Note: The hosted model is only available as a fallback when GitHub Copilot is not installed.

Inline Completion

Inline completion can be enabled or disabled independently:

To disable inline completion:

  1. Open Settings (Cmd/Ctrl + ,)
  2. Search for dbcode.ai.inlineCompletion
  3. Uncheck the checkbox

Or use the command palette:

  1. Press F1 or Cmd/Ctrl + Shift + P
  2. Search for “inline completion” in settings

When disabled, DBCode won’t provide automatic SQL suggestions as you type. You can still use Copilot Tools and MCP for natural language queries.

Provide Schema Context to GitHub Copilot

When using GitHub Copilot for inline completion, DBCode provides your database schema to Copilot for more accurate SQL suggestions in .sql files.

To enable this (recommended):

  1. Open Settings (Cmd/Ctrl + ,)
  2. Search for github.copilot.enable
  3. Add sql to the object with a value of false

This tells GitHub Copilot to defer to DBCode for SQL file completions, allowing DBCode to provide schema context to Copilot’s models.

Example setting:

{
"github.copilot.enable": {
"*": true,
"sql": false
}
}

When you first enable inline completion with Copilot installed, DBCode will prompt you to configure this automatically.

What this does:

  • DBCode sends your database schema (table/column names) to GitHub Copilot
  • Copilot’s models use this context to generate schema-aware SQL
  • Results in more accurate completions that match your actual database structure

AI Features Model Usage

Different DBCode AI features use different model sources:

FeatureModel SourceData Shared
Inline CompletionGitHub Copilot OR DBCode hosted modelSchema only - sent automatically
Copilot ToolsGitHub Copilot onlySchema AND actual data when executing queries
MCPExternal client’s modelSchema AND actual data when executing queries

See Privacy and Security for detailed information on what data is sent to each model source.

Troubleshooting

”No language models found” Error

This error may appear when:

  • GitHub Copilot extension is not installed in VS Code
  • GitHub Copilot subscription is expired or inactive

Solution: Install GitHub Copilot and activate a subscription, or DBCode will automatically fall back to its hosted model (no action needed).

Model Selection Dialog Keeps Appearing

If you’re repeatedly prompted to select a model:

  1. Check that GitHub Copilot extension is still installed
  2. Verify your GitHub Copilot subscription is active
  3. Try manually setting dbcode.ai.modelId in settings to either the Copilot model ID or clear it to allow automatic fallback

Inline Completions Not Working

If suggestions aren’t appearing:

  1. Verify inline completion is enabled: dbcode.ai.inlineCompletion
  2. Ensure the file has a database connection assigned (DBCode needs to know which schema to use)
  3. Check your internet connection (both GitHub Copilot and DBCode’s hosted model require connectivity)
  4. If using GitHub Copilot, verify it’s configured to let DBCode handle SQL files (see Provide Schema Context to GitHub Copilot)