Overview
Groq provides ultra-fast inference for open-source LLMs like Llama, Mixtral, and Gemma with speeds up to 500+ tokens/second.Installation
Basic Usage
Constructor Options
string
required
Groq model name
string
Groq API key (defaults to
GROQ_API_KEY env variable)number
Sampling temperature
number
Maximum tokens in response
number
default:1
Nucleus sampling parameter
Supported Models
Llama 3.1
llama-3.1-405b-reasoning: Most capablellama-3.1-70b-versatile: Balanced performancellama-3.1-8b-instant: Fastest
Llama 3
llama3-70b-8192: 70B parameter modelllama3-8b-8192: 8B parameter model
Mixtral
mixtral-8x7b-32768: Mixtral MoE model
Gemma
gemma-7b-it: Google Gemma 7Bgemma2-9b-it: Gemma 2 9B
Streaming
Function Calling
Structured Output
Configuration
Environment Variables
Global Settings
Performance
Groq’s LPU (Language Processing Unit) delivers exceptional speed:With LlamaIndex
Model Selection Guide
Rate Limits
Groq has generous free tier limits:- Free: 30 requests/minute
- Paid: Higher limits based on plan
Best Practices
- Use for production: Groq’s speed excellent for real-time applications
- Choose right model: Balance speed vs capability
- Monitor usage: Track API calls and costs
- Stream responses: Even better UX with Groq’s speed
- Handle rate limits: Implement retry logic