Are you sure you want to delete this access key?
Cloudflare Workers AI evaluation with OpenAI-compatible endpoints.
You can run this example with:
npx promptfoo@latest init --example cloudflare-ai
This example requires the following environment variables:
CLOUDFLARE_ACCOUNT_ID
- Your Cloudflare account ID (found in your Cloudflare dashboard)CLOUDFLARE_API_KEY
- Your Cloudflare API key with Workers AI permissionsSet these in your environment:
export CLOUDFLARE_ACCOUNT_ID=your_account_id_here
export CLOUDFLARE_API_KEY=your_api_key_here
chat_config.yaml
)Compares chat and completion providers using current state-of-the-art models:
cloudflare-ai:completion:@cf/qwen/qwen2.5-coder-32b-instruct
- Advanced code generation modelcloudflare-ai:chat:@cf/deepseek-ai/deepseek-r1-distill-qwen-32b
- Reasoning and conversation modelchat_advanced_configuration.yaml
)Demonstrates OpenAI-compatible parameters with Cloudflare AI:
@cf/google/gemma-3-12b-it
(latest Gemma with 128K context)max_tokens
, temperature
, seed
parametersembedding_configuration.yaml
)Shows embedding generation and similarity testing:
@cf/hf/nousresearch/hermes-2-pro-mistral-7b
(function calling support)@cf/baai/bge-large-en-v1.5
(high-quality embeddings)Cloudflare AI supports three provider types:
cloudflare-ai:chat:model-name
- Conversational AI and instruction followingcloudflare-ai:completion:model-name
- Text completion and generationcloudflare-ai:embedding:model-name
- Text embeddings for similarity and searchThis example showcases current state-of-the-art models:
@cf/deepseek-ai/deepseek-r1-distill-qwen-32b
) - Advanced reasoning@cf/qwen/qwen2.5-coder-32b-instruct
) - Code generation leader@cf/google/gemma-3-12b-it
) - 128K context, multilingual@cf/hf/nousresearch/hermes-2-pro-mistral-7b
) - Function calling@cf/baai/bge-large-en-v1.5
) - High-quality embeddingsAll examples use Cloudflare's OpenAI-compatible endpoints, supporting standard parameters:
temperature
- Response randomness controlmax_tokens
- Output length limitstop_p
- Nucleus samplingfrequency_penalty
- Repetition reductionpresence_penalty
- Topic diversityFor local testing with your development version:
npm run local -- eval -c examples/cloudflare-ai/chat_config.yaml
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?