Log Scores
Update log score
PATCH
/
api
/
logs
/
{log_id}
/
scores
/
{score_id}
/
import requests
url = "https://api.keywordsai.co/api/logs/{log_id}/scores/{score_id}/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
"numerical_value": 4.8,
"string_value": "Excellent quality"
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
{
"numerical_value": 4.8,
"string_value": "Excellent quality"
}
{
"id": "eval_result_unique_id",
"created_at": "2024-01-15T10:30:00Z",
"type": "llm",
"environment": "test",
"numerical_value": 4.8,
"string_value": "Excellent quality",
"boolean_value": true,
"is_passed": false,
"cost": 0.0,
"evaluator_id": null,
"evaluator_slug": "quality_evaluator",
"log_id": "log_unique_id",
"dataset_id": null
}
Updates an existing score for a specific log.
number
Optional updated numerical score value.
string
Optional updated string score value.
boolean
Optional updated boolean score value.
array
Optional updated categorical score value (array of strings). Use when evaluator’s
score_value_type is categorical.import requests
url = "https://api.keywordsai.co/api/logs/{log_id}/scores/{score_id}/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
"numerical_value": 4.8,
"string_value": "Excellent quality"
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
{
"numerical_value": 4.8,
"string_value": "Excellent quality"
}
{
"id": "eval_result_unique_id",
"created_at": "2024-01-15T10:30:00Z",
"type": "llm",
"environment": "test",
"numerical_value": 4.8,
"string_value": "Excellent quality",
"boolean_value": true,
"is_passed": false,
"cost": 0.0,
"evaluator_id": null,
"evaluator_slug": "quality_evaluator",
"log_id": "log_unique_id",
"dataset_id": null
}
Was this page helpful?
⌘I
import requests
url = "https://api.keywordsai.co/api/logs/{log_id}/scores/{score_id}/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
"numerical_value": 4.8,
"string_value": "Excellent quality"
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.patch(url, headers=headers, json=data)
print(response.json())
{
"numerical_value": 4.8,
"string_value": "Excellent quality"
}
{
"id": "eval_result_unique_id",
"created_at": "2024-01-15T10:30:00Z",
"type": "llm",
"environment": "test",
"numerical_value": 4.8,
"string_value": "Excellent quality",
"boolean_value": true,
"is_passed": false,
"cost": 0.0,
"evaluator_id": null,
"evaluator_slug": "quality_evaluator",
"log_id": "log_unique_id",
"dataset_id": null
}