Giter Site home page Giter Site logo

c_rag's Introduction

Code Wizard: LangChain Documentation AI Chatbot

Code Wizard is a super cool AI chatbot that helps you learn and use the LangChain Documentation in an interactive way. Just ask it anything about LangChain concepts or code, and it'll break it down for you in an easy-to-understand way. Built with Next.js, FastAPI, LangChain, LangGraph, LCEL, and ChatOpenAI which can be easily switched a local LLaMA model.

Link to project: https://code-wizard-frontend.vercel.app/

Frontend Repo: https://github.com/RutamBhagat/code_wizard_frontend

Backend Repo: https://github.com/RutamBhagat/Code-Wizard-LangGraph-C_RAG

Code.Wizard.Walkthrough.ELlHz7vGVGQ.mp4

How It's Made

Tech used: LangChain, LangGraph, LCEL, LLaMA, Next.js, Typescript, FastAPI

Code Wizard is a full-stack app that combines some cutting edge tech. The front-end is built with Next.js and React, which makes it fast and snappy. The back-end uses FastAPI to host the LangChain and LangGraph pipelines and APIs.

The core is powered by LangChain, which lets us build cool applications with large language models like ChatOpenAI. Code Wizard takes the LangChain documentation, chunks it up, and stores it in a vector database using embeddings.

When you ask Code Wizard a question, it uses a LangGraph DAG to search the vector database for relevant doc chunks. It then generates a response by combining those chunks with the ChatOpenAI.

The front-end has a slick chat interface built with React, so you can have natural conversations with the AI. It also renders Markdown and code snippets nicely.

Optimizations

To make Code Wizard performant and scalable, it uses some cool optimizations:

  1. Caching: Frequently asked questions and their responses are cached to improve latency.
  2. Streaming Response: The LangChain pipelines to stream the response to the user.
  3. Model Optimization: Switching the model to a better but more expensive model like gpt-4o.

Lessons Learned

Building Code Wizard was an incredible learning experience that taught me so much about LangChain, LangGraph, LCEL, large language models, and modern web development. Some key lessons:

  • How to effectively integrate LangChain components like agents, memory, chat history, agent state, nodes, chains, and vector stores.
  • Optimizing LLM performance through techniques like quantization and CPU offloading.
  • Designing intuitive conversational UIs that feel natural and engaging.
  • Leveraging the latest web frameworks like Next.js and FastAPI for building scalable apps.

Examples

Check out these example conversations with Code Wizard:

What is Langchain: Screenshot 2024-04-27 095418

Explaining LangChain Expression Language: Screenshot 2024-04-27 095430

c_rag's People

Contributors

rutambhagat avatar

Stargazers

Vamshi Krishna S avatar  avatar

Watchers

 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.