Skip to main content

Evaluating Model Vulnerabilities Across Different Providers

This tutorial guides you through assessing vulnerabilities in models from various providers using EnkryptAI’s red teaming API. We’ll cover setup and usage for OpenAI, Together, Replicate, Azure OpenAI, HuggingFace, AWS Bedrock, Google Gemini, and Anthropic Claude.

Prerequisites

  • Python programming basics
  • Accounts with the model providers you want to test
  • Python libraries: requests, os, dotenv, json

Setup

  1. Install required libraries:
Shell
  1. Set up EnkryptAI API key:
Create an account at app.enkryptai.com and generate an API key. Then export it as an environment variable:
Shell

Running Red Team Tests

Use the following Python script template to run red team tests. Adjust the payload for each provider:

Provider-Specific Configurations

Replace the endpoint_configuration in the payload with the appropriate details for each provider:

OpenAI

Python

Together

Python

Replicate

Python

Azure OpenAI

Python

HuggingFace Inference Endpoint

Python

AWS Bedrock

Python

Google Gemini

Python

Anthropic Claude

Python
Make sure to export your provider API keys as environment variables before running the code:
  • OpenAI: export OPENAI_API_KEY="your-key"
  • Together: export TOGETHER_API_KEY="your-key"
  • Replicate: export REPLICATE_API_KEY="your-key"
  • Azure: export AZURE_OPENAI_API_KEY="your-key" AZURE_INSTANCE="your-instance" AZURE_DEPLOYMENT_ID="your-deployment"
  • HuggingFace: export HF_ENDPOINT_API_KEY="your-key"
  • AWS Bedrock: export AWS_ACCESS_KEY_ID="your-key" AWS_SECRET_ACCESS_KEY="your-secret" AWS_REGION="us-east-1"
  • Gemini: export GEMINI_API_KEY="your-key"
  • Anthropic: export ANTHROPIC_API_KEY="your-key"