In this tutorial, we'll see how to use LlamaIndex Pydantic Program mode and partial object parsing to send intermediate pydantic objects from incomplete JSONs to the frontend for an intuitive user experience.
Full video tutorial under 2.5 minutes below 👇 🔥🔥
We use LlamaIndex Pydantic Program mode for structured output generation and we use partial object parsing to send intermediate objects that are validated using Pydantic models to the frontend.
Click the above thumbnail for the detailed video tutorial.
First clone the repo:
git clone https://github.com/rsrohan99/rag-stream-intermediate-events-tutorial.git
cd rag-stream-intermediate-events-tutorial
cd
into the backend
directory
cd backend
cp .env.example .env
OPENAI_API_KEY=****
poetry install
poetry run python main.py
cd
into the frontend
directory
cd frontend
cp .env.example .env
npm i
npm run dev