Are you sure you want to delete this access key?
Providers in promptfoo are the interfaces to various language models and AI services. This guide will help you understand how to configure and use providers in your promptfoo evaluations.
Here's a basic example of configuring providers in your promptfoo YAML config:
providers:
- openai:gpt-4o-mini
- anthropic:messages:claude-3-5-sonnet-20241022
- vertex:gemini-pro
Api Providers | Description | Syntax & Example |
---|---|---|
OpenAI | GPT models including GPT-4 and GPT-3.5 | openai:o1-preview |
Anthropic | Claude models | anthropic:messages:claude-3-5-sonnet-20241022 |
HTTP | Generic HTTP-based providers | https://api.example.com/v1/chat/completions |
Javascript | Custom - JavaScript file | file://path/to/custom_provider.js |
Python | Custom - Python file | file://path/to/custom_provider.py |
Shell Command | Custom - script-based providers | exec: python chain.py |
AI21 Labs | Jurassic and Jamba models | ai21:jamba-1.5-mini |
AWS Bedrock | AWS-hosted models from various providers | bedrock:us.meta.llama3-2-90b-instruct-v1:0 |
Azure OpenAI | Azure-hosted OpenAI models | azureopenai:gpt-4o-custom-deployment-name |
Cloudflare AI | Cloudflare's AI platform | cloudflare-ai:@cf/meta/llama-3-8b-instruct |
Cohere | Cohere's language models | cohere:command |
F5 | OpenAI-compatible AI Gateway interface | f5:path-name |
fal.ai | Image Generation Provider | fal:image:fal-ai/fast-sdxl |
GitHub | GitHub AI Gateway | github:gpt-4o-mini |
Google AI Studio (PaLM) | Gemini and PaLM models | google:gemini-pro |
Google Vertex AI | Google Cloud's AI platform | vertex:gemini-pro |
Groq | High-performance inference API | groq:llama3-70b-8192-tool-use-preview |
Hugging Face | Access thousands of models | huggingface:text-generation:gpt2 |
IBM BAM | IBM's foundation models | bam:chat:ibm/granite-13b-chat-v2 |
LiteLLM | Unified interface for multiple providers | Compatible with OpenAI syntax |
Mistral AI | Mistral's language models | mistral:open-mistral-nemo |
OpenLLM | BentoML's model serving framework | Compatible with OpenAI syntax |
OpenRouter | Unified API for multiple providers | openrouter:mistral/7b-instruct |
Perplexity AI | Specialized in question-answering | Compatible with OpenAI syntax |
Replicate | Various hosted models | replicate:stability-ai/sdxl |
Together AI | Various hosted models | Compatible with OpenAI syntax |
Voyage AI | Specialized embedding models | voyage:voyage-3 |
vLLM | Local | Compatible with OpenAI syntax |
Ollama | Local | ollama:llama3.2:latest |
LocalAI | Local | localai:gpt4all-j |
Llamafile | OpenAI-compatible llamafile server | Uses OpenAI provider with custom endpoint |
llama.cpp | Local | llama:7b |
Text Generation WebUI | Gradio WebUI | Compatible with OpenAI syntax |
WebSocket | WebSocket-based providers | ws://example.com/ws |
Webhook | Custom - Webhook integration | webhook:http://example.com/webhook |
Echo | Custom - For testing purposes | echo |
Manual Input | Custom - CLI manual entry | promptfoo:manual-input |
Go | Custom - Go file | file://path/to/your/script.go |
Web Browser | Custom - Automate web browser interactions | browser |
Sequence | Custom - Multi-prompt sequencing | sequence with config.inputs array |
Simulated User | Custom - Conversation simulator | promptfoo:simulated-user |
WatsonX | IBM's WatsonX | watsonx:ibm/granite-13b-chat-v2 |
X.AI | X.AI's models | xai:grok-2 |
Adaline Gateway | Unified interface for multiple providers | Compatible with OpenAI syntax |
Providers are specified using various syntax options:
Simple string format:
provider_name:model_name
Example: openai:gpt-4o-mini
or anthropic:claude-3-sonnet-20240229
Object format with configuration:
- id: provider_name:model_name
config:
option1: value1
option2: value2
Example:
- id: openai:gpt-4o-mini
config:
temperature: 0.7
max_tokens: 150
File-based configuration:
- file://path/to/provider_config.yaml
Most providers use environment variables for authentication:
export OPENAI_API_KEY=your_api_key_here
export ANTHROPIC_API_KEY=your_api_key_here
You can also specify API keys in your configuration file:
providers:
- id: openai:gpt-4o-mini
config:
apiKey: your_api_key_here
promptfoo supports several types of custom integrations:
File-based providers:
providers:
- file://path/to/provider_config.yaml
JavaScript providers:
providers:
- file://path/to/custom_provider.js
Python providers:
providers:
- id: file://path/to/custom_provider.py
HTTP/HTTPS API:
providers:
- id: https://api.example.com/v1/chat/completions
config:
headers:
Authorization: 'Bearer your_api_key'
WebSocket:
providers:
- id: ws://example.com/ws
config:
messageTemplate: '{"prompt": "{{prompt}}"}'
Custom scripts:
providers:
- 'exec: python chain.py'
Many providers support these common configuration options:
temperature
: Controls randomness (0.0 to 1.0)max_tokens
: Maximum number of tokens to generatetop_p
: Nucleus sampling parameterfrequency_penalty
: Penalizes frequent tokenspresence_penalty
: Penalizes new tokens based on presence in textstop
: Sequences where the API will stop generating further tokensExample:
providers:
- id: openai:gpt-4o-mini
config:
temperature: 0.7
max_tokens: 150
top_p: 0.9
frequency_penalty: 0.5
presence_penalty: 0.5
stop: ["\n", 'Human:', 'AI:']
Press p or to see the previous file or, n or to see the next file
Browsing data directories saved to S3 is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with AWS S3!
Are you sure you want to delete this access key?
Browsing data directories saved to Google Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Google Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to Azure Cloud Storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with Azure Cloud Storage!
Are you sure you want to delete this access key?
Browsing data directories saved to S3 compatible storage is possible with DAGsHub. Let's configure your repository to easily display your data in the context of any commit!
promptfoo is now integrated with your S3 compatible storage!
Are you sure you want to delete this access key?