Skip to content

POST /unbind/{db_name}/{namespace}

Extracts slot values from compositionally-encoded rows using HDC (HyperDimensional Computing) algebra. Unlike /extract, this performs actual inverse binding operations and returns similarity scores indicating extraction confidence.


Request

Content-Type: application/json

URL Parameters:

Parameter Description
db_name Name of the database
namespace Namespace within the database

Body:

Parameter Type Required Default Description
row_ids list of int Row IDs to unbind
slots list of string Slot names to extract (e.g. ["subject", "object"])
include_scores bool true Whether to include per-slot similarity scores in the response

Behavior

HDC unbinding — Each row's hypervector is decoded using the inverse binding operation for the requested slots. The similarity score for each slot indicates how confidently that value was extracted (1.0 = perfect, 0.0 = no signal).

Semantic slots — If any requested slot uses "semantic" encoding, embeddings for all stored values in that namespace are loaded into the cache before unbinding, then cleared afterwards.

Schema required — The collection must have been ingested with a Compose schema stored in metadata. If not, use /extract instead.

Slot validation — Requesting an unknown slot (not present in the schema) returns a 400 error listing available slots.


Responses

200 OK

{
  "status": "success",
  "count": 2,
  "results": [
    {
      "_id": 0,
      "subject": "Alice",
      "predicate": "works_at",
      "object": "Acme Corp",
      "_scores": {
        "subject": 0.97,
        "predicate": 0.88,
        "object": 0.91
      }
    },
    {
      "_id": 5,
      "subject": "Bob",
      "predicate": "reports_to",
      "object": "Alice",
      "_scores": {
        "subject": 0.95,
        "predicate": 0.84,
        "object": 0.89
      }
    }
  ]
}
Field Description
count Number of rows processed
results Array of row objects with extracted slot values
_scores Per-slot similarity scores (omitted if include_scores is false)

Error Responses

Status Condition
400 Unknown slot name, or collection was not ingested with a Compose schema
404 Collection or metadata not found
500 Unexpected internal error

Notes

  • Requires the collection to have been ingested with a Compose schema (e.g. Triple, or a custom slot schema).
  • For simple field value retrieval without HDC algebra, use /extract instead.
  • Lower similarity scores (below ~0.5) suggest the slot value may be ambiguous or was not strongly encoded.

Example

import requests

SERVER_URL = "http://18.220.128.24:8000"
API_KEY    = "yourapitoken"

def unbind_slots(db_name: str, namespace: str, row_ids: list, slots: list) -> dict:
    response = requests.post(
        f"{SERVER_URL}/unbind/{db_name}/{namespace}",
        headers={"X-API-Key": API_KEY},
        json={
            "row_ids":        row_ids,
            "slots":          slots,
            "include_scores": True,
        },
    )
    response.raise_for_status()
    return response.json()


result = unbind_slots(
    db_name="my_db",
    namespace="triples",
    row_ids=[0, 5],
    slots=["subject", "predicate", "object"],
)
print(result)

Expected output:

{
  "status": "success",
  "count": 2,
  "results": [
    {
      "_id": 0,
      "subject": "Alice",
      "predicate": "works_at",
      "object": "Acme Corp",
      "_scores": { "subject": 0.97, "predicate": 0.88, "object": 0.91 }
    }
  ]
}