RAG_Hack icon indicating copy to clipboard operation
RAG_Hack copied to clipboard

Discord Bot with Langchain API

Open bookpanda opened this issue 1 year ago • 2 comments

Project Name

RAG-Bot

Description

Making a bot that can leverage documents with RAG to generate relevant responses.

Design

image

Discord Bot

  • /add-text: Adds text to the vector database knowledge base.
  • /add-web: Adds web page (you input the url, the API will load data from that page) to the vector database knowledge base.
  • /toggle-web-search: Toggles whether the bot should search the web for data when it can't find any in the vector database.
  • /add-borrow-money: Adds debt [Borrower, Lender, Amount] to the vector database knowledge base.
  • /add-split-bill: Split bill [Payer, Participants, Amount] into multiple debt [Borrower, Lender, Amount] to the vector database knowledge base.
  • /ask-debt-summary: Ask debt summary of a person.

Note: the requests the bot makes to the API have guild IDs in the url params in order to keep track of the loaded documents for each guild separately.

FastAPI

acts as an interface between the Discord bot and the Langchain ReAct Agent

LangChain ReAct Agent

To be precise, ReAct Agents are from LangGraph library, which is a part of LangChain. ReAct Agents find answers to queries using the tools we provided: Docs retriever tool and Tavily search tool.

  • Docs retriever tool: This tool retrieves documents from the vector database that are relevant to the query.
  • Tavily search tool: This tool searches the internet for relevant data when the Docs retriever tool can't find any relevant data in the vector database.

Stack

  • langchain
  • fastapi

Technology & Languages

  • [X] JavaScript
  • [ ] Java
  • [ ] .NET
  • [X] Python
  • [ ] AI Studio
  • [ ] AI Search
  • [ ] PostgreSQL
  • [ ] Cosmos DB
  • [ ] Azure SQL

Project Repository URL

https://github.com/seg-org/rag-api

Deployed Endpoint URL

https://discord.com/oauth2/authorize?client_id=1279707597397823538&permissions=2048&integration_type=0&scope=bot+applications.commands

Project Video

https://www.youtube.com/watch?v=FVFXi_xhey0

Team Members

bookpanda,Nacnano,Aphrodicez

bookpanda avatar Sep 16 '24 18:09 bookpanda

Hello @bookpanda, thank you for participating in RAG Hack!

The team is working hard to distribute badges. Please have each team member fill out this form: aka.ms/raghack/badge-dist

Thank you!

multispark avatar Oct 23 '24 01:10 multispark

Hi @multispark , I've informed my team. Thanks!

bookpanda avatar Oct 23 '24 03:10 bookpanda