Coder Social home page Coder Social logo

rag-demo's Introduction

RAG demo

This respository contains example code for creating and evaluating a Retrieval Augmented Generation (RAG) pipeline with LangChain, Haystack, or LlamaIndex in combination with Hugging Face embedding and generator models.

Data

The example data consists of 440 long PDF documents and meta data from the 2020 open public consultation on the EU White Paper on Artificial Intelligence. It is essentially a compilation of 440 position papers on AI regulation in the EU from a wide range of stakeholders. (Source)

Example use-cases

  1. RAG pipeline with Haystack: The notebook rag_haystack_ai_law.ipynb contains a basic example for loading, preprocessing, and indexing the data. You can then use a generative LLM like Mixtral to ask questions about stakeholder's positions on AI regulation. For example, you can ask the PDFs: "What is Microsoft's position in AI regulation?" or "What are the most important points for civil society regarding AI regulation?" or "What are key risks and benefits of AI?".

  2. RAG evaluation with LangChain: The notebook rag_langchain_ai_law.ipynb contains an example for automatic RAG evaluation. It first automatically generates questions with an LLM, then passes these questions into a RAG pipeline and then evaluates RAG response quality with an LLM.

  3. RAG pipeline with LlamaIndex: The notebook rag_llamaindex_ai_law.ipynb contains an example for retrieving, reranking and generating with LlamaIndex, Hugging Face embeddings and Mixtral.

rag-demo's People

Contributors

moritzlaurer avatar

Stargazers

 avatar Lukas Kriesch 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.