Giter Site home page Giter Site logo

easy-rag's Introduction

easy-rag

一个简单的RAG项目,核心代码在app文件夹中

各个模块介绍

retriever.py

Retriever这个类的核心功能可以抽象为一个模型:一个字符串列表corpus,一个字符串query,返回corpus中与query最相关的k个元素。

检索方式

bm25

实现方式:

    def bm25_retrieval(self, query, n=10):

        # 此处中文使用jieba分词
        query = jieba.lcut(query)  # 分词
        res = self.bm25.get_top_n(query, self.corpus, n=n)
        return res

原理

TODO

emb_retrieval

    def emb_retrieval(self, query, k=10):

        search_docs = self.db.similarity_search(query, k=k)
        res = [doc.page_content for doc in search_docs]
        return res

easy-rag's People

Contributors

morandave avatar

Stargazers

 avatar

Watchers

 avatar

easy-rag's Issues

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.