/ai-diagram-generator

A cool AI Diagram generator from a given topic, that streams the partial diagrams from the incomplete JSONs during generation. Built using LlamaIndex, Vercel AI SDK.

Primary LanguageTypeScript

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 👇 🔥🔥

AI Diagram Generator

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.

Getting Started

First clone the repo:

git clone https://github.com/rsrohan99/ai-diagram-generator.git
cd ai-diagram-generator

Start the Backend

cd into the backend directory

cd backend

First create .env from .env.example

cp .env.example .env

Set the OpenAI key in .env

OPENAI_API_KEY=****

Install the dependencies

poetry install

Start the backend server

poetry run python main.py

Start the Frontend

cd into the frontend directory

cd frontend

First create .env from .env.example

cp .env.example .env

Install the dependencies

npm i

Start the frontend server

npm run dev