Create new AI Config
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "completion",
"defaultVariation": {
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"description": "description",
"modelConfigKey": "modelConfigKey",
"tools": [
{
"version": 6,
"key": "key"
},
{
"version": 6,
"key": "key"
}
],
"skills": [
{
"version": 1,
"key": "key"
},
{
"version": 1,
"key": "key"
}
],
"toolKeys": [
"toolKeys",
"toolKeys"
],
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 1
},
"maintainerId": "507f1f77bcf86cd799439011",
"maintainerTeamKey": "example-team-key",
"name": "name",
"description": "",
"viewKeys": [
"viewKeys",
"viewKeys"
],
"evaluationMetricKey": "evaluationMetricKey",
"key": "key",
"isInverted": true,
"tags": [
"tags",
"tags"
]
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs"
payload = {
"mode": "completion",
"defaultVariation": {
"judgeConfiguration": { "judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
] },
"instructions": "instructions",
"description": "description",
"modelConfigKey": "modelConfigKey",
"tools": [
{
"version": 6,
"key": "key"
},
{
"version": 6,
"key": "key"
}
],
"skills": [
{
"version": 1,
"key": "key"
},
{
"version": 1,
"key": "key"
}
],
"toolKeys": ["toolKeys", "toolKeys"],
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"outputFormat": { "key": "" },
"key": "key",
"modelConfigVersion": 1
},
"maintainerId": "507f1f77bcf86cd799439011",
"maintainerTeamKey": "example-team-key",
"name": "name",
"description": "",
"viewKeys": ["viewKeys", "viewKeys"],
"evaluationMetricKey": "evaluationMetricKey",
"key": "key",
"isInverted": True,
"tags": ["tags", "tags"]
}
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({
mode: 'completion',
defaultVariation: {
judgeConfiguration: {
judges: [
{samplingRate: 0.36160767, judgeConfigKey: 'judgeConfigKey'},
{samplingRate: 0.36160767, judgeConfigKey: 'judgeConfigKey'}
]
},
instructions: 'instructions',
description: 'description',
modelConfigKey: 'modelConfigKey',
tools: [{version: 6, key: 'key'}, {version: 6, key: 'key'}],
skills: [{version: 1, key: 'key'}, {version: 1, key: 'key'}],
toolKeys: ['toolKeys', 'toolKeys'],
name: 'name',
messages: [{role: 'role', content: 'content'}, {role: 'role', content: 'content'}],
comment: 'comment',
model: '{}',
outputFormat: {key: ''},
key: 'key',
modelConfigVersion: 1
},
maintainerId: '507f1f77bcf86cd799439011',
maintainerTeamKey: 'example-team-key',
name: 'name',
description: '',
viewKeys: ['viewKeys', 'viewKeys'],
evaluationMetricKey: 'evaluationMetricKey',
key: 'key',
isInverted: true,
tags: ['tags', 'tags']
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs', 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",
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([
'mode' => 'completion',
'defaultVariation' => [
'judgeConfiguration' => [
'judges' => [
[
'samplingRate' => 0.36160767,
'judgeConfigKey' => 'judgeConfigKey'
],
[
'samplingRate' => 0.36160767,
'judgeConfigKey' => 'judgeConfigKey'
]
]
],
'instructions' => 'instructions',
'description' => 'description',
'modelConfigKey' => 'modelConfigKey',
'tools' => [
[
'version' => 6,
'key' => 'key'
],
[
'version' => 6,
'key' => 'key'
]
],
'skills' => [
[
'version' => 1,
'key' => 'key'
],
[
'version' => 1,
'key' => 'key'
]
],
'toolKeys' => [
'toolKeys',
'toolKeys'
],
'name' => 'name',
'messages' => [
[
'role' => 'role',
'content' => 'content'
],
[
'role' => 'role',
'content' => 'content'
]
],
'comment' => 'comment',
'model' => '{}',
'outputFormat' => [
'key' => ''
],
'key' => 'key',
'modelConfigVersion' => 1
],
'maintainerId' => '507f1f77bcf86cd799439011',
'maintainerTeamKey' => 'example-team-key',
'name' => 'name',
'description' => '',
'viewKeys' => [
'viewKeys',
'viewKeys'
],
'evaluationMetricKey' => 'evaluationMetricKey',
'key' => 'key',
'isInverted' => true,
'tags' => [
'tags',
'tags'
]
]),
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"
payload := strings.NewReader("{\n \"mode\": \"completion\",\n \"defaultVariation\": {\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"description\": \"description\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 6,\n \"key\": \"key\"\n },\n {\n \"version\": 6,\n \"key\": \"key\"\n }\n ],\n \"skills\": [\n {\n \"version\": 1,\n \"key\": \"key\"\n },\n {\n \"version\": 1,\n \"key\": \"key\"\n }\n ],\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\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 \"outputFormat\": {\n \"key\": \"\"\n },\n \"key\": \"key\",\n \"modelConfigVersion\": 1\n },\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"\",\n \"viewKeys\": [\n \"viewKeys\",\n \"viewKeys\"\n ],\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"key\": \"key\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"completion\",\n \"defaultVariation\": {\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"description\": \"description\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 6,\n \"key\": \"key\"\n },\n {\n \"version\": 6,\n \"key\": \"key\"\n }\n ],\n \"skills\": [\n {\n \"version\": 1,\n \"key\": \"key\"\n },\n {\n \"version\": 1,\n \"key\": \"key\"\n }\n ],\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\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 \"outputFormat\": {\n \"key\": \"\"\n },\n \"key\": \"key\",\n \"modelConfigVersion\": 1\n },\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"\",\n \"viewKeys\": [\n \"viewKeys\",\n \"viewKeys\"\n ],\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"key\": \"key\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs")
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 \"mode\": \"completion\",\n \"defaultVariation\": {\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"description\": \"description\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 6,\n \"key\": \"key\"\n },\n {\n \"version\": 6,\n \"key\": \"key\"\n }\n ],\n \"skills\": [\n {\n \"version\": 1,\n \"key\": \"key\"\n },\n {\n \"version\": 1,\n \"key\": \"key\"\n }\n ],\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\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 \"outputFormat\": {\n \"key\": \"\"\n },\n \"key\": \"key\",\n \"modelConfigVersion\": 1\n },\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"\",\n \"viewKeys\": [\n \"viewKeys\",\n \"viewKeys\"\n ],\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"key\": \"key\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"_maintainer": {
"kind": "kind"
},
"_links": {
"parent": {
"href": "href",
"type": "type"
},
"self": {
"href": "href",
"type": "type"
}
},
"description": "description",
"evaluationMetricKey": "evaluationMetricKey",
"version": 0,
"tags": [
"tags",
"tags"
],
"dependencies": [
{
"type": "agent-graph",
"key": "key"
},
{
"type": "agent-graph",
"key": "key"
}
],
"mode": "completion",
"createdAt": 2,
"evaluationMetricKeys": [
"evaluationMetricKeys",
"evaluationMetricKeys"
],
"_access": {
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
]
},
"_site": {
"href": "href",
"type": "type"
},
"variations": [
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "modelConfigKey",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 5,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
}
],
"skills": [
{
"version": 9,
"key": "key"
},
{
"version": 9,
"key": "key"
}
],
"createdAt": 1,
"_publishedAt": 2,
"_archivedAt": 5,
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "state",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 6
},
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "modelConfigKey",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 5,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
}
],
"skills": [
{
"version": 9,
"key": "key"
},
{
"version": 9,
"key": "key"
}
],
"createdAt": 1,
"_publishedAt": 2,
"_archivedAt": 5,
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "state",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 6
}
],
"name": "name",
"key": "key",
"isInverted": true,
"updatedAt": 4
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Create new AI Config
Create a new AI Config within the given project.
POST
/
api
/
v2
/
projects
/
{projectKey}
/
ai-configs
Create new AI Config
curl --request POST \
--url https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"mode": "completion",
"defaultVariation": {
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"description": "description",
"modelConfigKey": "modelConfigKey",
"tools": [
{
"version": 6,
"key": "key"
},
{
"version": 6,
"key": "key"
}
],
"skills": [
{
"version": 1,
"key": "key"
},
{
"version": 1,
"key": "key"
}
],
"toolKeys": [
"toolKeys",
"toolKeys"
],
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 1
},
"maintainerId": "507f1f77bcf86cd799439011",
"maintainerTeamKey": "example-team-key",
"name": "name",
"description": "",
"viewKeys": [
"viewKeys",
"viewKeys"
],
"evaluationMetricKey": "evaluationMetricKey",
"key": "key",
"isInverted": true,
"tags": [
"tags",
"tags"
]
}
'import requests
url = "https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs"
payload = {
"mode": "completion",
"defaultVariation": {
"judgeConfiguration": { "judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
] },
"instructions": "instructions",
"description": "description",
"modelConfigKey": "modelConfigKey",
"tools": [
{
"version": 6,
"key": "key"
},
{
"version": 6,
"key": "key"
}
],
"skills": [
{
"version": 1,
"key": "key"
},
{
"version": 1,
"key": "key"
}
],
"toolKeys": ["toolKeys", "toolKeys"],
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"outputFormat": { "key": "" },
"key": "key",
"modelConfigVersion": 1
},
"maintainerId": "507f1f77bcf86cd799439011",
"maintainerTeamKey": "example-team-key",
"name": "name",
"description": "",
"viewKeys": ["viewKeys", "viewKeys"],
"evaluationMetricKey": "evaluationMetricKey",
"key": "key",
"isInverted": True,
"tags": ["tags", "tags"]
}
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({
mode: 'completion',
defaultVariation: {
judgeConfiguration: {
judges: [
{samplingRate: 0.36160767, judgeConfigKey: 'judgeConfigKey'},
{samplingRate: 0.36160767, judgeConfigKey: 'judgeConfigKey'}
]
},
instructions: 'instructions',
description: 'description',
modelConfigKey: 'modelConfigKey',
tools: [{version: 6, key: 'key'}, {version: 6, key: 'key'}],
skills: [{version: 1, key: 'key'}, {version: 1, key: 'key'}],
toolKeys: ['toolKeys', 'toolKeys'],
name: 'name',
messages: [{role: 'role', content: 'content'}, {role: 'role', content: 'content'}],
comment: 'comment',
model: '{}',
outputFormat: {key: ''},
key: 'key',
modelConfigVersion: 1
},
maintainerId: '507f1f77bcf86cd799439011',
maintainerTeamKey: 'example-team-key',
name: 'name',
description: '',
viewKeys: ['viewKeys', 'viewKeys'],
evaluationMetricKey: 'evaluationMetricKey',
key: 'key',
isInverted: true,
tags: ['tags', 'tags']
})
};
fetch('https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs', 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",
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([
'mode' => 'completion',
'defaultVariation' => [
'judgeConfiguration' => [
'judges' => [
[
'samplingRate' => 0.36160767,
'judgeConfigKey' => 'judgeConfigKey'
],
[
'samplingRate' => 0.36160767,
'judgeConfigKey' => 'judgeConfigKey'
]
]
],
'instructions' => 'instructions',
'description' => 'description',
'modelConfigKey' => 'modelConfigKey',
'tools' => [
[
'version' => 6,
'key' => 'key'
],
[
'version' => 6,
'key' => 'key'
]
],
'skills' => [
[
'version' => 1,
'key' => 'key'
],
[
'version' => 1,
'key' => 'key'
]
],
'toolKeys' => [
'toolKeys',
'toolKeys'
],
'name' => 'name',
'messages' => [
[
'role' => 'role',
'content' => 'content'
],
[
'role' => 'role',
'content' => 'content'
]
],
'comment' => 'comment',
'model' => '{}',
'outputFormat' => [
'key' => ''
],
'key' => 'key',
'modelConfigVersion' => 1
],
'maintainerId' => '507f1f77bcf86cd799439011',
'maintainerTeamKey' => 'example-team-key',
'name' => 'name',
'description' => '',
'viewKeys' => [
'viewKeys',
'viewKeys'
],
'evaluationMetricKey' => 'evaluationMetricKey',
'key' => 'key',
'isInverted' => true,
'tags' => [
'tags',
'tags'
]
]),
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"
payload := strings.NewReader("{\n \"mode\": \"completion\",\n \"defaultVariation\": {\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"description\": \"description\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 6,\n \"key\": \"key\"\n },\n {\n \"version\": 6,\n \"key\": \"key\"\n }\n ],\n \"skills\": [\n {\n \"version\": 1,\n \"key\": \"key\"\n },\n {\n \"version\": 1,\n \"key\": \"key\"\n }\n ],\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\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 \"outputFormat\": {\n \"key\": \"\"\n },\n \"key\": \"key\",\n \"modelConfigVersion\": 1\n },\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"\",\n \"viewKeys\": [\n \"viewKeys\",\n \"viewKeys\"\n ],\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"key\": \"key\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\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")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"completion\",\n \"defaultVariation\": {\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"description\": \"description\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 6,\n \"key\": \"key\"\n },\n {\n \"version\": 6,\n \"key\": \"key\"\n }\n ],\n \"skills\": [\n {\n \"version\": 1,\n \"key\": \"key\"\n },\n {\n \"version\": 1,\n \"key\": \"key\"\n }\n ],\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\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 \"outputFormat\": {\n \"key\": \"\"\n },\n \"key\": \"key\",\n \"modelConfigVersion\": 1\n },\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"\",\n \"viewKeys\": [\n \"viewKeys\",\n \"viewKeys\"\n ],\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"key\": \"key\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.launchdarkly.com/api/v2/projects/{projectKey}/ai-configs")
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 \"mode\": \"completion\",\n \"defaultVariation\": {\n \"judgeConfiguration\": {\n \"judges\": [\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n },\n {\n \"samplingRate\": 0.36160767,\n \"judgeConfigKey\": \"judgeConfigKey\"\n }\n ]\n },\n \"instructions\": \"instructions\",\n \"description\": \"description\",\n \"modelConfigKey\": \"modelConfigKey\",\n \"tools\": [\n {\n \"version\": 6,\n \"key\": \"key\"\n },\n {\n \"version\": 6,\n \"key\": \"key\"\n }\n ],\n \"skills\": [\n {\n \"version\": 1,\n \"key\": \"key\"\n },\n {\n \"version\": 1,\n \"key\": \"key\"\n }\n ],\n \"toolKeys\": [\n \"toolKeys\",\n \"toolKeys\"\n ],\n \"name\": \"name\",\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 \"outputFormat\": {\n \"key\": \"\"\n },\n \"key\": \"key\",\n \"modelConfigVersion\": 1\n },\n \"maintainerId\": \"507f1f77bcf86cd799439011\",\n \"maintainerTeamKey\": \"example-team-key\",\n \"name\": \"name\",\n \"description\": \"\",\n \"viewKeys\": [\n \"viewKeys\",\n \"viewKeys\"\n ],\n \"evaluationMetricKey\": \"evaluationMetricKey\",\n \"key\": \"key\",\n \"isInverted\": true,\n \"tags\": [\n \"tags\",\n \"tags\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"_maintainer": {
"kind": "kind"
},
"_links": {
"parent": {
"href": "href",
"type": "type"
},
"self": {
"href": "href",
"type": "type"
}
},
"description": "description",
"evaluationMetricKey": "evaluationMetricKey",
"version": 0,
"tags": [
"tags",
"tags"
],
"dependencies": [
{
"type": "agent-graph",
"key": "key"
},
{
"type": "agent-graph",
"key": "key"
}
],
"mode": "completion",
"createdAt": 2,
"evaluationMetricKeys": [
"evaluationMetricKeys",
"evaluationMetricKeys"
],
"_access": {
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [
null,
null
],
"notResources": [
"notResources",
"notResources"
],
"effect": "allow",
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
]
},
"action": "action"
}
]
},
"_site": {
"href": "href",
"type": "type"
},
"variations": [
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "modelConfigKey",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 5,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
}
],
"skills": [
{
"version": 9,
"key": "key"
},
{
"version": 9,
"key": "key"
}
],
"createdAt": 1,
"_publishedAt": 2,
"_archivedAt": 5,
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "state",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 6
},
{
"judgeConfiguration": {
"judges": [
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
},
{
"samplingRate": 0.36160767,
"judgeConfigKey": "judgeConfigKey"
}
]
},
"instructions": "instructions",
"color": "color",
"_links": {
"parent": {
"href": "href",
"type": "type"
}
},
"description": "description",
"modelConfigKey": "modelConfigKey",
"judgingConfigKeys": [
"judgingConfigKeys",
"judgingConfigKeys"
],
"version": 5,
"tools": [
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
},
{
"customParameters": {
"key": ""
},
"version": 7,
"key": "key"
}
],
"skills": [
{
"version": 9,
"key": "key"
},
{
"version": 9,
"key": "key"
}
],
"createdAt": 1,
"_publishedAt": 2,
"_archivedAt": 5,
"name": "name",
"messages": [
{
"role": "role",
"content": "content"
},
{
"role": "role",
"content": "content"
}
],
"comment": "comment",
"model": "{}",
"_id": "_id",
"state": "state",
"outputFormat": {
"key": ""
},
"key": "key",
"modelConfigVersion": 6
}
],
"name": "name",
"key": "key",
"isInverted": true,
"updatedAt": 4
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}{
"code": "code",
"message": "message"
}Authorizations
Path Parameters
Body
application/json
AI Config object to create
Example:
"507f1f77bcf86cd799439011"
Example:
"example-team-key"
Available options:
agent, completion, judge Show child attributes
Show child attributes
Example:
{ "judgeConfiguration": { "judges": [ { "samplingRate": 0.36160767, "judgeConfigKey": "judgeConfigKey" }, { "samplingRate": 0.36160767, "judgeConfigKey": "judgeConfigKey" } ] }, "instructions": "instructions", "description": "description", "modelConfigKey": "modelConfigKey", "tools": [ { "version": 6, "key": "key" }, { "version": 6, "key": "key" } ], "skills": [ { "version": 1, "key": "key" }, { "version": 1, "key": "key" } ], "toolKeys": ["toolKeys", "toolKeys"], "name": "name", "messages": [ { "role": "role", "content": "content" }, { "role": "role", "content": "content" } ], "comment": "comment", "model": "{}", "outputFormat": { "key": "" }, "key": "key", "modelConfigVersion": 1 }
Evaluation metric key for this config
Whether the evaluation metric is inverted, meaning a lower value is better if set as true
Response
AI Config created
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Example:
{ "allowed": [ { "reason": { "role_name": "role_name", "notActions": [null, null], "notResources": ["notResources", "notResources"], "effect": "allow", "resources": ["proj/*:env/*;qa_*:/flag/*"], "actions": ["*"] }, "action": "action" }, { "reason": { "role_name": "role_name", "notActions": [null, null], "notResources": ["notResources", "notResources"], "effect": "allow", "resources": ["proj/*:env/*;qa_*:/flag/*"], "actions": ["*"] }, "action": "action" } ], "denied": [ { "reason": { "role_name": "role_name", "notActions": [null, null], "notResources": ["notResources", "notResources"], "effect": "allow", "resources": ["proj/*:env/*;qa_*:/flag/*"], "actions": ["*"] }, "action": "action" }, { "reason": { "role_name": "role_name", "notActions": [null, null], "notResources": ["notResources", "notResources"], "effect": "allow", "resources": ["proj/*:env/*;qa_*:/flag/*"], "actions": ["*"] }, "action": "action" } ] }
The location and content type of related resources
Show child attributes
Show child attributes
Example:
{ "parent": { "href": "href", "type": "type" }, "self": { "href": "href", "type": "type" } }
Show child attributes
Show child attributes
Example:
{ "href": "href", "type": "type" }
- Option 1
- Option 2
Show child attributes
Show child attributes
Example:
{ "kind": "kind" }
Available options:
agent, completion, judge Evaluation metric key for this config
List of evaluation metric keys for this config
Whether the evaluation metric is inverted, meaning a lower value is better if set as true
Resources that depend on this config, grouped by type
Show child attributes
Show child attributes