Skip to content

cvega21/chat-with-your-code

Repository files navigation

Chat With Your Code

Chat with your Github repositories, built with LangChain, Supabase, Next.js and Github's API. Uses gpt-3.5-turbo-0125 by default.

Feb-26-202405-57-49-ezgif com-video-to-gif-converter

How It Works

  1. Log in with Github to get provider token
  2. Use provider token to get all public repo metadata
  3. Load repo into Supabase
    • Split code into chunks, embed file contents and store with associated metadata in Supabase (pgvector)
  4. Begin chat session with repo
    • Load message history from existing chat session or create new one
  5. User asks a question
    • Create vector store from existing index (repo was embedded beforehand)
  6. Build runnable sequence with langchain
    • Load chat history
    • Clean up original prompt through OpenAI (ie. makes the question more clear)
    • Load context by embedding prompt and running cosine similarity search
    • Run full chain and return stream
    • Callback after chain end stores AI response in chat history DB table

NOTE: This repo is a proof of concept. Security features such as proper auth, RLS, and safe API key handling are not implemented. Don't deploy to production unless you like chaos.

Tech Stack

cvega21/chat-with-your-code is built on the following main stack:

About

Chat with your Github repositories using AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published