import requests
url = "https://api.keywordsai.co/api/prompts/<prompt_id>/versions/"
api_key = "YOUR_KEYWORDS_AI_API_KEY" # Replace with your actual Keywords AI API key
data = {
"description": "A description of the prompt version",
"messages": [
{"role": "system", "content": "You are a helpful {{role}}."},
{"role": "user", "content": "Hello, how are you?"}
],
"model": "gpt-3.5-turbo",
"stream": false,
"temperature": 0.7,
"max_tokens": 256,
"top_p": 1.0,
"frequency_penalty": 0.0,
"presence_penalty": 0.0,
"variables": {},
"fallback_models": ["gpt-3.5-turbo-16k", "gpt-4"],
"load_balance_models": [
{"model": "gpt-3.5-turbo", "weight": 0.7},
{"model": "gpt-4", "weight": 0.3}
],
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())