config.yml file.
Supported LLM Providers
OpenAI
GPT-3.5, GPT-4, and other OpenAI models
NVIDIA NIM
LLama, Nemotron, and NVIDIA optimized models
Vertex AI
Google’s Gemini and PaLM models
HuggingFace
Open-source models via pipeline or endpoints
OpenAI Configuration
Basic OpenAI Setup
Fromexamples/bots/hello_world/config.yml:
OpenAI with Parameters
Fromexamples/configs/sample/config.yml:
Supported OpenAI Models
string
gpt-4o- Latest GPT-4 Omni modelgpt-4o-mini- Smaller, faster GPT-4 Omnigpt-4-turbo- GPT-4 Turbogpt-4- GPT-4 base modelgpt-3.5-turbo- GPT-3.5 Turbo (chat)gpt-3.5-turbo-instruct- GPT-3.5 Instruct (completion)
Environment Variables
Set your OpenAI API key:NVIDIA NIM Configuration
Basic NIM Setup
Fromexamples/configs/llm/nim/config.yml:
NIM with Cloud API
Multiple NIM Models
Fromexamples/configs/content_safety/config.yml:
Popular NIM Models
- LLama Models
- Nemotron Models
- Safety Models
- Deepseek
Environment Variables
For NVIDIA NIM cloud:Google Vertex AI Configuration
Fromexamples/configs/llm/vertexai/config.yml:
Vertex AI with Parameters
Supported Vertex AI Models
string
gemini-1.5-pro- Latest Gemini Progemini-1.0-pro- Gemini Pro 1.0gemini-1.5-flash- Fast Gemini model
Authentication
Vertex AI requires Google Cloud authentication:HuggingFace Configuration
HuggingFace Pipeline
Fromexamples/configs/llm/hf_pipeline_llama2/config.yml:
Other HuggingFace Pipeline Examples
- Vicuna
- Falcon
- Mosaic
- Dolly
From
examples/configs/llm/hf_pipeline_vicuna/config.yml:HuggingFace Endpoint
Fromexamples/configs/llm/hf_endpoint/config.yml:
Environment Variables
Model Parameters
Common parameters across providers:float
default:"0.7"
Controls randomness. Lower values make output more deterministic
integer
Maximum number of tokens to generate
float
default:"1.0"
Nucleus sampling parameter
float
default:"0.0"
Penalizes repeated tokens (OpenAI)
float
default:"0.0"
Penalizes tokens based on presence (OpenAI)
string
Custom API endpoint URL (NIM, custom deployments)
string
API key for authentication. Use environment variables for security
Multiple Model Types
You can configure different models for different purposes:Streaming Support
Enable streaming for real-time responses. Fromexamples/configs/streaming/config.yml:
Custom LLM Providers
You can add custom LLM providers by implementing the LLM interface:config.yml:
Best Practices
1
Use Environment Variables
Never hardcode API keys in config files
2
Choose Appropriate Models
- Use smaller models (e.g.,
gpt-4o-mini) for simple tasks - Use larger models (e.g.,
gpt-4o) for complex reasoning - Use specialized models for specific tasks (safety, embeddings)
3
Configure Timeouts
4
Test Locally First
Use local NIM deployments for development before switching to cloud APIs
Testing LLM Configuration
- CLI Test
- Python Test
Troubleshooting
API Key Errors
API Key Errors
Ensure environment variables are set:If empty, export them before running:
Connection Errors
Connection Errors
For NIM local deployments, verify the server is running:
Model Not Found
Model Not Found
Verify the model name matches the provider’s available models:
- OpenAI: https://platform.openai.com/docs/models
- NVIDIA NIM: https://catalog.ngc.nvidia.com/
- HuggingFace: https://huggingface.co/models
Next Steps
config.yml Schema
Learn about all configuration options
Guardrails Library
Explore built-in guardrails for different LLMs