Giter VIP home page Giter VIP logo

dnd-rag's Introduction

DnD RAG Chatbot - Mistral

Bu depo, Dungeons and Dragons (DnD) ile ilgili soruları yanıtlamak için Retrieval-Augmented Generation (RAG) ve Mistral dil modelini kullanan bir Streamlit tabanlı sohbet uygulamasının implementasyonunu içerir.

İçindekiler

Kurulum

Gereksinimler

Adımlar

  1. Depoyu klonlayın:

    git clone https://github.com/kullanici-adi/dnd-rag.git
    cd dnd-rag
  2. Sanal bir ortam oluşturun ve etkinleştirin:

    python -m venv venv
    source venv/bin/activate  # Windows için `venv\Scripts\activate` kullanın
  3. Gerekli paketleri yükleyin

  4. PDF belgelerinizi kodda belirtilen dizine indirin, örneğin C:\Users\ataka\OneDrive\Desktop\HomeREG\Dnd-RAG.

Kullanım

Streamlit uygulamasını başlatmak için:

streamlit run dnd-rag.py

İş Akışı

  1. Uygulama belirtilen dizinden PDF belgelerini yükler ve yönetilebilir parçalara böler.
  2. Bu parçalar Chroma vektör deposu ve Ollama gömmeleri kullanılarak gömülür ve saklanır.
  3. Bir kullanıcı sorgu gönderdiğinde, uygulama sorgunun birden çok varyasyonunu oluşturmak için Mistral dil modelini kullanır.
  4. Bu sorgu varyasyonları, vektör deposundan en ilgili belge parçalarını geri getirmeye yardımcı olur.
  5. Geri getirilen parçalar kullanıcının sorgusuna yanıt oluşturmak için kullanılır.

Detaylı Kod Açıklaması

pdf_loader()

Bu fonksiyon:

  1. Belirtilen dizinden PDF belgelerini yükler.
  2. Yüklenen belgeleri RecursiveCharacterTextSplitter kullanarak parçalara böler.
  3. Belge parçalarını gömer ve bunları bir Chroma vektör veritabanında saklar.

get_llm_response(form_input)

Bu fonksiyon:

  1. Mistral dil modelini başlatır.
  2. Sorgunun birden çok varyasyonunu oluşturmak için bir şablon tanımlar.
  3. Sorgu varyasyonlarına dayalı en ilgili belge parçalarını geri getirmek için bir MultiQueryRetriever kullanır.
  4. Bağlam ve sorguyu biçimlendirmek için bir zincir kullanır ve Mistral dil modelini kullanarak bir yanıt oluşturur.

Streamlit Uygulaması

  1. Bir başlık ve kullanıcı sorgusu için bir giriş alanı görüntüler.
  2. Gönderim üzerine, get_llm_response() fonksiyonunu çağırır ve yanıtı görüntüler.

dnd-rag's People

Contributors

akatakan 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.