Code Monkey home page Code Monkey logo

wikipedia-chat's Introduction

๐Ÿ“š wikichat

๐ŸŒŸ Overview

wikichat ingests Cohere's multilingual Wikipedia embeddings into a Chroma vector database and provides a Chainlit web interface for retrieval-augmented-generation against the data using gpt-4-1106-preview.

I wanted to explore the idea of maintaining a local copy of Wikipedia, and this seemed like a good entry point. Down the road I might update this code to regularly pull the full Wikipedia dump and create the embeddings, instead of relying on Cohere's prebuilt embeddings. I went this route as a proof of concept, and as an excuse to try out Chainlit.

Based on Wikipedia_Semantic_Search_With_Cohere_Embeddings_Archives.ipynb

๐Ÿ›  Installation

  1. Clone the Repository:

    git clone https://github.com/deadbits/wikipedia-chat.git
    cd wikipedia-chat
  2. Setup Python virtual environment:

    python3 -m venv venv
    source venv/bin/activate
  3. Install Dependencies:

    pip install -r requirements.txt

๐Ÿ“– Usage

Set Cohere and OpenAI API keys

export OPENAI_API_KEY="...."
export COHERE_API_KEY="..."

Ingest Data

Run ingest.py to download the Wikipedia embeddings dataset and load into ChromaDB:

python ingest.py

The script adds records in batches of 100, but this will still take some time. The batch size could probably be increased.

Web Interface

To initiate the web interface, run the chainlit_ui.py script with the Chainlit library:

chainlit run chainlit_ui.py

Chainlit interface

Chainlit UI

wikipedia-chat's People

Contributors

deadbits avatar

Stargazers

 avatar  avatar

Watchers

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