/langchain-1

Stream OpenAI Chat responses with Langchain and Nextjs

Primary LanguageTypeScript

OpenAI Chat Stream with Langchain and Nextjs

Example code for an app that makes use of Langchains OpenAIChat. The stream is managed by a CallbackManager. And the prompt is a basic HumanChatMessage.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

Check out our Next.js deployment documentation for more details.