Skip to content

Get Evaluation Data Schema

evaluations.retrieve_schema(strevaluation_id, EvaluationRetrieveSchemaParams**kwargs) -> EvaluationSchemaResponse
GET/v5/evaluations/{evaluation_id}/schema

Describe the data schema of an evaluation’s items.

Inspects the item data and task-result fields and returns each discovered field with its flattened key path, JSON type, source, and the number of items containing it, ordered alphabetically by field name. For large evaluations the schema may be inferred from a sample of items, in which case is_sampled is set and sample_size reports how many were analyzed. Set include_archived to include archived items in the analysis.

ParametersExpand Collapse
evaluation_id: str
include_archived: Optional[bool]

Include archived items in schema analysis

ReturnsExpand Collapse
class EvaluationSchemaResponse: …

Schema information for an evaluation’s item data structure

evaluation_id: str

The ID of the evaluation

fields: List[Field]

List of all discovered fields, ordered alphabetically by field_name

data_type: str

JSON type: ‘string’, ‘number’, ‘boolean’, ‘object’, ‘array’, or ‘null’

field_name: str

The flattened JSON key path (e.g., ‘metadata.category’)

item_count: int

Number of evaluation items containing this field

minimum0
source: Literal["data", "task_result_cache"]

The source of the field: ‘data’ or ‘task_result_cache’

One of the following:
"data"
"task_result_cache"
object: Optional[Literal["field_schema"]]
total_items: int

Total number of evaluation items

minimum0
is_sampled: Optional[bool]

Whether schema was computed from a sample of items (for large evaluations)

object: Optional[Literal["evaluation_schema"]]
sample_size: Optional[int]

Number of items sampled for schema inference, if applicable

minimum0

Get Evaluation Data Schema

import os
from scale_gp_beta import SGPClient

client = SGPClient(
    api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
)
evaluation_schema_response = client.evaluations.retrieve_schema(
    evaluation_id="evaluation_id",
)
print(evaluation_schema_response.evaluation_id)
{
  "evaluation_id": "evaluation_id",
  "fields": [
    {
      "data_type": "data_type",
      "field_name": "field_name",
      "item_count": 0,
      "source": "data",
      "object": "field_schema"
    }
  ],
  "total_items": 0,
  "is_sampled": true,
  "object": "evaluation_schema",
  "sample_size": 0
}
Returns Examples
{
  "evaluation_id": "evaluation_id",
  "fields": [
    {
      "data_type": "data_type",
      "field_name": "field_name",
      "item_count": 0,
      "source": "data",
      "object": "field_schema"
    }
  ],
  "total_items": 0,
  "is_sampled": true,
  "object": "evaluation_schema",
  "sample_size": 0
}