(input: RawInput)
| 1484 | * @category Constructors |
| 1485 | */ |
| 1486 | export const make = (input: RawInput): Prompt => { |
| 1487 | if (Predicate.isString(input)) { |
| 1488 | const part = makePart("text", { text: input }) |
| 1489 | const message = makeMessage("user", { content: [part] }) |
| 1490 | return makePrompt([message]) |
| 1491 | } |
| 1492 | |
| 1493 | if (Predicate.isIterable(input)) { |
| 1494 | return makePrompt(decodeMessagesSync(Arr.fromIterable(input), { |
| 1495 | errors: "all" |
| 1496 | })) |
| 1497 | } |
| 1498 | |
| 1499 | return input |
| 1500 | } |
| 1501 | |
| 1502 | /** |
| 1503 | * Creates a Prompt from an array of messages. |
no test coverage detected