Smooth streaming japanese text
You can smooth stream japanese text by using the smoothStream
function with streamText
, and the following regex that splits either on words of japanese characters:
page.tsx
import { smoothStream, streamText } from 'ai';
const result = streamText({ model: yourModel, prompt: 'Your prompt here', experimental_transform: smoothStream({ chunking: /[\u3040-\u309F\u30A0-\u30FF]|\S+\s+/, }),});