Open History to see the last commit
1---
2id: boolean
3title: boolean
4---
5
6```ts
7function boolean(options):
8 | {
9 criteria?: undefined;
10 instructions: EvaluateJsonValue;
11 type: "noul";
12}
13 | {
14 criteria: {
15 false?: string;
16 true?: string;
17 };
18 instructions: EvaluateJsonValue;
19 type: "noul";
20};
21```
22
23Defined in: packages/ai/src/activities/evaluate/index.ts:423
24
25Build a yes/no question.
26
27`.value` is `true` when P(true) is 0.5 or more. There is no `.confidence`.
28On the wire, the type is TypeSafe `noul`.
29
30## Parameters
31
32### options
33
34#### criteria?
35
36\{
37 `false?`: `string`;
38 `true?`: `string`;
39\}
40
41Optional descriptions of yes and no.
42
43#### criteria.false?
44
45`string`
46
47#### criteria.true?
48
49`string`
50
51#### instructions
52
53`EvaluateJsonValue`
54
55The yes/no question to judge.
56
57## Returns
58
59 \| \{
60 `criteria?`: `undefined`;
61 `instructions`: `EvaluateJsonValue`;
62 `type`: `"noul"`;
63\}
64 \| \{
65 `criteria`: \{
66 `false?`: `string`;
67 `true?`: `string`;
68 \};
69 `instructions`: `EvaluateJsonValue`;
70 `type`: `"noul"`;
71\}
72
73## Example
74
75```ts
76const refund = boolean({
77 instructions: 'Is the customer asking for a refund?',
78})
79```