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:
- GitHub Copilot (if installed and active in VS Code)
- 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.modelIdsetting - 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:
- Open the Command Palette (
F1orCmd/Ctrl + Shift + P) - Run:
DBCode: Change AI Model - 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:
- Open Settings (
Cmd/Ctrl + ,) - Search for
dbcode.ai.inlineCompletion - Uncheck the checkbox
Or use the command palette:
- Press
F1orCmd/Ctrl + Shift + P - 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):
- Open Settings (
Cmd/Ctrl + ,) - Search for
github.copilot.enable - Add
sqlto the object with a value offalse
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:
| Feature | Model Source | Data Shared |
|---|---|---|
| Inline Completion | GitHub Copilot OR DBCode hosted model | Schema only - sent automatically |
| Copilot Tools | GitHub Copilot only | Schema AND actual data when executing queries |
| MCP | External client’s model | Schema 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:
- Check that GitHub Copilot extension is still installed
- Verify your GitHub Copilot subscription is active
- Try manually setting
dbcode.ai.modelIdin settings to either the Copilot model ID or clear it to allow automatic fallback
Inline Completions Not Working
If suggestions aren’t appearing:
- Verify inline completion is enabled:
dbcode.ai.inlineCompletion - Ensure the file has a database connection assigned (DBCode needs to know which schema to use)
- Check your internet connection (both GitHub Copilot and DBCode’s hosted model require connectivity)
- If using GitHub Copilot, verify it’s configured to let DBCode handle SQL files (see Provide Schema Context to GitHub Copilot)
Related Documentation
- Privacy and Security - Data handling and privacy considerations
- Inline Completion - Using inline SQL suggestions
- Copilot Tools - Natural language database queries
- MCP - Connecting external AI clients