Coder Social home page Coder Social logo

jadaliha / gen-ui-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bracesproul/gen-ui-python

0.0 0.0 0.0 1001 KB

๐Ÿงฌ๐Ÿ Generative UI web application built with LangChain Python, AI SDK & Next.js

Shell 0.75% JavaScript 0.14% Python 15.71% TypeScript 80.74% CSS 1.58% Makefile 1.09%

gen-ui-python's Introduction

Generative UI with LangChain Python ๐Ÿฆœ๐Ÿ”—

Generative UI with LangChain Python

Overview

This application aims to provide a template for building generative UI applications with LangChain Python. It comes pre-built with a few UI features which you can use to play about with gen ui. The UI components are built using Shadcn.

Getting Started

Installation

First, clone the repository and install dependencies:

git clone https://github.com/bracesproul/gen-ui-python.git

cd gen-ui-python

Install dependencies in the frontend and backend directories:

cd ./frontend

yarn install
cd ../backend

poetry install

Secrets

Next, if you plan on using the existing pre-built UI components, you'll need to set a few environment variables:

Copy the .env.example file to .env inside the backend directory.

LangSmith keys are optional, but highly recommended if you plan on developing this application further.

The OPENAI_API_KEY is required. Get your OpenAI API key from the OpenAI dashboard.

Sign up/in to LangSmith and get your API key.

Create a new GitHub PAT (Personal Access Token) with the repo scope.

Create a free Geocode account.

# ------------------LangSmith tracing------------------
LANGCHAIN_API_KEY=...
LANGCHAIN_CALLBACKS_BACKGROUND=true
LANGCHAIN_TRACING_V2=true
# -----------------------------------------------------

GITHUB_TOKEN=...
OPENAI_API_KEY=...
GEOCODE_API_KEY=...

Running the Application

cd ./frontend

yarn dev

This will start a development server on http://localhost:3000.

Then, in a new terminal window:

cd ../backend

poetry run start

Go further

If you're interested in ways to take this demo application further, I'd consider the following:

  • Generating entire React components to be rendered, instead of relying on pre-built components.
  • Using the LLM to build custom components using a UI library like Shadcn.
  • Multi-tool and component usage.
  • Update the LangGraph agent to call multiple tools, and appending multiple different UI components to the client rendered UI.
  • Generative UI outside of the chatbot window: Have the UI dynamically render in different areas on the screen. E.g a dashboard, where the components are dynamically rendered based on the LLMs output.

gen-ui-python's People

Contributors

bracesproul avatar lakshyaag avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.