tbergman / 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.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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.


Languages

Language:Python 46.8%Language:TypeScript 36.5%Language:CSS 12.0%Language:JavaScript 4.7%