MindPlug
  • 🧠Introduction
  • 🔹How does it work?
  • 🍁JavaScript SDK
  • 🌴API
    • 📗API Setup - Text
    • 📗API Setup - Audio
      • 🔉Performing Transcription
    • 📗API Setup - PDFs
    • 📙Storing Data
    • 📙Store PDF
    • 📙Store Web
    • 📙Query Data
      • 🧠Using Metadata Filters
    • 📙Query By Ids
    • 📙Query by collection
    • 📙Delete By Ids
    • 📙Delete By Upload Id
    • 📙Delete Collection
    • 📙Delete Project
    • 📙List Projects
    • 📙List Collections
    • 📙Search Web
    • Parse Webpage
Powered by GitBook
On this page
  • Prerequisites
  • Querying data - API
  • Sample Response
  1. API

Query Data

Last updated 1 year ago

Prerequisites

Requires a user auth token. See the section.

Querying data - API

This endpoint retrieves the stored data based on the meaning of the query. The endpoins requires:

  1. Database name: db

  2. A collection name: collection

  3. An text string to search about: search

  4. optional count: the number of matches to return. Defaults to 3

  5. optional metadataFilters: to further filter data by metadata. Please see subpage

import mindplug from "@/src/mindplugAPI"; // base instance

mindplug.post("/data/query", {
    db: "walmart",
    collection: "office supplies",
    search: "an eraser with no crumbs",
    count: 1
});

Sample Response

Returns a list of matching responses.

{
    "data": [
        {
            "id": "4334eb12-f57d-4b67-8b13-1f62d7cf5791",
            "score": 0.893768728,
            "values": [],
            "metadata": {
                "content": "Premium eraser: an eraser that works on both pen and pencil and leaves no crumbs",
                "lastStock": "June 2023",
                "totalItems": 123
            }
        }
    ]
}
🌴
📙
API Auth