(ai)
- insertRaw - Insert data into a table.
- insertJson - Insert data into a table.
- trainRaw - Train index on the table (IVF and IVFPQ only).
- trainJson - Train index on the table (IVF and IVFPQ only).
- vectorSearch - Vector similarity search
- hybridSearch - hybrid similarity search
Request body is a tuple of (target table name, data table) serialized into a PyKX octet stream with pykx._wrappers._to_bytes(6, pykx.toq([table, data]), 1)[1])
import { Kx } from "kx";
const kx = new Kx({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await kx.ai.insertRaw(new TextEncoder().encode("0x02eF1eFB84"));
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
Uint8Array | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<string>
Error Object | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4xx-5xx | / |
Request body is a tuple of (target table name, data table) serialized into a PyKX octet stream with pykx._wrappers._to_bytes(6, pykx.toq([table, data]), 1)[1])
import { Kx } from "kx";
const kx = new Kx({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await kx.ai.insertJson({
table: "myTable",
rows: [
{},
{},
],
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.InsertRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<string>
Error Object | Status Code | Content Type |
---|---|---|
errors.BadRequest | 400 | application/json |
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4xx-5xx | / |
Request body is a tuple of (target table name, data table)
import { Kx } from "kx";
const kx = new Kx({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await kx.ai.trainRaw(new TextEncoder().encode("0xEa5CAA8EfC"));
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
Uint8Array | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.KdbAiTrainRawResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4xx-5xx | / |
Request body is a tuple of (target table name, data table)
import { Kx } from "kx";
const kx = new Kx({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await kx.ai.trainJson({
table: "<value>",
rows: [
{},
],
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.InsertRequestBody | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.KdbAiTrainJsonResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4xx-5xx | / |
Vector similarity search
import { Kx } from "kx";
const kx = new Kx({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await kx.ai.vectorSearch({
table: "<value>",
vectors: [
[
7908.5,
],
],
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.SearchQuery | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.RCResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4xx-5xx | / |
hybrid similarity search
import { Kx } from "kx";
const kx = new Kx({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await kx.ai.hybridSearch({
table: "<value>",
denseVectors: [
[
4918.86,
],
],
sparseVectors: [
{},
],
});
// Handle the result
console.log(result)
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
components.HybridSearchQuery | ✔️ | The request object to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.RCResponse>
Error Object | Status Code | Content Type |
---|---|---|
errors.Unauthorized | 401 | application/json |
errors.Forbidden | 403 | application/json |
errors.NotFound | 404 | application/json |
errors.TooManyRequests | 429 | application/json |
errors.InternalServerError | 500 | application/json |
errors.ServiceUnavailable | 503 | application/json |
errors.SDKError | 4xx-5xx | / |