Overview
Splat uses Groq as its AI inference provider for analyzing Python errors and generating debugging suggestions. Groq provides ultra-fast LLM inference, making error analysis near-instantaneous.Why Groq?
Groq was chosen for Splat because of:- Speed: Industry-leading inference speeds for real-time debugging
- Quality: Access to powerful models like Llama 3 70B
- Reliability: High uptime and consistent performance
- Developer-friendly: Simple API and generous free tier
Getting a Groq API Key
Sign up for Groq
Visit console.groq.com and create an account.
Groq offers a generous free tier suitable for most development needs.
Create new API key
Click Create API Key, give it a descriptive name (e.g., “Splat Development”), and copy the generated key.
Available Models
Splat uses different models for different components:Error Processing (process/process.py:36)
The main error analysis pipeline uses:Llama 3 70B - The default model for error analysis.
- Context window: 8,192 tokens
- Best for: Complex error analysis, multi-file tracebacks
- Performance: High accuracy, slower inference
- Cost: Higher token usage
process/process.py but provides the best error analysis quality.Agent System (agents/agents.py:37)
The agent system model is configurable via theMODEL environment variable:
Configure which model the agent system uses:Recommended options:
.env
llama3-70b-8192- Best quality (default)llama3-8b-8192- Faster responses, good for simple errorsmixtral-8x7b-32768- Larger context window for complex tracebacks
Model Comparison
| Model | Context Window | Speed | Accuracy | Use Case |
|---|---|---|---|---|
| llama3-70b-8192 | 8,192 tokens | Moderate | Excellent | Complex errors (recommended) |
| llama3-8b-8192 | 8,192 tokens | Fast | Good | Simple errors, quick fixes |
| mixtral-8x7b-32768 | 32,768 tokens | Moderate | Very Good | Large tracebacks, multi-file analysis |
For most use cases, the default
llama3-70b-8192 provides the best balance of quality and performance.API Configuration in Code
Splat configures the Groq API in two locations:1. Error Processing Pipeline
File:process/process.py:11-36
- Uses the
APIenvironment variable - Hardcoded to use
llama3-70b-8192 - Returns structured JSON responses
- Includes detailed system prompts for error analysis
2. Agent System
File:agents/agents.py:36-45
- Uses the
API_KEYandMODELenvironment variables - Configurable model selection
- Structured output with Pydantic models
- Tool-based architecture for file operations
Structured Output Format
Splat uses Groq’s JSON mode to ensure consistent, parseable responses:Rate Limits and Quotas
Groq provides generous rate limits:- Free tier: 30 requests per minute
- Token limits: Varies by model and account type
For typical debugging workflows, the free tier is usually sufficient. Monitor your usage in the Groq Console.
Handling Rate Limits
If you hit rate limits:- Reduce frequency: Space out error analysis requests
- Use smaller models: Switch to
llama3-8b-8192for simple errors - Upgrade account: Contact Groq for higher limits
- Implement retry logic: Add exponential backoff in your code
API Usage Best Practices
Monitor usage
Track your API usage in the Groq Console to avoid unexpected limits.
Use appropriate models
Choose faster models for simple errors to save tokens and time.
Secure your keys
Never commit API keys. Use environment variables and
.gitignore.Handle errors gracefully
Implement error handling for API failures and network issues.
Security Considerations
Key Security Measures
-
Environment variables only
-
Restrict file permissions
-
Use
.gitignore.gitignore -
Rotate keys regularly
- Create new keys monthly
- Delete old keys immediately
-
Separate keys per environment
- Development key for local work
- Production key for deployed services
Troubleshooting
Authentication Failed
Error:401 Unauthorized or Invalid API key
Solutions:
- Verify the API key is correct in
.env - Ensure the key starts with
gsk_ - Check that the key hasn’t been deleted in the console
- Generate a new key if needed
Model Not Available
Error:Model not found or similar
Solutions:
- Check the model name spelling
- Verify the model is available in your Groq account tier
- Use the default by removing the
MODELvariable - Check Groq’s model documentation
Rate Limit Exceeded
Error:429 Too Many Requests
Solutions:
- Wait before making more requests
- Implement exponential backoff
- Switch to a smaller/faster model
- Upgrade your Groq account
Timeout Errors
Error: Request timeouts or slow responses Solutions:- Check your internet connection
- Try a faster model (e.g.,
llama3-8b-8192) - Reduce the size of your error context
- Check Groq’s status page
Advanced Configuration
Custom Model Parameters
While not currently exposed in Splat’s configuration, the Groq API supports additional parameters:process/process.py.
Using Different Providers
While Splat is designed for Groq, you could adapt it for other OpenAI-compatible APIs by:- Installing the appropriate SDK
- Updating the client initialization in
process/process.pyandagents/agents.py - Adjusting model names and parameters
Using alternative providers is not officially supported and may require code modifications.
Related Resources
Environment Variables
Complete environment variable reference
Initial Setup
Step-by-step configuration guide
Groq Documentation
Official Groq API documentation
Groq Console
Manage your API keys and usage