Skip to content

API Basics

mattmccj edited this page Jan 1, 2019 · 2 revisions

The Nearist Client API is fairly straightforward.

The basic commands are:

  • open(host, port, api_key) - Open a socket for communication with the Nearist appliance.
host IP address of the Nearist appliance.
port Port number for accessing the Nearist appliance.
api_key Unique user access key which is required to access the appliance.
  • close() - Close the socket to the Nearist appliance.

  • set_distance_mode(mode) - Set the distance metric.

mode Distance metric from Common.DistanceMode.
  • set_query_mode(mode) - Set query mode
mode Query mode from Common.QueryMode.
  • set_read_count(count) - Set query result count for KNN_D/KNN_A query mode(s)
count The top 'K' values in KNN.
  • set_threshold(threshold) - Set query threshold for GT, LT, or KNN query modes. In GT or KNN_D mode, the appliance will only return results whose distance is greater than the threshold value. In LT or KNN_A mode, the appliance will only return results whose distance is less than the threshold value.
threshold The threshold value.
  • ds_load(vectors) - Load dataset to Nearist appliance
vectors List of vectors (component lists).
  • load_dataset_file(file_name, dataset_name) - Load local dataset to Nearist appliance
file_name Local dataset file name.
dataset_name Local dataset name.
  • ds_load_random(vector_count, comp_count) - Load random dataset to Nearist appliance
vector_count Vector count to generate.
comp_count Vector's component count.
  • query(vectors) - Query for single/multiple vector(s)
vectors List of components for single query / List of vectors (component lists) for multipel query.
  • query_from_file(file_name, dataset_name, output_name) - Query local dataset to Nearist appliance
file_name Local dataset file name.
dataset_name Local dataset name.
output_name Results output file name.

Additional documentation can be found in the function header comments in Client.py.

Clone this wiki locally