Creates one or more fields in a project. Fields are field definitions that can be used
in logs. This endpoint allows pre-defining fields before adding any log data.
Each field can have an optional description. If a field already exists, its description
will be updated.
Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Body
Name of the project the fields belong to.
Optional context path for the fields.
Dictionary mapping field names to their type definitions.
Whether to backfill existing logs in the context with None values for the new fields. When True, all existing logs will get the new fields with None values, ensuring all rows can participate in derived equations without errors.
curl --request POST \
--url 'https://api.unify.ai/v0/logs/fields' \
--header "Authorization: Bearer $UNIFY_KEY" \
--header 'Content-Type: application/json' \
--data '{
"project": "eval-project",
"context": "experiment1/trial1",
"fields": {
"comment": {
"description": "User comment",
"mutable": true,
"type": "str"
},
"email": {
"description": "User email address",
"type": "str",
"unique": true
},
"score": "int"
},
"backfill_logs": true
}'
{
"info": "Fields created successfully."
}