fetch('https://api.keywordsai.co/api/prompts/<prompt_id>/versions/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_KEYWORDS_AI_API_KEY'
},
body: JSON.stringify({
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: {},
})
})
.then(response => response.json())
.then(data => console.log(data));