TypeSafeSDK.Answer.Choice (TypeSafeSDK v0.2.0)

Copy Markdown View Source

Read a Choice distribution without imposing routing policy.

Summary

Functions

Difference between the top two probabilities (0 for an empty distribution).

Descending probabilities; ties follow caller order, then deterministic key order.

Functions

margin(answer)

@spec margin(TypeSafeSDK.ChoiceAnswer.t()) :: number()

Difference between the top two probabilities (0 for an empty distribution).

ranked(choice_answer)

@spec ranked(TypeSafeSDK.ChoiceAnswer.t()) :: [{atom() | String.t(), number()}]

Descending probabilities; ties follow caller order, then deterministic key order.