Giter Club home page Giter Club logo

devflowinc / trieve Goto Github PK

View Code? Open in Web Editor NEW
632.0 5.0 68.0 12.5 MB

All-in-one infrastructure for building search, recommendations, and RAG. Trieve combines search language models with tools for tuning ranking and relevance.

Home Page: https://dashboard.trieve.ai

License: Other

PLpgSQL 2.65% Rust 58.94% Dockerfile 0.16% JavaScript 0.76% Shell 0.25% TypeScript 35.90% CSS 0.23% Python 0.58% Batchfile 0.14% HTML 0.38%
actix-web diesel postgresql qdrant qdrant-vector-database rust search search-engine embedding llm

trieve's Introduction

Trieve Logo

Sign Up (1k chunks free) | Documentation | Meeting Link | +1 628-222-4090 | Community Matrix

Github stars GitHub issues Join Discord Join Matrix

Trieve is an Advanced Relevance API for hybrid search, recommendations, and RAG

Trieve OG tag

Quick Links

Features

  • ๐Ÿ”’ Self-Hosting in your VPC or on-prem: Buy a license to host in your company's VPC on prem with our ready-to-go docker containers and terraform templates.
  • ๐Ÿง  Semantic Dense Vector Search: Integrates with OpenAI or Jina embedding models and Qdrant to provide semantic vector search.
  • ๐Ÿ” Typo Tolerant Full-Text/Neural Search: Every uploaded chunk is vector'ized with naver/efficient-splade-VI-BT-large-query for typo tolerant, quality neural sparse-vector search.
  • ๐Ÿ–Š๏ธ Sub-Sentence Highlighting: Highlight the matching words or sentences within a chunk and bold them on search to enhance UX for your users. Shout out to the simsearch crate!
  • ๐ŸŒŸ Recommendations: Find similar chunks (or files if using grouping) with the recommendation API. Very helpful if you have a platform where users favorite, bookmark, or upvote content.
  • ๐Ÿค– Convenient RAG API Routes: We integrate with OpenRouter to provide you with access to any LLM you would like for RAG. Try our routes for fully-managed RAG with topic-based memory management or select your own context RAG.
  • ๐Ÿ’ผ Bring Your Own Models: If you'd like, you can bring your own text-embedding, SPLADE, cross-encoder re-ranking, and/or large-language model (LLM) and plug it into our infrastructure.
  • ๐Ÿ”„ Hybrid Search with cross-encoder re-ranking: For the best results, use hybrid search with BAAI/bge-reranker-large re-rank optimization.
  • ๐Ÿ“† Recency Biasing: Easily bias search results for what was most recent to prevent staleness
  • ๐Ÿ› ๏ธ Tunable Popularity-Based Ranking (Merchandizing): Weight indexed documents by popularity, total sales, or any other arbitrary metric for tunable relevancy
  • ๐Ÿ•ณ๏ธ Filtering: Date-range, substring match, tag, numeric, and other filter types are supported.
  • ๐Ÿง Duplicate Detection: Check out our docs on collision-based dup detection to learn about how we handle duplicates. This is a setting you can turn on or off.
  • ๐Ÿ‘ฅ Grouping: Mark multiple chunks as being part of the same file and search on the file-level such that the same top-level result never appears twice

Are we missing a feature that your use case would need? - call us at 628-222-4090, make a Github issue, or join the Matrix community and tell us! We are a small company who is still very hands-on and eager to build what you need; professional services are available.

Roadmap

Our current top 2 priorities for the next while are as follows. Subject to change as current or potential customers ask for things.

  1. Observability and metrics (likely something w/ Clickhouse)
  2. Benchmarking (going to aim for a 1M, 10M, and 100M vector benchmark)
  3. SDKs (can generate from OpenAPI spec, but would like to test a bit more)

How to contribute

  1. Find an issue in the issues tab that you would like to work on.
  2. Fork the repository and clone it to your local machine
  3. Create a new branch with a descriptive name: git checkout -b your-branch-name
  4. Solve the issue by adding or removing code on your forked branch.
  5. Test your changes locally to ensure that they do not break anything
  6. Commit your changes with a descriptive commit message: git commit -m "Add descriptive commit message here"
  7. Push your changes to your forked repository: git push origin your-branch-name
  8. Open a pull request to the main repository and describe your changes in the PR description

Self-hosting the API and UI's

We have a full self-hosting guide available on our documentation page here.

Local development with Linux

Install apt packages

sudo apt install curl \
gcc \
g++ \
make \
pkg-config \
python3 \
python3-pip \
libpq-dev \
libssl-dev \
openssl

Install NodeJS and Yarn

You can install NVM using its install script.

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash

You should restart the terminal to update bash profile with NVM. Then, you can install NodeJS LTS release and Yarn.

nvm install --lts
npm install -g yarn

Make server tmp dir

mkdir server/tmp

Install cargo-watch

cargo install cargo-watch

Setup env's

cp .env.chat ./chat/.env
cp .env.search ./search/.env
cp .env.server ./server/.env

Add your LLM_API_KEY to ./server/.env

Here is a guide for acquiring that.

Steps once you have the key

  1. Open the ./server/.env file
  2. Replace the value for LLM_API_KEY to be your own OpenAI API key.
  3. Replace the value for OPENAI_API_KEY to be your own OpenAI API key.

Start docker container services needed for local dev

cat .env.chat .env.search .env.server .env.docker-compose > .env

