Skip to content

NguyenVietAn1824/KDN_langchain_chatbot_2024

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build a RAG application using Langchain with advanced skills

Introduction

This project implements the Retrieval-Augmented Generation (RAG) model using Langchain. The goal of this application is to provide an application that improves the retrieval performance of a dataset of law questions, contributing to providing answers quickly and efficiently. In this project, I have used some advanced techniques such as semantic router to analyze the semantics of questions, adding historical reflection to improve the flow of user conversations, and combining retrieval techniques to improve retrieval efficiency. The LLM model used in this project is google-gemma2b to perform answer generation.

Features

  • Langchain: A framework that simplifies working with language models and integrates multiple components like retrieval and generation.
  • Retrieval-Augmented Generation (RAG): A machine learning technique that enhances text generation by retrieving relevant information from an external knowledge base.
  • Semantic router : With Semantic Router, I use a set of available samples, representing the topic of the rule, from which I calculate the similarity of the question with this data set, and from there make a decision about the question type, reduce the need to include distracting questions in the LLM.
  • History reflection : Improving query answering.
  • Streamlit framework : A Framework for building interfaces.
  • Google-gemma2b : Model to perform answer generation.

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/project-name.git
    
  2. Install dependencies:
    pip install -r requirements.txt
    
  3. Run Project
    streamlit run app.py
    

PipeLine

Description of Image
  • User Query: Input is the user's question.

  • Chat History: Summarizes the previous history of the conversation and adds it to the current question.

  • Semantic Router: Provides semantic orientation for user questions.

  • RAGs System: Uses semantic and keyword retrieval to increase searchability.

  • LLM: Uses gemma:2b to generate the final answer.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages