Creating Provider
- curl
- In Python:
curl -X POST \
-H "Content-Type: application/json" \
-H "x-javelin-apikey: $JAVELIN_API_KEY" \
-d '{
"name": "InspectPII",
"description": "Inspect sensitive data",
"type": "inspect",
"enabled": true,
"config": {
"api_base": "https://api.openai.com",
"api_type": "",
"api_version": "v1",
"organization": "",
"deployment_name": ""
}
}' \
"https://your-api-domain.com/v1/admin/providers/openai"
Javelin Client Example
from javelin_sdk import (
JavelinClient,
Provider,
JavelinConfig
)
import os
# Retrieve environment variables
javelin_api_key = os.getenv('JAVELIN_API_KEY')
# Create Javelin configuration
config = JavelinConfig(
base_url="https://your-api-domain.com",
javelin_api_key=javelin_api_key
)
# Create Javelin client
client = JavelinClient(config)
provider_data = {
"name": "openai",
"type": "closed",
"enabled": True,
"config": {
"api_base": "https://api.openai.com",
"api_type": "",
"api_version": "v1",
"organization": "",
"deployment_name": ""
},
}
provider = Provider.model_validate(provider_data)
# create the provider, for async use `await client.acreate_provider(provider)`
client.create_provider(provider)