./convenience.sh -l
# or 
COMPOSE_PROFILE=dev docker compose up 

Start services for local dev

We know this is bad. Currently, We recommend managing this through tmux or VSCode terminal tabs.

cd server
cargo watch -x run
cd search
yarn
yarn dev
cd chat
yarn
yarn dev

Local development with Windows

Install NodeJS and Yarn

You can download the latest version NodeJS from here. Open the downloaded file and follow the steps from the installer.

After completing the installation, open a powershell with administrator permissions.

npm install -g yarn

After installation, yarn might throw an error when used due to Window's execution policy. Change the execution policy to allow scripts to be executed by applications that are signed by a trusted publisher by putting this command in an admin powershell.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

Install Rust

You can download the latest version of Rust from here. Follow the installer's directions and install the prerequisites.

After installation, open a new powershell window with administrator permissions.

cargo install cargo-watch

Install Docker

Follow the instructions to download Docker Desktop for Windows from here. You may need to follow the instructions to enable WSL 2.

Install Postgres dependencies for building

Download PostgreSQL 13 from here. You should not use any other version of PostgreSQL due to there being an issue with diesel on other versions.

When installing, ensure that the PostgreSQL server is set to a port other than 5432 to prevent it from interfering with the docker container.

Add Postgres to PATH

[Environment]::SetEnvironmentVariable("PATH", $Env:PATH + ";C:\Program Files\PostgreSQL\13\lib;C:\Program Files\PostgreSQL\13\bin", [EnvironmentVariableTarget]::Machine)

Setup env's

cp .env.chat ./chat/.env
cp .env.search ./search/.env
cp .env.server ./server/.env

Add your LLM_API_KEY to ./server/.env

Here is a guide for acquiring that.

Steps once you have the key

  1. Open the ./server/.env file
  2. Replace the value for LLM_API_KEY to be your own OpenAI API key.
  3. Replace the value for OPENAI_API_KEY to be your own OpenAI API key.

Start Docker containers

Start the docker containers using the batch script.

Get-Content .env.chat, .env.search, .env.server, .env.docker-compose | Set-Content .env
./convenience.bat l

Start services for local dev

You need 3 different windows of powershell or use something like VSCode terminal tabs to manage it.

cd server
cargo watch -x run
cd search
yarn
yarn dev
cd chat
yarn
yarn dev

Install ImageMagick (Linux) - only needed if you want to use pdf_from_range route

apt install libjpeg-dev libpng-dev libtiff-dev

curl https://imagemagick.org/archive/ImageMagick.tar.gz | tar xz
cd ImageMagick
./configure
make uninstall
make install

How to debug diesel by getting the exact generated SQL

diesel::debug_query(&query).to_string();

Listen to Stripe events for billing

Install Stripe CLI.

  1. stripe login
  2. stripe listen --forward-to localhost:8090/api/stripe/webhook
  3. stripe plans create --amount=1200 --currency=usd --interval=month --product=prod_PCHehsNBCcVN9i

trieve's People

Contributors

amaransen avatar anikdhabal avatar bharath090909 avatar chetax avatar densumesh avatar dhanus3133 avatar dv04 avatar fastfists avatar heetvekariya avatar hemxnt avatar neel-07 avatar neo773 avatar poke5352 avatar prasathhari avatar qnlbnsl avatar ramk777-stack avatar rishi-raj-jain avatar rohit-singh-bisht avatar rutambhagat avatar scorpil avatar skeptrunedev avatar ujwalkumar1995 avatar varun2002 avatar vid277 avatar vovallen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

trieve's Issues

refactor: make stripe_operator.rs create CheckoutSessions function pre-invite

Current Flow

  1. Stripe Customer is created when user sets their password
  2. User signs in
  3. User can request a CheckoutSession url for a given plan (Silver or Gold)
  4. User goes to Stripe's hosted payment page and successfully pays or cancels
  5. If cancels, goes back to /debate route
  6. If succeeds, Stripe hits out webhook to tell us

New Flow

User does not have an account

  • 1. User requests a CheckoutSession URL for a given plan (Silver or Gold)
  • 2. User goes to Stripe's hosted payment page and successfully pays or cancels
  • #65
  • 6. If succeeds, Stripe hits out webhook
  • 7. We create an invite for the email on the payment
  • 8. User receives email and sets their password

User already has an account

  • 1. Logged in user requests a CheckoutSession URL for a given plan (Silver or Gold)
  • 2. User goes to Stripe's hosted payment page and successfully pays or cancels
  • 3. 5. If cancels, goes back to /debate route on app
  • #65
  • 7. We mark the user's plan in the db
  • 8. User is able to send more messages and use premium plan features

Set `cookie_secure` to true

This is a somewhat complex task:

  • Modify etc/hosts locally so we can use SSL in the local env
  • Add the SSL certs to the Actix HTTP server appropriately

Authenticate Routes

Thus far, I have seen two viable ways of doing this:

  • Actix-Web has a pattern referred to as "guard"
  • Use Rust modifiers on service functions so that we call an authentication function at the beginning of every service

You should google this.

Add TOTP to auth

I actually don't know how the flow for this works, but it should be something like "add user+pass" then in another request "submit totp"

Topic routes

  • authenticated
  • create topic
  • delete topic
  • edit topic
  • get all topics for user

Regular Chat

3 main things

  • Migrate topics to have a normal chat field set to false default
  • Handle normal chat flag in create topic handler
  • Set system message and 1st chat message to somehing different if regular_chat

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.