Create a span score

Creates a new evaluation score for a specific log. This ensures that only one score exists per evaluator per log. - `evaluator_id` *string*: UUID of evaluator created in Respan. Either this or `evaluator_slug` must be provided. - `evaluator_slug` *string*: Custom string identifier for your evaluator. Either this or `evaluator_id` must be provided. - `numerical_value` *number*: Optional numerical score value. - `string_value` *string*: Optional string score value. - `boolean_value` *boolean*: Optional boolean score value. - `categorical_value` *array*: Optional categorical score value (array of strings). Use when evaluator's `score_value_type` is `categorical`. ```Python Python url = "https://api.respan.ai/api/logs/{log_id}/scores/" api_key = "YOUR_KEY" # Replace with your actual Respan 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()) ``` ```json Request { "evaluator_slug": "my_custom_evaluator", "numerical_value": 4.5, "string_value": "Good response quality", "boolean_value": true } ``` ```json 201 Created { "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 } ``` ```json 409 Conflict { "error": "A score already exists for this evaluator in this log." } ```

Authentication

AuthorizationBearer
API key authentication. Get your API key from https://platform.respan.ai/platform/api-keys

Path parameters

log_idstringRequired
Log Id

Request

This endpoint expects an object.
evaluator_idstringOptional

UUID of evaluator created in Respan. Either this or evaluator_slug must be provided.

evaluator_slugstringOptional

Custom string identifier for your evaluator. Either this or evaluator_id must be provided.

numerical_valuedoubleOptional
Optional numerical score value.
string_valuestringOptional
Optional string score value.
boolean_valuebooleanOptional
Optional boolean score value.
categorical_valuelist of stringsOptional

Optional categorical score value (array of strings). Use when evaluator’s score_value_type is categorical.

Response

Successful response for Create a span score

Errors

401
Unauthorized Error