Create AI Config variation
For the complete documentation index, see llms.txt. For the full documentation snapshot, see llms-full.txt.
Create a new variation for a given AI Config.
The model in the request body requires a modelName and parameters, for example:
"model": {
"modelName": "claude-3-opus-20240229",
"parameters": {
"max_tokens": 1024
}
}
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"toolKeys": [
"toolKeys",
"toolKeys"
],
"name": "name",
"description": "description",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"modelConfigKey": "modelConfigKey",
"tools": [
{
"version": 0,
"key": "key"
},
{
"version": 0,
"key": "key"
}
],
"key": "key"
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations"
payload = {
"judgeConfiguration": { "judges": [
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
}
] },
"instructions": "instructions",
"toolKeys": ["toolKeys", "toolKeys"],
"name": "name",
"description": "description",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"modelConfigKey": "modelConfigKey",
"tools": [
{
"version": 0,
"key": "key"
},
{
"version": 0,
"key": "key"
}
],
"key": "key"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
judgeConfiguration: {
judges: [
{samplingRate: 0.7061401, judgeConfigKey: 'judgeConfigKey'},
{samplingRate: 0.7061401, judgeConfigKey: 'judgeConfigKey'}
]
},
instructions: 'instructions',
toolKeys: ['toolKeys', 'toolKeys'],
name: 'name',
description: 'description',
messages: [{role: 'role', content: 'content'}, {role: 'role', content: 'content'}],
comment: 'comment',
model: '{}',
modelConfigKey: 'modelConfigKey',
tools: [{version: 0, key: 'key'}, {version: 0, key: 'key'}],
key: 'key'
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'judgeConfiguration' => [
'judges' => [
[
'samplingRate' => 0.7061401,
'judgeConfigKey' => 'judgeConfigKey'
],
[
'samplingRate' => 0.7061401,
'judgeConfigKey' => 'judgeConfigKey'
]
]
],
'instructions' => 'instructions',
'toolKeys' => [
'toolKeys',
'toolKeys'
],
'name' => 'name',
'description' => 'description',
'messages' => [
[
'role' => 'role',
'content' => 'content'
],
[
'role' => 'role',
'content' => 'content'
]
],
'comment' => 'comment',
'model' => '{}',
'modelConfigKey' => 'modelConfigKey',
'tools' => [
[
'version' => 0,
'key' => 'key'
],
[
'version' => 0,
'key' => 'key'
]
],
'key' => 'key'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations"
payload := strings.NewReader("{\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\n \"description\": \"description\",\n \"messages\": [\n {\n \"role\": \"role\",\n \"content\": \"content\"\n },\n {\n \"role\": \"role\",\n \"content\": \"content\"\n }\n ],\n \"comment\": \"comment\",\n \"model\": \"{}\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 0,\n \"key\": \"key\"\n },\n {\n \"version\": 0,\n \"key\": \"key\"\n }\n ],\n \"key\": \"key\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\n \"description\": \"description\",\n \"messages\": [\n {\n \"role\": \"role\",\n \"content\": \"content\"\n },\n {\n \"role\": \"role\",\n \"content\": \"content\"\n }\n ],\n \"comment\": \"comment\",\n \"model\": \"{}\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 0,\n \"key\": \"key\"\n },\n {\n \"version\": 0,\n \"key\": \"key\"\n }\n ],\n \"key\": \"key\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\n \"description\": \"description\",\n \"messages\": [\n {\n \"role\": \"role\",\n \"content\": \"content\"\n },\n {\n \"role\": \"role\",\n \"content\": \"content\"\n }\n ],\n \"comment\": \"comment\",\n \"model\": \"{}\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 0,\n \"key\": \"key\"\n },\n {\n \"version\": 0,\n \"key\": \"key\"\n }\n ],\n \"key\": \"key\"\n}"
response = http.request(request)
puts response.read_body{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "modelConfigKey",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 1,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 2,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 2,
"key": "key"
}
],
"createdAt": 6,
"_publishedAt": 5,
"_archivedAt": 5,
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "state",
"key": "key"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Authorizations
Body
AI Config variation object to create
Human-readable description of this variation
Returns the description for the agent. This is only returned for agent variations.
Returns the instructions for the agent. This is only returned for agent variations.
Show child attributes
Show child attributes
List of tools to use for this variation. The latest version of the tool will be used.
Show child attributes
Show child attributes
List of tool keys to use for this variation. The latest version of the tool will be used.
Show child attributes
Show child attributes
{
"judges": [
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
}
]
}
Response
AI Config variation created
Show child attributes
Show child attributes
{
"parent": { "href": "href", "type": "type" }
}
Returns the description for the agent. This is only returned for agent variations.
Returns the instructions for the agent. This is only returned for agent variations.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
{
"judges": [
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
}
]
}
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"toolKeys": [
"toolKeys",
"toolKeys"
],
"name": "name",
"description": "description",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"modelConfigKey": "modelConfigKey",
"tools": [
{
"version": 0,
"key": "key"
},
{
"version": 0,
"key": "key"
}
],
"key": "key"
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations"
payload = {
"judgeConfiguration": { "judges": [
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
}
] },
"instructions": "instructions",
"toolKeys": ["toolKeys", "toolKeys"],
"name": "name",
"description": "description",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"modelConfigKey": "modelConfigKey",
"tools": [
{
"version": 0,
"key": "key"
},
{
"version": 0,
"key": "key"
}
],
"key": "key"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
judgeConfiguration: {
judges: [
{samplingRate: 0.7061401, judgeConfigKey: 'judgeConfigKey'},
{samplingRate: 0.7061401, judgeConfigKey: 'judgeConfigKey'}
]
},
instructions: 'instructions',
toolKeys: ['toolKeys', 'toolKeys'],
name: 'name',
description: 'description',
messages: [{role: 'role', content: 'content'}, {role: 'role', content: 'content'}],
comment: 'comment',
model: '{}',
modelConfigKey: 'modelConfigKey',
tools: [{version: 0, key: 'key'}, {version: 0, key: 'key'}],
key: 'key'
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'judgeConfiguration' => [
'judges' => [
[
'samplingRate' => 0.7061401,
'judgeConfigKey' => 'judgeConfigKey'
],
[
'samplingRate' => 0.7061401,
'judgeConfigKey' => 'judgeConfigKey'
]
]
],
'instructions' => 'instructions',
'toolKeys' => [
'toolKeys',
'toolKeys'
],
'name' => 'name',
'description' => 'description',
'messages' => [
[
'role' => 'role',
'content' => 'content'
],
[
'role' => 'role',
'content' => 'content'
]
],
'comment' => 'comment',
'model' => '{}',
'modelConfigKey' => 'modelConfigKey',
'tools' => [
[
'version' => 0,
'key' => 'key'
],
[
'version' => 0,
'key' => 'key'
]
],
'key' => 'key'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations"
payload := strings.NewReader("{\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\n \"description\": \"description\",\n \"messages\": [\n {\n \"role\": \"role\",\n \"content\": \"content\"\n },\n {\n \"role\": \"role\",\n \"content\": \"content\"\n }\n ],\n \"comment\": \"comment\",\n \"model\": \"{}\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 0,\n \"key\": \"key\"\n },\n {\n \"version\": 0,\n \"key\": \"key\"\n }\n ],\n \"key\": \"key\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\n \"description\": \"description\",\n \"messages\": [\n {\n \"role\": \"role\",\n \"content\": \"content\"\n },\n {\n \"role\": \"role\",\n \"content\": \"content\"\n }\n ],\n \"comment\": \"comment\",\n \"model\": \"{}\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 0,\n \"key\": \"key\"\n },\n {\n \"version\": 0,\n \"key\": \"key\"\n }\n ],\n \"key\": \"key\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs/{configKey}/variations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.7061401,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\n \"description\": \"description\",\n \"messages\": [\n {\n \"role\": \"role\",\n \"content\": \"content\"\n },\n {\n \"role\": \"role\",\n \"content\": \"content\"\n }\n ],\n \"comment\": \"comment\",\n \"model\": \"{}\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 0,\n \"key\": \"key\"\n },\n {\n \"version\": 0,\n \"key\": \"key\"\n }\n ],\n \"key\": \"key\"\n}"
response = http.request(request)
puts response.read_body{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.7061401,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "modelConfigKey",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 1,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 2,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 2,
"key": "key"
}
],
"createdAt": 6,
"_publishedAt": 5,
"_archivedAt": 5,
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "state",
"key": "key"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}