diff --git a/packages/ai/README.md b/packages/ai/README.md index eba5dfa8725..385414a0e21 100644 --- a/packages/ai/README.md +++ b/packages/ai/README.md @@ -287,7 +287,8 @@ if (department.type === "choice") department.choice // "billing" | "technical" ``` `input` is a JSON object or an ordered list of `text`, `json` and `media` parts. Questions are keyed by name, and -answers come back under the same names; key order is the order sent to the host. +answers come back under the same names. Key order is the order sent to the host; as in any JavaScript object, +integer-like names such as `"1"` come first. A question the host declines is `{ type: "error", reason, message? }`, with `reason` such as `"refusal"`; the other answers still come back. `response.usage` has `inputTokens`, `outputTokens`, `totalTokens` and the host's reported `cost` when it sends one; diff --git a/packages/ai/src/decision.ts b/packages/ai/src/decision.ts index 6651b6551b6..05766f6440d 100644 --- a/packages/ai/src/decision.ts +++ b/packages/ai/src/decision.ts @@ -63,7 +63,7 @@ export const DecisionQuestion = Schema.Union([PredicateQuestion, ChoiceQuestion, Schema.toTaggedUnion("type"), ) export type DecisionQuestion = Schema.Schema.Type -/** Questions keyed by name; key order is the order sent to the host. */ +/** Questions keyed by name; key order is the order sent to the host, with integer-like names such as `"1"` first. */ export type DecisionQuestions = Readonly> // Only what makes a request meaningless is checked here; counts and sizes are the host's to enforce.