JavaScript
import PromptFoundry from '@prompt-foundry/typescript-sdk';
const client = new PromptFoundry({
apiKey: process.env['PROMPT_FOUNDRY_API_KEY'], // This is the default and can be omitted
});
async function main() {
const evaluation = await client.evaluations.update('1212121', {
appendedMessages: [
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
],
promptId: 'promptId',
variables: { foo: 'string' },
});
console.log(evaluation.id);
}
main();import os
from prompt_foundry_python_sdk import PromptFoundry
client = PromptFoundry(
# This is the default and can be omitted
api_key=os.environ.get("PROMPT_FOUNDRY_API_KEY"),
)
evaluation = client.evaluations.update(
id="1212121",
appended_messages=[{
"content": [{
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}],
"role": "assistant",
}, {
"content": [{
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}],
"role": "assistant",
}, {
"content": [{
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}],
"role": "assistant",
}],
prompt_id="promptId",
variables={
"foo": "string"
},
)
print(evaluation.id)curl --request PUT \
--url https://api.promptfoundry.ai/sdk/v1/evaluations/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"promptId": "<string>",
"appendedMessages": [
{
"content": [
{
"type": "TEXT",
"text": "<string>"
}
]
}
],
"variables": {},
"weight": 1,
"threshold": 1
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.promptfoundry.ai/sdk/v1/evaluations/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'promptId' => '<string>',
'appendedMessages' => [
[
'content' => [
[
'type' => 'TEXT',
'text' => '<string>'
]
]
]
],
'variables' => [
],
'weight' => 1,
'threshold' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://api.promptfoundry.ai/sdk/v1/evaluations/{id}"
payload := strings.NewReader("{\n \"promptId\": \"<string>\",\n \"appendedMessages\": [\n {\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"variables\": {},\n \"weight\": 1,\n \"threshold\": 1\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-KEY", "<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.put("https://api.promptfoundry.ai/sdk/v1/evaluations/{id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"promptId\": \"<string>\",\n \"appendedMessages\": [\n {\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"variables\": {},\n \"weight\": 1,\n \"threshold\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptfoundry.ai/sdk/v1/evaluations/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promptId\": \"<string>\",\n \"appendedMessages\": [\n {\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"variables\": {},\n \"weight\": 1,\n \"threshold\": 1\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"promptId": "<string>",
"appendedMessages": [
{
"content": [
{
"type": "TEXT",
"text": "<string>"
}
]
}
],
"variables": {},
"weight": 1,
"threshold": 1
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}API Reference
Update Evaluation
Update an evaluation by ID.
PUT
/
sdk
/
v1
/
evaluations
/
{id}
JavaScript
import PromptFoundry from '@prompt-foundry/typescript-sdk';
const client = new PromptFoundry({
apiKey: process.env['PROMPT_FOUNDRY_API_KEY'], // This is the default and can be omitted
});
async function main() {
const evaluation = await client.evaluations.update('1212121', {
appendedMessages: [
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
{
content: [
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
{ text: 'text', type: 'TEXT' },
],
role: 'assistant',
},
],
promptId: 'promptId',
variables: { foo: 'string' },
});
console.log(evaluation.id);
}
main();import os
from prompt_foundry_python_sdk import PromptFoundry
client = PromptFoundry(
# This is the default and can be omitted
api_key=os.environ.get("PROMPT_FOUNDRY_API_KEY"),
)
evaluation = client.evaluations.update(
id="1212121",
appended_messages=[{
"content": [{
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}],
"role": "assistant",
}, {
"content": [{
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}],
"role": "assistant",
}, {
"content": [{
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}, {
"text": "text",
"type": "TEXT",
}],
"role": "assistant",
}],
prompt_id="promptId",
variables={
"foo": "string"
},
)
print(evaluation.id)curl --request PUT \
--url https://api.promptfoundry.ai/sdk/v1/evaluations/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"promptId": "<string>",
"appendedMessages": [
{
"content": [
{
"type": "TEXT",
"text": "<string>"
}
]
}
],
"variables": {},
"weight": 1,
"threshold": 1
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.promptfoundry.ai/sdk/v1/evaluations/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'promptId' => '<string>',
'appendedMessages' => [
[
'content' => [
[
'type' => 'TEXT',
'text' => '<string>'
]
]
]
],
'variables' => [
],
'weight' => 1,
'threshold' => 1
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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://api.promptfoundry.ai/sdk/v1/evaluations/{id}"
payload := strings.NewReader("{\n \"promptId\": \"<string>\",\n \"appendedMessages\": [\n {\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"variables\": {},\n \"weight\": 1,\n \"threshold\": 1\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-KEY", "<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.put("https://api.promptfoundry.ai/sdk/v1/evaluations/{id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"promptId\": \"<string>\",\n \"appendedMessages\": [\n {\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"variables\": {},\n \"weight\": 1,\n \"threshold\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.promptfoundry.ai/sdk/v1/evaluations/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"promptId\": \"<string>\",\n \"appendedMessages\": [\n {\n \"content\": [\n {\n \"type\": \"TEXT\",\n \"text\": \"<string>\"\n }\n ]\n }\n ],\n \"variables\": {},\n \"weight\": 1,\n \"threshold\": 1\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"promptId": "<string>",
"appendedMessages": [
{
"content": [
{
"type": "TEXT",
"text": "<string>"
}
]
}
],
"variables": {},
"weight": 1,
"threshold": 1
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Path Parameters
Example:
"1212121"
Body
application/json
The messages to append to the completion messages when running the evaluation.
Show child attributes
Show child attributes
The template variables added to the prompt when executing the prompt.
Show child attributes
Show child attributes
How heavily to weigh the evaluation within the prompt.
Required range:
0 <= x <= 1What percentage of assertions must pass for the evaluation to pass.
Required range:
0 <= x <= 1Response
Successful operation
The messages to append to the completion messages when running the evaluation.
Show child attributes
Show child attributes
The template variables added to the prompt when executing the prompt.
Show child attributes
Show child attributes
How heavily to weigh the evaluation within the prompt.
Required range:
0 <= x <= 1What percentage of assertions must pass for the evaluation to pass.
Required range:
0 <= x <= 1Was this page helpful?
⌘I