Skip to content

Update span assessment

client.spanAssessments.update(stringspanAssessmentID, SpanAssessmentUpdateParams { approval, assessment_type, comment, 4 more } body, RequestOptionsoptions?): SpanAssessment { assessment_id, assessment_type, created_by, 12 more }
PATCH/v5/span-assessments/{span_assessment_id}

Update the content of an existing span assessment.

Only the assessment’s original creator, or an account admin or manager, may update it; a request from any other identity returns 403. Supplied fields overwrite the stored values and the merged result is re-validated against the assessment’s type, so the content must stay consistent with assessment_type (the matching content field present and no conflicting fields set) or the call returns 422. The span and trace an assessment is attached to cannot be changed through this endpoint. Returns 404 if no assessment with that id exists for the caller’s account.

ParametersExpand Collapse
spanAssessmentID: string
body: SpanAssessmentUpdateParams { approval, assessment_type, comment, 4 more }
approval?: ApprovalStatus

Approval status (approved/rejected)

One of the following:
"approved"
"rejected"
assessment_type?: AssessmentType

Type of assessment

One of the following:
"comment"
"rating"
"approval"
"rubric"
"metadata"
"overwrite"
comment?: string

Raw text feedback

metadata?: Record<string, unknown>

Arbitrary JSON object for additional data

overwrite?: Record<string, unknown>

User corrections to span output

rating?: number

Numerical rating (1-5)

maximum5
minimum1
rubric?: Record<string, string>

Rule key-value pairs for rubric evaluation

ReturnsExpand Collapse
SpanAssessment { assessment_id, assessment_type, created_by, 12 more }

Response model for span assessment

assessment_id: string

Unique identifier for the assessment

assessment_type: AssessmentType

Type of assessment

One of the following:
"comment"
"rating"
"approval"
"rubric"
"metadata"
"overwrite"
created_by: string

User who submitted the assessment

span_id: string

The span this assessment is attached to

trace_id: string

The trace this assessment is attached to

account_id?: string

Account this assessment belongs to

approval?: ApprovalStatus

Approval status (approved/rejected)

One of the following:
"approved"
"rejected"
comment?: string

Raw text feedback

created_at?: string

When this assessment was created

formatdate-time
metadata?: Record<string, unknown>

Arbitrary JSON object for additional data

object?: "span.assessment"
overwrite?: Record<string, unknown>

User corrections to span output

rating?: number

Numerical rating (1-5)

maximum5
minimum1
rubric?: Record<string, string>

Rule key-value pairs for rubric evaluation

updated_at?: string

When this assessment was last updated

formatdate-time

Update span assessment

import SGPClient from 'scale-gp';

const client = new SGPClient({
  accountID: 'My Account ID',
  apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});

const spanAssessment = await client.spanAssessments.update('span_assessment_id');

console.log(spanAssessment.assessment_id);
{
  "assessment_id": "assessment_id",
  "assessment_type": "comment",
  "created_by": "created_by",
  "span_id": "span_id",
  "trace_id": "trace_id",
  "account_id": "account_id",
  "approval": "approved",
  "comment": "comment",
  "created_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "object": "span.assessment",
  "overwrite": {
    "foo": "bar"
  },
  "rating": 1,
  "rubric": {
    "foo": "string"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}
Returns Examples
{
  "assessment_id": "assessment_id",
  "assessment_type": "comment",
  "created_by": "created_by",
  "span_id": "span_id",
  "trace_id": "trace_id",
  "account_id": "account_id",
  "approval": "approved",
  "comment": "comment",
  "created_at": "2019-12-27T18:11:19.117Z",
  "metadata": {
    "foo": "bar"
  },
  "object": "span.assessment",
  "overwrite": {
    "foo": "bar"
  },
  "rating": 1,
  "rubric": {
    "foo": "string"
  },
  "updated_at": "2019-12-27T18:11:19.117Z"
}