Using Llama Guard 7B on Cloudflare Workers AI
Implementation guide · Llama Guard · AI at Meta
Quick Start
- 1
- 2Use the Cloudflare Workers AI SDK or REST API to call
llama-guard-7b— see the documentation for request format.
Code Examples
About Cloudflare Workers AI
Cloudflare Workers AI is a serverless GPU inference platform enabling developers to run machine learning models on Cloudflare's global edge network. It supports diverse AI tasks including text generation, image classification, automatic speech recognition, and real-time language translation. The platform provides pay-per-use pricing and access to a curated library of open-source models from Hugging Face, enabling rapid deployment without complex infrastructure management. Key features include low-latency edge computing, streaming responses for large language models, context length customization, and the AI Gateway for monitoring, caching, and cost optimization.
Cloudflare is a leading connectivity cloud company that provides a comprehensive suite of cloud-native products and developer tools to enhance web performance, security, and reliability. Their services include content delivery network (CDN), DDoS mitigation, DNS services, and zero trust security solutions. While Cloudflare doesn't primarily market itself as an AI platform, they have incorporated AI and machine learning technologies into various aspects of their services to improve performance and security, including threat detection capabilities, content delivery optimization, and intelligent routing decisions across their global network.
Pricing on Cloudflare Workers AI
Capabilities
About Llama Guard 7B
Llama Guard 7B is a specialized content moderation model based on the Llama 2 architecture, designed to safeguard AI interactions. With 7 billion parameters, it excels in classifying and moderating both input prompts and output responses from large language models. The model employs a comprehensive risk taxonomy to identify various categories of harmful content, including violence, hate speech, and sexual content. Trained on diverse datasets, including prompts from the Anthropic dataset and in-house generated responses, Llama Guard 7B has demonstrated superior performance compared to industry-standard content moderation APIs. This makes it an invaluable tool for AI engineers focused on deploying safe and responsible AI systems. For more information, visit the model's page on Hugging Face .