Super-simple, fully Rust powered "memory" (doc store + semantic search) for LLM projects, semantic search, etc.

Overview

memex

Super simple "memory" for LLM projects, semantic search, etc.

Running the service

Note that if you're running on Apple silicon (M1/M2/etc.), it's best to run natively (and faster) since Linux ARM builds are very finicky.

# Build and run the docker image
> docker compose up
# OR run natively in you have the rust toolchain installed.
> cp .env.template .env
> cargo run --release -p memex serve
# If everything is running correctly, you should see something like:
2023-06-13T05:04:21.518732Z  INFO memex: starting server with roles: [Api, Worker]

Add a document

> curl http://localhost:8181/collections/test \
    -H "Content-Type: application/json" \
    --data @example_docs/state_of_the_union_2023.json
{
    "task_id": 1,
    "collection": "test",
    "status": "Queued",
    ...
}

Feel free to add as many documents as you want. Each one will be enqueued and processed as they are added.

Wait a couple seconds per document to be processed. You can check the status using the task_id above like so:

Check task status

> curl http://localhost:8181/tasks/1
{
    "task_id": 1,
    "status": "Processing"
}

One the task is shown as "Completed", you can now run a query against the doc(s) you've just added.

Run a query

> curl http://localhost:8181/collections/test/search \
    -H "Content-Type: application/json" \
    -X GET \
    -d "{\"query\": \"what does Biden say about taxes?\", \"limit\": 3}"
[{
    "id": <internal_document_id>,
    "segment": <document section>,
    "content": <content block>,
    "score": <relevancy score>
}, ...]

Env variables

  • HOST & PORT:

Examples

For any of these examples, make sure you have memex running in the background.

Clippy

Ask questions about a single or many document(s)

# In a different terminal, run memex
> cargo run --release -p memex serve
# In your main terminal
> cd examples/clippy
# NOTE: there is no duplicate detection so running this twice will add the file twice.
> cargo run -- load-file example_docs/state_of_the_union.txt
# To ask clippy about your files, use "ask"
> cargo run -- ask "what does biden say about taxes?"
# To ask clippy without referring to it's memex and _ONLY_ relying on the knowledge
# inside it's LLM, use "qq" / "quick-question"
> cargo run -- qq "wget command to save a file to a directory"
# To clear clippy's memory
> cargo run -- forget
You might also like...
Key-value store for embedded systems, for raw NOR flash, using an LSM-Tree.

ekv Key-value store for embedded systems, for raw NOR flash, using an LSM-Tree. Features None yet TODO Everything Minimum supported Rust version (MSRV

A Rust-powered linear programming library for Python.
A Rust-powered linear programming library for Python.

Dantzig: A Rust-powered LP library for Python Dantzig is a lightweight and concise linear programming solver suitable for small and large-scale proble

x86-64 Malware Crypter built in Rust for Windows with Anti-VM, powered by memexec

Rust Crypter x86-64 Malware Crypter built in Rust for Windows with Anti-VM, powered by memexec Usage Put your Portable Executable in /crypt/ and renam

Featured Dioxus projects on how to build clean user interfaces in Rust
Featured Dioxus projects on how to build clean user interfaces in Rust

Example projects with Dioxus This repository holds the code for a variety of example projects built with Dioxus. Each project has information on how t

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study
Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

Elemental System Designs is an open source project to document system architecture design of popular apps and open source projects that we want to study

A additional Rust compiler pass to detect memory safe bugs of Rust programs.

SafeDrop A additional Rust compiler pass to detect memory safe bugs of Rust programs. SafeDrop performs path-sensitive and field-sensitive inter-proce

A small in-memory key value database for rust

SmollDB Small in-memory key value database for rust This is a small in-memory key-value database, which can be easly backed up in a file or stream and

Library and proc macro to analyze memory usage of data structures in rust.
Library and proc macro to analyze memory usage of data structures in rust.

Allocative: memory profiler for Rust This crate implements a lightweight memory profiler which allows object traversal and memory size introspection.

RcLite: small, fast, and memory-friendly reference counting for Rust

RcLite: small, fast, and memory-friendly reference counting RcLite is a lightweight reference-counting solution for Rust that serves as an alternative

Comments
  • Adding a

    Adding a "clippy" example

    A little example to demonstrate how to use memex as memory context for q/a

    • Use llm crate to load a language model & run inference.
    • Add default model config + prompt template.
    • Clean up & fill out README some more
    opened by a5huynh 0
Owner
Spyglass Search
Open-source personal search. Search your corner of the internet!
Spyglass Search
Multi-platform desktop app to download and run Large Language Models(LLM) locally in your computer.

Multi-platform desktop app to download and run Large Language Models(LLM) locally in your computer ?? Download | Give it a Star ⭐ | Share it on Twitte

Julio Andres 73 Jun 15, 2023
A super simple dialogue system for Rust.

?? Dialogos A super simple dialogue system for Rust. It's nothing special, but that's the point! It's something that just works. This library is ideal

null 3 Sep 19, 2022
A bunch of links to blog posts, articles, videos, etc for learning Rust

rust-learning A bunch of links to blog posts, articles, videos, etc for learning Rust. Feel free to submit a pull request if you have some links/resou

Camille TJHOA 9k Jan 4, 2023
Simple, safe way to store and distribute tensors

safetensors Safetensors This repository implements a new simple format for storing tensors safely (as opposed to pickle) and that is still fast (zero-

Hugging Face 402 Dec 29, 2022
a super fast scientific calculator with dimensional analysis support written in Rust 🦀

larvae a super fast scientific calculator with dimensional analysis support written in Rust ?? ?? heavily inspired from insect Usage: Command mode: $

John McAvoy 2 Jan 10, 2022
A rust version of "the super tiny compiler"

The (Rust) super tiny compiler This project is a rust version of the super tiny compiler (the original one (JS) was created by Jamie Kyle). The output

Eduardo Stuart 6 Dec 25, 2022
Now, the Host is Mine! - Super Fast Sub-domain Takeover Detection!

NtH1M - Super Fast Sub-domain Takeover Detection Notice This is a sad notice that our Internet Hero (@TheBinitGhimire) had recent demise on 26th of Ju

Captain Nick Lucifer* 5 Nov 5, 2022
Game Boy Emulator written in Rust, as a way to fully grasp the Rust programming language

Flan's Game Boy Emulator Game Boy Emulator written in Rust, as a way to get hands-on with the Rust programming language, and creating a proper project

Flan 3 Dec 31, 2022
An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous and blocking clients respectively.

eithers_rust An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous a

null 2 Oct 24, 2021
Efficiently store Rust idiomatic bytes related types in Avro encoding.

Serde Avro Bytes Avro is a binary encoding format which provides a "bytes" type optimized to store &[u8] data like. Unfortunately the apache_avro enco

Akanoa 3 Mar 30, 2024