Evaluate an unsaved custom moment
Runs a custom moment that is not saved over up to 1,000 turns, as it would run live: in the same classifier calls as the built-in kinds and the organization's live custom moments. Returns where it fired and, when expected labels the turns it should fire on, hits, misses, false fires, precision and a suggestion. Also returns the threshold a turn needed and up to 3 near misses: the turns that scored highest without firing, each with its score and why it did not fire. Gives up after 90 seconds. An organization starts at most 10 evaluations a minute.
Authorization
apiKey API key (prefix spk_test_ or spk_live_) or personal access token (prefix pat_)
In: header
Header Parameters
Idempotency key that prevents processing a request twice. Use a unique UUID v4 per request.
length <= 255Request Body
application/json
A conversation whose stored final turns to read, up to 1,000. Send this or turns.
The custom moment to evaluate, as it would be created
Your ids of the turns it should fire on; every other turn should not. Absent leaves the label fields of the result null.
Up to 1,000 turns under the turn contract; only final ones are read. Send these or conversation_id.
items <= 1000Response Body
application/json
application/json
curl -X POST "https://example.com/moments/evaluate" \ -H "Idempotency-Key: string" \ -H "Content-Type: application/json" \ -d '{ "definition": { "name": "pricing_objection", "when": "The customer pushes back on price, asks for a discount, or compares us to a cheaper option." } }'{ "expected": 0, "false": [ { "text": "string", "turn": "t_12" } ], "false_fires": 0, "fires": [ { "at": 0.1, "confidence": 0.1, "text": "string", "turn": "t_88" } ], "hits": 0, "misses": [ { "text": "string", "turn": "t_12" } ], "near_misses": [ { "reason": "below_threshold", "score": 0.1, "threshold": 0.1, "turn_id": "t_12" } ], "precision": 0, "stats": { "fires": 0, "ms": 0, "turns": 0 }, "suggestion": "string", "threshold": 0.1}