Overview

The Retrieval Engine is more than simple vector database doing semantic search — the Retrieval Engine is a multistage retrieval pipeline that involves two custom ML models:

  1. An embedding model we call Ultraviolet—1 that is responsible for creating the embeddings;
  2. An encoder-encoder LM model that is responsible for reranking the results of the semantic search.

This yields great accuracy and since all of our models are our own, we can run them in our own infra which makes sure we’re also fast.

Our ultimate aim has always been achieving the best performance possible in terms of accuracy per millisecond. We understand the challenges real-world applications face due to latency when using LLMs. It is crucial for us that Memora never becomes the latency bottleneck in your application.

Fun fact: Memora was born out of need. We were working on another startup that used LLMs and retrieval. But, we discover our biggest bottleneck was the retrieval part. We spent a lot of time building a solution and that solution is what we now call Memora. We built it for us, but now it’s here for everyone.

Retrieving documents

Though there is much complexity under the hood of Memora, we’ve designed the interface to be simple and user-friendly. You can retrieve documents with just a single command: memora.find():

docs is an array consisting of the top 3 documents in order for the "what is the meaning of life?" query.

Retrieving more documents

By default, Memora returns only the top 3 documents only. You can specify a different number though — up to 20 documents only.

Retrieving from a collection

To target your search within a particular collection, use the in('collection-name') modifier before invoking the find() method:

If you don’t specify a collection for the search, Memora will default to your personal collection.

Metadata filtering

Sometimes, you might need to filter your search based on certain attributes or metadata of your documents. Memora makes it easy to do so.

Imagine you have a collection named book-citations filled with documents like this:

[
  {
    "id": "01H3YY4RTACHHNMSM71JNREP56",
    "content": "The Answer to the Ultimate Question of Life, the Universe, and Everything is 42",
    "book": "The Hitchhiker's Guide to the Galaxy",
    "author": "Douglas Adams",
    "published_at": 1978,
    "genre": "science fiction"
  },
  // ...
]

You want to find book citations that discuss the meaning of life, but only those published after “The Hitchhiker’s Guide to the Galaxy” (1978). Here’s how Memora can help you with that:

The where() filter will return only those documents that have a published_at field in their metadata and where this field is greater than 1978.

Advanced Filtering: Using and() & or()

Let’s step up our game a bit. What if you’re looking for citations discussing the ‘meaning of life’, published after 1978, and belonging to the ‘biography’ genre? Here’s how:

With Memora’s or() method, you can create a condition where if either one of the conditions is met, the document will be returned:

Chaining multiple filters

You can chain as many and() or or() modifiers as you like after a where() filter. For example:

Note: Currently, Memora does not support chaining an and() with an or(). We’re working on this feature and aim to roll it out soon.

Learn more

There still plenty more you can do with Memora find() method. We recommend checking the find() reference page for the library you’re using:

Limits

To learn more about limits related to documents, refer to this page.