Scores
Create score
POST
/
api
/
scores
/
import requests
url = "https://api.keywordsai.co/api/scores/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
"evaluator_slug": "my_custom_evaluator",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": True
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
{
"evaluator_slug": "my_custom_evaluator",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": true
}
{
"id": "eval_result_unique_id",
"created_at": "2024-01-15T10:30:00Z",
"type": "llm",
"environment": "test",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": true,
"is_passed": false,
"cost": 0.0,
"evaluator_id": null,
"evaluator_slug": "my_custom_evaluator",
"log_id": null,
"dataset_id": null
}
Creates a new evaluation score.
string
UUID of evaluator created in Keywords AI platform
string
Custom string identifier for your evaluator
number
Optional numerical score value
string
Optional string score value
boolean
Optional boolean score value
import requests
url = "https://api.keywordsai.co/api/scores/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
"evaluator_slug": "my_custom_evaluator",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": True
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
{
"evaluator_slug": "my_custom_evaluator",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": true
}
{
"id": "eval_result_unique_id",
"created_at": "2024-01-15T10:30:00Z",
"type": "llm",
"environment": "test",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": true,
"is_passed": false,
"cost": 0.0,
"evaluator_id": null,
"evaluator_slug": "my_custom_evaluator",
"log_id": null,
"dataset_id": null
}
Was this page helpful?
⌘I
import requests
url = "https://api.keywordsai.co/api/scores/"
api_key = "YOUR_KEY" # Replace with your actual Keywords AI API key
data = {
"evaluator_slug": "my_custom_evaluator",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": True
}
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
{
"evaluator_slug": "my_custom_evaluator",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": true
}
{
"id": "eval_result_unique_id",
"created_at": "2024-01-15T10:30:00Z",
"type": "llm",
"environment": "test",
"numerical_value": 4.5,
"string_value": "Good response quality",
"boolean_value": true,
"is_passed": false,
"cost": 0.0,
"evaluator_id": null,
"evaluator_slug": "my_custom_evaluator",
"log_id": null,
"dataset_id": null
}