Filters

Complete reference for filters available in the SnackPrompt AI Engine API.

Overview

Filters are used to restrict the scope of searches, chats, and deletions. They are passed in the filters object of the request body.

{
  "query": "your search",
  "filters": {
    "tenant_id": "required",
    "elemental_id": "optional",
    ...
  }
}

Filter List

Filter
Type
Required
Description

tenant_id

string

YES

Multi-tenant isolation

elemental_id

string

No

Elemental ID

user_id

string

No

User ID

tag_ids

string[]

No

Tag IDs

tag_names

string[]

No

Tag names

source

string

No

Source type

type_name

string

No

Elemental type

category_name

string

No

Category


Details

tenant_id

Tenant identifier for data isolation. Required in all operations.

Property
Value

Type

string

Required

Yes

Example

"tenant-abc123"

Behavior:

  • Ensures complete isolation between tenants

  • A tenant cannot access another tenant's data

  • Optimized in Qdrant with is_tenant=True

Example:

Error if missing:


elemental_id

Filters by a specific elemental (table/document).

Property
Value

Type

string

Required

No

Example

"elem-xyz789"

Example:


user_id

Filters by data from a specific user (within the tenant).

Property
Value

Type

string

Required

No

Example

"user-123"

Example:


tag_ids

Filters by tag IDs. OR logic (any of the tags).

Property
Value

Type

string[]

Required

No

Logic

OR

Example

["tag-1", "tag-2"]

Example:

Returns documents that have the tag "tag-marketing" OR "tag-sales".


tag_names

Filters by tag names. OR logic (any of the tags).

Property
Value

Type

string[]

Required

No

Logic

OR

Example

["Marketing", "Sales"]

Example:

Returns documents that have the tag "Marketing" OR "Sales".


source

Filters by data source type.

Property
Value

Type

string

Required

No

Values

elemental, document, file

Possible values:

Value
Description

elemental

SnackPrompt tables

document

Documents

file

Uploaded files

Example:


type_name

Filters by elemental type.

Property
Value

Type

string

Required

No

Values

Table, Document, etc.

Example:


category_name

Filters by elemental category.

Property
Value

Type

string

Required

No

Example

"Finance"

Example:


Combining Filters

Combination Logic

  • Between different filters: AND

  • Within arrays (tags): OR

Example:

This means:

  • tenant_id = "tenant-abc123" AND

  • source = "elemental" AND

  • (tag_names contains "Marketing" OR "Sales")


Usage by Endpoint

Endpoint
Supported Filters

/v1/kb/search

All

/v1/kb/chat

All

/v1/kb/chat/stream

All

/v1/kb/delete

tenant_id, elemental_id, user_id, tag_ids, tag_names, source


Practical Examples

Search in a Specific Document

Search by Multiple Tags

Search Only in Tables

Delete User Data

Last updated

Was this helpful?