AddDescriptor
Insert a descriptor in an explicit class. Requires objects.create permission and one input blob: a nonempty, unpadded array of finite IEEE 754 float32 values in the server’s native byte order (normally little-endian).
An active vector definition additionally enforces its dimensions. A descriptor class can exist without an index; a definition created later validates and populates its existing values atomically. See Descriptor classes and vector indexes.
Parameters
class is required. Optional fields are _ref, properties, label, if_not_found and connect. The default label is the string "None". Conditional insertion searches the exact descriptor class. Every customer connection in connect requires a class.
The properties object stores key-value pairs on the new object.
The if_not_found condition inserts the object only when no existing object matches the condition.
The connect parameter creates connections between the new object and objects referenced earlier in the transaction.
Success returns status: 0. A conditional match returns status 2, skips insertion and retains the matches in _ref when requested. Invalid dimensions, nonfinite values or invalid references fail the transaction.
Examples
Create a class’s vector index, then add one vector using its corresponding input blob:
[{
"CreateIndex": {
"target": "descriptor",
"class": "Faces",
"property": "_blob",
"kind": "flat",
"params": {
"dimensions": 3
}
}
}, {
"AddDescriptor": {
"class": "Faces",
"label": "Alice",
"properties": {
"confidence": 0.9
}
}
}]
In Python, the blob can be produced with np.asarray([1,2,3], dtype="<f4").tobytes().