Skip to content

Latest commit

 

History

History
329 lines (243 loc) · 33.4 KB

README.md

File metadata and controls

329 lines (243 loc) · 33.4 KB

Ai

(ai)

Available Operations

insertRaw

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])

Example Usage

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();

Parameters

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.

Response

Promise<string>

Errors

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 /

insertJson

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])

Example Usage

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();

Parameters

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.

Response

Promise<string>

Errors

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 /

trainRaw

Request body is a tuple of (target table name, data table)

Example Usage

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();

Parameters

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.

Response

Promise<operations.KdbAiTrainRawResponse>

Errors

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 /

trainJson

Request body is a tuple of (target table name, data table)

Example Usage

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();

Parameters

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.

Response

Promise<operations.KdbAiTrainJsonResponse>

Errors

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 /

vectorSearch

Vector similarity search

Example Usage

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();

Parameters

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.

Response

Promise<components.RCResponse>

Errors

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 /

hybridSearch

hybrid similarity search

Example Usage

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();

Parameters

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.

Response

Promise<components.RCResponse>

Errors

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 /