Giter Club home page Giter Club logo

swiss-legal-conversational-ui's Introduction

AI Swiss Legal Assistant ๐Ÿ‡จ๐Ÿ‡ญ ๐Ÿ‘ฉโ€โš–๏ธ ๐Ÿค–

This is a simple conversational-ui RAG (retrieval augmented generation) based on the Swiss Code of Obligations.

It was created a starting point of the Ginetta Challenge at the women++ Hack'n'Lead hackathon November 2023

โ„น๏ธ Instructions

  1. Use this repository as a template (or Fork it)
  2. Add your team members as contributors
  3. Put your presentation in the docs/ folder
  4. This repository must be open source (and licensed) in order to submit
  5. Add the tag hack-n-lead to the repo description

โ–ถ๏ธ Setup

There is two different ways to setup this project:

  1. Install Ollama & Qdrant locally (Ollama desktop app is currently is only available for Mac and Linux) - Ollama will take advantage of your GPU to run the model
  2. Use the Docker Compose file to run Ollama & Qdrant in containers (just run in a terminal in the project directory) - easier setup, but Ollama will run on CPU

Option 1: ๐Ÿณ Run Docker Compose

  1. docker compose up -d to pull & run the containers
  2. docker compose exec ollama ollama run mistral to download & install the mistral model

Option 2: ๐Ÿ–๐Ÿผ Manual installation

  1. ๐Ÿฆ™ Download Ollama and install it locally
  2. ollama run mistral to download and install the model locally (Requires 4.1GB and 8GB of RAM)
  3. Open http://localhost:11434 to check if Ollama is running
  4. docker pull qdrant/qdrant
  5. docker run --name qdrant -p 6333:6333 -v ${PWD}/snapshots:/snapshots qdrant/qdrant

Both Option 1 and 2 continue with the following setup:

๐Ÿ’พ Setup Qdrant Vector Database

  1. Open the Qdrant dashboard console http://localhost:6333/dashboard#/console
  2. Create a new collection running this:
    PUT collections/swiss-or
    {
      "vectors": {
        "size": 384,
        "distance": "Cosine"
      }
    }
    
  3. Download the snapshot file
  4. Unzip the file using the terminal (โš ๏ธ not with Finder on Mac โš ๏ธ) with unzip <file_name>
  5. Upload the file using the following command. Adapt the fields accordingly and run it from the same directory, as where your snapshot lies
curl -X POST 'http://localhost:6333/collections/swiss-or/snapshots/upload' \
    -H 'Content-Type:multipart/form-data' \
    -F 'snapshot=@swiss-code-of-obligations-articles-gte-small-2023-10-18-12-13-25.snapshot'

๐Ÿ‘ฉ๐Ÿฝโ€๐Ÿ’ป Run the App

  1. Copy the file .env.local.example in the project and rename it to .env. Verify if all environment variables are correct
  2. yarn install to install the required dependencies
  3. yarn dev to launch the development server
  4. Go to http://localhost:3000 and try out the app

๐Ÿ‘ฉ๐Ÿฝโ€๐Ÿซ Learn More

To learn more about LangChain, OpenAI, Next.js, and the Vercel AI SDK take a look at the following resources:

swiss-legal-conversational-ui's People

Contributors

mountainash avatar maricabertarini avatar brunnolou 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.