LLM Providers¶
PGA supports three LLM providers. Each provider is configured as a named profile in your PGA configuration file (config.json, config.yaml, or config.yml in ~/.powergentic/).
Supported Providers¶
| Provider | Config Value | Authentication | Description |
|---|---|---|---|
| Azure OpenAI | azure-openai |
API Key or Entra ID | Azure-hosted OpenAI models |
| Azure AI Foundry | azure-ai-foundry |
API Key or Entra ID | Azure AI Foundry deployments |
| Ollama | ollama |
None | Locally-hosted open-source models |
Azure OpenAI¶
Use Azure-hosted OpenAI models (GPT-4o, GPT-4, GPT-3.5, etc.).
Prerequisites¶
- An Azure subscription
- An Azure OpenAI resource
- A deployed model (e.g.,
gpt-4o)
Authentication: API Key¶
The simplest approach — use an API key from the Azure portal.
| JSON | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 | |
Where to find your API key
- Go to the Azure Portal
- Navigate to your Azure OpenAI resource
- Go to Keys and Endpoint
- Copy Key 1 or Key 2
Authentication: Entra ID (Azure AD)¶
Use Azure Active Directory / Entra ID for token-based authentication. This is more secure and doesn't require managing API keys.
| JSON | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 | |
How Entra ID auth works in PGA:
PGA uses the Azure.Identity library's DefaultAzureCredential, which tries these authentication methods in order:
- Environment variables (
AZURE_CLIENT_ID,AZURE_TENANT_ID,AZURE_CLIENT_SECRET) - Managed Identity (when running in Azure)
- Azure CLI (
az login) - Visual Studio credentials
- Azure PowerShell credentials
- Interactive browser login
For local development, the easiest approach is:
| Bash | |
|---|---|
1 2 3 4 5 | |
Required RBAC role
Your Azure AD identity needs the Cognitive Services OpenAI User role on the Azure OpenAI resource.
Optional Settings¶
| Field | Description | Example |
|---|---|---|
modelId |
Model identifier (if different from deployment) | "gpt-4o-2024-05-13" |
apiVersion |
API version override | "2024-02-01" |
maxTokens |
Maximum response tokens | 4096 |
temperature |
Response randomness (0.0–2.0) | 0.7 |
topP |
Nucleus sampling | 0.95 |
Azure AI Foundry¶
Azure AI Foundry uses the same configuration as Azure OpenAI. Set provider to "azure-ai-foundry".
| JSON | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 | |
Info
Both azure-openai and azure-ai-foundry use the same underlying AzureOpenAIClient from the Azure.AI.OpenAI SDK. The provider name is purely for organizational clarity.
Ollama (Local Models)¶
Ollama lets you run open-source LLMs locally on your machine.
Prerequisites¶
| Bash | |
|---|---|
1 | |
| Bash | |
|---|---|
1 | |
Download from ollama.com/download
Then start the server and pull a model:
| Bash | |
|---|---|
1 2 | |
Configuration¶
| JSON | |
|---|---|
1 2 3 4 5 6 7 8 9 10 | |
Configuration Fields¶
| Field | Default | Description |
|---|---|---|
ollamaHost |
http://localhost:11434 |
Ollama server URL |
ollamaModel |
(required) | Model name as shown by ollama list |
Recommended Models for Coding¶
| Model | Size | Best For |
|---|---|---|
llama3 / llama3.1 |
8B | General-purpose, good balance |
codestral |
22B | Code generation and understanding |
qwen2.5-coder |
7B | Code-focused, efficient |
deepseek-coder-v2 |
16B | Strong code completion |
mistral |
7B | Fast general-purpose |
Remote Ollama¶
If Ollama is running on another machine:
| JSON | |
|---|---|
1 2 3 4 5 6 7 8 9 | |
Using Multiple Profiles¶
PGA supports multiple LLM profiles simultaneously. This is useful for:
- Different models for different tasks (e.g., fast model for chat, powerful model for code review)
- Local models for privacy-sensitive work, cloud models for complex tasks
- Testing different providers
Configure Multiple Profiles¶
| JSON | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
Select a Profile¶
| Bash | |
|---|---|
1 2 3 4 5 | |
Agent-Specific Profiles¶
Agents can specify a preferred profile:
| YAML | |
|---|---|
1 2 3 4 | |
Profile Precedence¶
--profileCLI option (highest)- Agent's
profilefrontmatter field - Auto-select rules
defaultProfilein config (lowest)
Troubleshooting¶
Azure OpenAI¶
| Error | Cause | Solution |
|---|---|---|
401 Unauthorized |
Invalid API key | Check the key in Azure Portal → Keys and Endpoint |
404 Not Found |
Wrong endpoint or deployment | Verify endpoint URL and deployment name |
429 Too Many Requests |
Rate limit exceeded | Wait and retry, or upgrade your tier |
Endpoint is required |
Missing endpoint in config | Add endpoint to the profile |
Ollama¶
| Error | Cause | Solution |
|---|---|---|
Connection refused |
Ollama server not running | Run ollama serve |
Model not found |
Model not pulled | Run ollama pull <model> |
| Slow responses | Large model on limited hardware | Try a smaller model |
Entra ID Authentication¶
| Error | Cause | Solution |
|---|---|---|
Interactive authentication required |
No cached credentials | Run az login |
AADSTS50076 |
MFA required | Complete MFA in browser |
Insufficient privileges |
Missing RBAC role | Assign Cognitive Services OpenAI User role |