Memory Stores Metadata

Filter when searching a Memory Store

What is Memory Store Metadata?

Metadata is additional information you can add to a document that you can filter on when searching a Memory Store, similar to filtering the columns of a spreadsheet.

For example, you may want to:

  • Only return information specific to a client

  • Only return results that have a relevant classification

  • Only return results in a specific location

How to Add Metadata to a Memory Store

There are 3 different ways to add metadata to a memory store document:

  1. While adding your .csv or Google Sheets as content into the Memory Store

    • All columns in your .csv or Google sheet will be stored as metadata by default

  2. Via the AirOps "Memory Write" Step

Adding Metadata Columns from a .csv or Sheet

When uploading a .csv or connecting a Google Sheet, you will have the option to manually pick or choose which columns will be searchable. The remaining columns will still be returned as results, but the searchable columns can be utilized for filtering.

As an example, we can build a Memory Store that will help answer questions around shipments. While our database may contain information about the origin city and state of our shipments, we can add a .csv into the Memory Store that also includes geolocation. That way, we can filter on the individual state names later, but still utilize the lat/lon coordinates:

How to Filter on Metadata

Once you're confident that your uploaded documents in the Memory Store have reliable metadata, you can utilize the Memory Stores API "Search" endpoint to start filtering.

The code editor uses MongoDB's query and projection operators. While we support a comprehensive range of these operators, here are some of the most commonly used ones:

$eq - Equal to (for numbers, strings, booleans) $ne - Not equal to (for numbers, strings, booleans) $gt - Greater than (for numbers) $gte - Greater than or equal to (for numbers) $lt - Less than (for numbers) $lte - Less than or equal to (for numbers) $in - In array (for strings or numbers) $nin - Not in array (for strings or numbers)

When your metadata involves a list of strings, such as:

"genres": ["thriller", "mystery"]

the Memory Store accepts both genres as valid matches during the search.

Filtering on Metadata in an Agent

For an example on how to use the Visual Editor to filter on Metadata in an Agent, please see our Agent Quick Start guide.

Filtering on Metadata in a Workflow

For an example on how to use the Memory Search Step to filter on Metadata in a Workflow, please see our Memory Search Step documentation page.

If you need help setting up your Memory Store or metadata filters, please don't hesitate to reach out to us for help!

Last updated