> ## Documentation Index
> Fetch the complete documentation index at: https://docs.keywordsai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a log score

Creates a new evaluation score for a specific log. This ensures that only one score exists per evaluator per log.

<ParamField body="evaluator_id" type="string">
  UUID of evaluator created in Keywords AI. Either this or `evaluator_slug` must be provided.
</ParamField>

<ParamField body="evaluator_slug" type="string">
  Custom string identifier for your evaluator. Either this or `evaluator_id` must be provided.
</ParamField>

<ParamField body="numerical_value" type="number">
  Optional numerical score value.
</ParamField>

<ParamField body="string_value" type="string">
  Optional string score value.
</ParamField>

<ParamField body="boolean_value" type="boolean">
  Optional boolean score value.
</ParamField>

<ParamField body="categorical_value" type="array">
  Optional categorical score value (array of strings). Use when evaluator's `score_value_type` is `categorical`.
</ParamField>

<RequestExample>
  ```Python Python theme={"system"}
  import requests

  url = "https://api.keywordsai.co/api/logs/{log_id}/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())
  ```

  ```json Request theme={"system"}
  {
    "evaluator_slug": "my_custom_evaluator",
    "numerical_value": 4.5,
    "string_value": "Good response quality",
    "boolean_value": true
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={"system"}
  {
    "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 theme={"system"}
  {
    "error": "A score already exists for this evaluator in this log."
  }
  ```
</ResponseExample>
