(values: PromptValue[])
| 429 | * to blocks and concatenated. |
| 430 | */ |
| 431 | export function joinPromptValues(values: PromptValue[]): PromptValue { |
| 432 | if (values.length === 1) return values[0]! |
| 433 | if (values.every(v => typeof v === 'string')) { |
| 434 | return values.join('\n') |
| 435 | } |
| 436 | return values.flatMap(toBlocks) |
| 437 | } |
| 438 | |
| 439 | /** |
| 440 | * Whether `next` can be batched into the same ask() call as `head`. Only |