Search API

Search

post

Perform a vector similarity search (VSS) operation on a dataset.

The search operation will return the most relevant matches based on cosine similarity with the input text. The datasets queries should have an embedding column, and the appropriate embedding model loaded.

Authorizations
Body
anyOptional
Responses
200

Search completed successfully

application/json
Responseany
post
POST /v1/search HTTP/1.1
Host: data.spiceai.io
X-API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 157

{
  "datasets": [
    "app_messages"
  ],
  "text": "Tokyo plane tickets",
  "where": "user=1234321",
  "additional_columns": [
    "timestamp"
  ],
  "limit": 3,
  "keywords": [
    "plane",
    "tickets"
  ]
}
{
  "results": [
    {
      "matches": {
        "message": "I booked use some tickets"
      },
      "dataset": "app_messages",
      "primary_key": {
        "id": "6fd5a215-0881-421d-ace0-b293b83452b5"
      },
      "data": {
        "timestamp": 1724716542
      },
      "score": 0.914321
    },
    {
      "matches": {
        "message": "direct to Narata"
      },
      "dataset": "app_messages",
      "primary_key": {
        "id": "8a25595f-99fb-4404-8c82-e1046d8f4c4b"
      },
      "data": {
        "timestamp": 1724715881
      },
      "score": 0.83221
    },
    {
      "matches": {
        "message": "Yes, we're sitting together"
      },
      "dataset": "app_messages",
      "primary_key": {
        "id": "8421ed84-b86d-4b10-b4da-7a432e8912c0"
      },
      "data": {
        "timestamp": 1724716123
      },
      "score": 0.787654321
    }
  ],
  "duration_ms": 42
}

Last updated

Was this helpful?