Behaviors

Override a behavior verdict

Changed on

Records whether a behavior happened on a span, replacing the model's score (Happened / Not happened in the app). The span must already have a verdict for the behavior. Span-level reads use it at once; rollup counts pick it up within 10 minutes for spans from the last 48 hours.

patch/api/request-logs/{unique_id}/behaviors/{behavior_key}/

Request

  • Base URL
    https://api.respan.ai
  • URL
    https://api.respan.ai/api/request-logs/{unique_id}/behaviors/{behavior_key}/
  • Auth
    HTTP bearer

Path parameters

unique_idstring required

Span ID.

behavior_keystring required

Behavior key: a built-in behavior's name (for example refusal) or a custom behavior's id.

Request body

probnumber required

The score to record in place of the model's. Send 1 for Happened and 0 for Not happened. The behavior fires when this is 0.65 or higher.

Example request

{
  "prob": 1
}

Response

The span's new verdict.

label0 | 1 required

1 when the behavior fired (prob is 0.65 or higher), else 0.

probnumber required

The score now on the span.

sourcestring required

human after an override.

state'detected' | 'uncertain' | 'not_detected' required

detected at 0.65 or higher, uncertain from 0.35 up to 0.65, else not_detected.

polarity'negative' | 'positive' | 'neutral' required

Whether the behavior firing is good or bad: negative (an Issue), positive (a Win) or neutral (Info). Display metadata only; it does not change how spans are scored.

Example response

{
  "label": 1,
  "prob": 1,
  "source": "human",
  "state": "detected",
  "polarity": "negative"
}

Changes

    • breaking

      request body became required

    • breaking

      the response property became nullable for the status

    • breaking

      the response's property type changed from string to integer for status

    • breaking

      the response's property format changed from double to no format for status

    • warning

      added the new 0.00 enum value to the response property for the response status

    • warning

      added the new 1.00 enum value to the response property for the response status

    • info

      api operation id behaviors_overrideSpanBehavior removed and replaced with overrideSpanBehavior

    • info

      api tag Behaviors added

    • info

      api tag behaviors removed

    • info

      the request property format was generalized from double to no format

    • info

      added to the response property allOf list for the response status

    • info

      removed the 0 enum value from the response property for the response status

    • info

      removed the 1 enum value from the response property for the response status

    • info

      removed subschema #2 from the response property oneOf list for the response status

    • info

      endpoint added