ai 4.0.25 → 4.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -5311,6 +5311,7 @@ var DefaultStreamTextResult = class {
5311
5311
  // core/generate-text/smooth-stream.ts
5312
5312
  function smoothStream({
5313
5313
  delayInMs = 10,
5314
+ chunking = "word",
5314
5315
  _internal: { delay: delay2 = delay } = {}
5315
5316
  } = {}) {
5316
5317
  let buffer = "";
@@ -5329,7 +5330,7 @@ function smoothStream({
5329
5330
  return;
5330
5331
  }
5331
5332
  buffer += chunk.textDelta;
5332
- const regexp = /\s*\S+\s+/m;
5333
+ const regexp = chunking === "line" ? /[^\n]*\n/m : /\s*\S+\s+/m;
5333
5334
  while (regexp.test(buffer)) {
5334
5335
  const chunk2 = buffer.match(regexp)[0];
5335
5336
  controller.enqueue({ type: "text-delta", textDelta: chunk2 });