Skip to main content
PUT
/
sdk
/
v1
/
evaluation-assertions
/
{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 evaluationAssertion = await client.evaluationAssertions.update('1212121', {
    evaluationId: 'evaluationId',
    targetValue: 'targetValue',
    type: 'EXACT_MATCH',
  });

  console.log(evaluationAssertion);
}

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_assertion = client.evaluation_assertions.update(
id="1212121",
evaluation_id="evaluationId",
target_value="targetValue",
type="EXACT_MATCH",
)
print(evaluation_assertion)
curl --request PUT \
--url https://api.promptfoundry.ai/sdk/v1/evaluation-assertions/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"type": "EXACT_MATCH",
"evaluationId": "<string>",
"targetValue": "<string>",
"weight": 1,
"jsonPath": "$",
"ignoreCase": false,
"negate": false
}
'
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.promptfoundry.ai/sdk/v1/evaluation-assertions/{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([
'type' => 'EXACT_MATCH',
'evaluationId' => '<string>',
'targetValue' => '<string>',
'weight' => 1,
'jsonPath' => '$',
'ignoreCase' => false,
'negate' => false
]),
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/evaluation-assertions/{id}"

payload := strings.NewReader("{\n \"type\": \"EXACT_MATCH\",\n \"evaluationId\": \"<string>\",\n \"targetValue\": \"<string>\",\n \"weight\": 1,\n \"jsonPath\": \"$\",\n \"ignoreCase\": false,\n \"negate\": false\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/evaluation-assertions/{id}")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"EXACT_MATCH\",\n \"evaluationId\": \"<string>\",\n \"targetValue\": \"<string>\",\n \"weight\": 1,\n \"jsonPath\": \"$\",\n \"ignoreCase\": false,\n \"negate\": false\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.promptfoundry.ai/sdk/v1/evaluation-assertions/{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 \"type\": \"EXACT_MATCH\",\n \"evaluationId\": \"<string>\",\n \"targetValue\": \"<string>\",\n \"weight\": 1,\n \"jsonPath\": \"$\",\n \"ignoreCase\": false,\n \"negate\": false\n}"

response = http.request(request)
puts response.read_body
{
  "type": "EXACT_MATCH",
  "evaluationId": "<string>",
  "targetValue": "<string>",
  "id": "<string>",
  "weight": 1,
  "jsonPath": "$",
  "ignoreCase": false,
  "negate": false
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}
{
"error": "<string>"
}

Authorizations

X-API-KEY
string
header
required

Path Parameters

id
string
required
Example:

"1212121"

Body

application/json
type
enum<string>
required
Available options:
EXACT_MATCH
evaluationId
string
required
targetValue
string
required

The value to match.

weight
number
default:1

How heavily to weigh the assertion within the evaluation.

Required range: 0 <= x <= 1
jsonPath
string | null
default:$

A JSON path to use when matching a JSON response.

ignoreCase
boolean
default:false

Whether to ignore case when comparing strings.

negate
boolean
default:false

Whether to negate the assertion. "true" means the assertion must NOT be true.

Response

Successful operation

type
enum<string>
required
Available options:
EXACT_MATCH
evaluationId
string
required
targetValue
string
required

The value to match.

id
string
required
weight
number
default:1

How heavily to weigh the assertion within the evaluation.

Required range: 0 <= x <= 1
jsonPath
string | null
default:$

A JSON path to use when matching a JSON response.

ignoreCase
boolean
default:false

Whether to ignore case when comparing strings.

negate
boolean
default:false

Whether to negate the assertion. "true" means the assertion must NOT be true.