Skip to main content

Markdown Streaming

In this example, we show how the user can write a prompt that results in a stream of markdown content.
The formatted markdown is streamed and displayed to the user as it is being generated by the LLM.

import {useMemo} from 'react';
import {AiChat} from '@nlux/react';
import '@nlux/themes/nova.css';
import {streamAdapter} from './adapter';

export default () => {
  const adapter = useMemo(() => streamAdapter, []);
  return (
    <AiChat
      adapter={adapter}
      layoutOptions={{
        height: 360,
        maxWidth: 600
      }}
    />
  );
};