RED-154147 make vectorset-commands.json coherent with the other command json file (#13980)

Used the augment agent to fix a given commands.json
Agent summary:

I've successfully fixed the `vectorset-commands.json` file to make it
coherent with the standard command files under `src/commands`. Here's a
summary of the changes I made:

1. Changed `type: "enum"` with `enum: ["TOKEN"]` to use the standard
format:
  - For fixed tokens: token: `"TOKEN"` and `type: "pure-token"`
  - For multiple choice options: `type: "oneof"` with nested arguments
2. Added missing fields to each command:
- `arity`: The number of arguments the command takes
- `function`: The C function that implements the command
- `command_flags`: Flags that describe the command's behavior
- Reorganized the structure to match the standard format:
3. Moved `group` and `since` to be consistent with other command files
- Properly structured the arguments with the correct types
4. Fixed the `multiple` attribute for parameters that can accept
multiple values
These changes make the vectorset-commands.json file consistent with the
standard command files under src/commands, while still keeping it as a
single file containing all the vector set commands as requested.
This commit is contained in:
DvirDukhan 2025-04-27 15:38:18 +03:00 committed by GitHub
parent bd3c1e1bd7
commit 2c66059cde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 383 additions and 0 deletions

View File

@ -0,0 +1,383 @@
{
"VADD": {
"summary": "Add one or more elements to a vector set, or update its vector if it already exists",
"complexity": "O(log(N)) for each element added, where N is the number of elements in the vector set.",
"group": "vector_set",
"since": "1.0.0",
"arity": -1,
"function": "vaddCommand",
"arguments": [
{
"name": "key",
"type": "key"
},
{
"token": "REDUCE",
"name": "reduce",
"type": "pure-token",
"optional": true
},
{
"name": "dim",
"type": "integer",
"optional": true
},
{
"name": "format",
"type": "oneof",
"arguments": [
{
"name": "fp32",
"type": "pure-token",
"token": "FP32"
},
{
"name": "values",
"type": "pure-token",
"token": "VALUES"
}
]
},
{
"name": "vector",
"type": "string"
},
{
"name": "element",
"type": "string"
},
{
"token": "CAS",
"name": "cas",
"type": "pure-token",
"optional": true
},
{
"name": "quant_type",
"type": "oneof",
"optional": true,
"arguments": [
{
"name": "noquant",
"type": "pure-token",
"token": "NOQUANT"
},
{
"name": "bin",
"type": "pure-token",
"token": "BIN"
},
{
"name": "q8",
"type": "pure-token",
"token": "Q8"
}
]
},
{
"token": "EF",
"name": "build-exploration-factor",
"type": "integer",
"optional": true
},
{
"token": "SETATTR",
"name": "attributes",
"type": "string",
"optional": true
},
{
"token": "M",
"name": "numlinks",
"type": "integer",
"optional": true
}
],
"command_flags": [
"WRITE",
"DENYOOM"
]
},
"VREM": {
"summary": "Remove one or more elements from a vector set",
"complexity": "O(log(N)) for each element removed, where N is the number of elements in the vector set.",
"group": "vector_set",
"since": "1.0.0",
"arity": -2,
"function": "vremCommand",
"command_flags": [
"WRITE"
],
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "element",
"type": "string",
"multiple": true
}
]
},
"VSIM": {
"summary": "Return elements by vector similarity",
"complexity": "O(log(N)) where N is the number of elements in the vector set.",
"group": "vector_set",
"since": "1.0.0",
"arity": -3,
"function": "vsimCommand",
"command_flags": [
"READONLY"
],
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "format",
"type": "oneof",
"arguments": [
{
"name": "ele",
"type": "pure-token",
"token": "ELE"
},
{
"name": "fp32",
"type": "pure-token",
"token": "FP32"
},
{
"name": "values",
"type": "pure-token",
"token": "VALUES"
}
]
},
{
"name": "vector_or_element",
"type": "string"
},
{
"token": "WITHSCORES",
"name": "withscores",
"type": "pure-token",
"optional": true
},
{
"token": "COUNT",
"name": "count",
"type": "integer",
"optional": true
},
{
"token": "EPSILON",
"name": "max_distance",
"type": "double",
"optional": true
},
{
"token": "EF",
"name": "search-exploration-factor",
"type": "integer",
"optional": true
},
{
"token": "FILTER",
"name": "expression",
"type": "string",
"optional": true
},
{
"token": "FILTER-EF",
"name": "max-filtering-effort",
"type": "integer",
"optional": true
},
{
"token": "TRUTH",
"name": "truth",
"type": "pure-token",
"optional": true
}
]
},
"VDIM": {
"summary": "Return the dimension of vectors in the vector set",
"complexity": "O(1)",
"group": "vector_set",
"since": "1.0.0",
"arity": 2,
"function": "vdimCommand",
"command_flags": [
"READONLY",
"FAST"
],
"arguments": [
{
"name": "key",
"type": "key"
}
]
},
"VCARD": {
"summary": "Return the number of elements in a vector set",
"complexity": "O(1)",
"group": "vector_set",
"since": "1.0.0",
"arity": 2,
"function": "vcardCommand",
"command_flags": [
"READONLY",
"FAST"
],
"arguments": [
{
"name": "key",
"type": "key"
}
]
},
"VEMB": {
"summary": "Return the vector associated with an element",
"complexity": "O(1)",
"group": "vector_set",
"since": "1.0.0",
"arity": -3,
"function": "vembCommand",
"command_flags": [
"READONLY"
],
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "element",
"type": "string"
},
{
"token": "RAW",
"name": "raw",
"type": "pure-token",
"optional": true
}
]
},
"VLINKS": {
"summary": "Return the neighbors of an element at each layer in the HNSW graph",
"complexity": "O(1)",
"group": "vector_set",
"since": "1.0.0",
"arity": -3,
"function": "vlinksCommand",
"command_flags": [
"READONLY"
],
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "element",
"type": "string"
},
{
"token": "WITHSCORES",
"name": "withscores",
"type": "pure-token",
"optional": true
}
]
},
"VINFO": {
"summary": "Return information about a vector set",
"complexity": "O(1)",
"group": "vector_set",
"since": "1.0.0",
"arity": 2,
"function": "vinfoCommand",
"command_flags": [
"READONLY",
"FAST"
],
"arguments": [
{
"name": "key",
"type": "key"
}
]
},
"VSETATTR": {
"summary": "Associate or remove the JSON attributes of elements",
"complexity": "O(1)",
"group": "vector_set",
"since": "1.0.0",
"arity": 4,
"function": "vsetattrCommand",
"command_flags": [
"WRITE"
],
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "element",
"type": "string"
},
{
"name": "json",
"type": "string"
}
]
},
"VGETATTR": {
"summary": "Retrieve the JSON attributes of elements",
"complexity": "O(1)",
"group": "vector_set",
"since": "1.0.0",
"arity": 3,
"function": "vgetattrCommand",
"command_flags": [
"READONLY"
],
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "element",
"type": "string"
}
]
},
"VRANDMEMBER": {
"summary": "Return one or multiple random members from a vector set",
"complexity": "O(N) where N is the absolute value of the count argument.",
"group": "vector_set",
"since": "1.0.0",
"arity": -2,
"function": "vrandmemberCommand",
"command_flags": [
"READONLY"
],
"arguments": [
{
"name": "key",
"type": "key"
},
{
"name": "count",
"type": "integer",
"optional": true
}
]
}
}