DocKit AI Assistant
DocKit's AI assistant helps you generate complex database queries from natural language descriptions. Instead of memorizing Elasticsearch DSL syntax or PartiQL structures, describe what you need and let the AI write the query.
What the AI Assistant Can Do
- Generate Elasticsearch/OpenSearch queries: Search DSL, aggregations, filters
- Generate DynamoDB PartiQL: SELECT, INSERT, UPDATE, DELETE statements
- Explain query syntax: Ask "what does this query do?" for explanations
- Optimize queries: Get suggestions for query improvements
- Debug errors: Paste error messages for troubleshooting help
Supported Providers
DocKit supports two AI providers:
| Provider | Models | Best For |
|---|---|---|
| OpenAI | GPT-4, GPT-4o, GPT-3.5 | General-purpose, best quality |
| DeepSeek | DeepSeek Chat, DeepSeek Coder | Cost-effective, code-specialized |
Configuring OpenAI
- Open Settings → AI Assistant tab
- Select OpenAI tab
- Fill in:
| Field | Description | Example |
|---|---|---|
| Model | OpenAI model name | gpt-4o, gpt-4, gpt-3.5-turbo |
| API Key | Your OpenAI API key | sk-proj-... |
| Prompt | Custom system prompt (optional) | See below |
| Proxy | HTTP proxy URL (optional) | http://127.0.0.1:7890 |
- Click Save & Enable
Getting an OpenAI API Key
- Go to platform.openai.com
- Sign in or create an account
- Navigate to API Keys → Create new secret key
- Copy the key (starts with
sk-) - Paste into DocKit
Note: OpenAI requires payment. GPT-4 costs ~$0.03 per 1K tokens. GPT-3.5-turbo is cheaper (~$0.002 per 1K tokens).
Configuring DeepSeek
- Open Settings → AI Assistant tab
- Select DeepSeek tab
- Fill in:
| Field | Description | Example |
|---|---|---|
| Model | DeepSeek model name | deepseek-chat, deepseek-coder |
| API Key | Your DeepSeek API key | From DeepSeek platform |
| Prompt | Custom system prompt (optional) | See below |
| Proxy | HTTP proxy URL (optional) | http://127.0.0.1:7890 |
- Click Save & Enable
Getting a DeepSeek API Key
- Go to platform.deepseek.com
- Sign in or create an account
- Navigate to API Keys
- Create and copy your key
- Paste into DocKit
Note: DeepSeek is more cost-effective than OpenAI. deepseek-coder is optimized for code generation tasks.
Custom Prompts
The Prompt field lets you customize how the AI responds. Default prompts are optimized for database queries, but you can tailor them.
Default Prompt Behavior
DocKit automatically injects:
- Index/Table name: Current index or table context
- Schema/Mapping: Field names and types
- Database type: Elasticsearch, OpenSearch, or DynamoDB
This context helps the AI generate accurate queries matching your actual data structure.
Custom Prompt Example
You are a database expert. Generate queries for Elasticsearch/DynamoDB.
- Use only fields from the provided schema
- Explain the query before showing code
- Suggest optimizations when relevantTip: Keep prompts concise. Long prompts consume tokens and slow responses.
Proxy Configuration
If you're behind a firewall or need to route requests through a proxy:
- Enter proxy URL:
http://127.0.0.1:7890 - Format:
http://host:port - Supports HTTP and HTTPS proxies
Common proxy tools:
- Clash: Default port 7890
- V2Ray: Various ports
- Corporate proxies: Check your network settings
Using the AI Assistant
Once configured, access the assistant from the editor:
- Click the AI icon (✨) in the toolbar
- Or press the keyboard shortcut for your platform
- Type your question in natural language
- Press Enter to send
Example Queries
Elasticsearch:
"Find all users who signed up in the last 7 days"
"Aggregate sales by region with average price"
"Search products containing 'laptop' sorted by price"DynamoDB:
"Get all orders for user ID 'user-123'"
"Find items where status equals 'pending'"
"Update the email field for user 'alice'"The AI responds with:
- Generated query code
- Brief explanation
- Any suggestions or warnings
Applying Generated Queries
After the AI generates a query:
- Review the code in the chat panel
- Click Copy to Editor to insert into your query file
- Edit as needed (adjust field names, add filters)
- Execute with
Cmd+Enter(orCtrl+Enter)
Privacy and Data Handling
What DocKit sends to AI providers:
- ✅ Your text prompt (natural language question)
- ✅ Current index/table name
- ✅ Schema/mapping (field names and types)
- ❌ Your actual data (never sends database contents)
- ❌ Credentials (never sends API keys or passwords)
Data retention:
- OpenAI/DeepSeek may retain prompts for 30 days (check their policies)
- DocKit does not store your prompts locally after the session
Best practices:
- Don't paste sensitive data values in prompts
- Use generic examples when asking about production data
- Review generated queries before executing on production
Troubleshooting
Invalid API Key
Error: Invalid API key or Unauthorized
Solution:
- Verify the key is correct (no extra spaces)
- Check the key hasn't expired
- Ensure sufficient credits/quota
- Try regenerating the key
Connection Failed
Error: Network error or Timeout
Solution:
- Check internet connection
- Configure proxy if behind firewall
- Verify API endpoint is accessible
- Check if OpenAI/DeepSeek services are operational
Poor Quality Responses
Problem: AI generates incorrect or nonspecific queries
Solution:
- Switch to a better model (GPT-4 instead of GPT-3.5)
- Be more specific in your prompt (include field names)
- Add schema context manually if auto-injection fails
- Use
deepseek-coderfor code-specific tasks
Rate Limits
Error: Rate limit exceeded
Solution:
- Wait a few seconds before retrying
- Reduce prompt frequency
- Upgrade your OpenAI/DeepSeek plan for higher limits
Switching Providers
To switch between OpenAI and DeepSeek:
- Open Settings → AI Assistant
- Configure both providers (they can be set up simultaneously)
- Only one can be enabled at a time
- Click Save & Enable on your preferred provider
The enabled provider handles all AI requests until you switch.
Disabling the AI Assistant
To turn off AI features:
- Open Settings → AI Assistant
- Click Reset on the active provider
- Or clear the API key field
When disabled, the AI icon is grayed out in the toolbar.
Cost Management
AI queries consume tokens. Estimate costs:
| Provider | Model | Cost per 1K tokens | Typical Query Cost |
|---|---|---|---|
| OpenAI | GPT-4o | $0.005 | ~$0.01-0.02 |
| OpenAI | GPT-4 | $0.03 | ~$0.05-0.10 |
| OpenAI | GPT-3.5-turbo | $0.002 | ~$0.003-0.005 |
| DeepSeek | deepseek-chat | $0.001 | ~$0.002 |
| DeepSeek | deepseek-coder | $0.002 | ~$0.003 |
Tips to reduce costs:
- Use GPT-3.5-turbo or DeepSeek for routine queries
- Reserve GPT-4 for complex queries requiring deep reasoning
- Keep prompts concise (shorter prompts = fewer tokens)
- Cache common query patterns in your saved files
Next Steps
- Settings Guide — Configure other DocKit options
- Elasticsearch Cluster Management — Work with indices
- DynamoDB PartiQL Editor — Learn PartiQL syntax
