@emno/sdk
TypeScript icon, indicating that this package has built-in type declarations

1.4.0 • Public • Published

@emno/sdk

Overview

@emno/sdk is a TypeScript/Javascript SDK designed for managing collections and vectors in a highly efficient and scalable manner. This documentation provides a guide to using the SDK, including setup, collection management, vector operations, and querying.


Getting Started

Installation

To use @emno/sdk, first install the package via npm:

npm install @emno/sdk

Configuration

Import and configure the Emno class with your token:

import { Emno } from '@emno/sdk';
import { EmnoClientConfig } from '@emno/sdk';

const config: EmnoClientConfig = {
  token: 'your_api_key_here',
};

const emno = new Emno(config);

| Get your API key by logging into the emno dashboard and navigating to the API tab.

Collections

Creating a Collection

Create a new collection by specifying its name and configuration:

const createdCollection = await emno.createCollection({
  name: 'your_collection_name',
  config: {
    dim: 384,
    model: 'HUGGINGFACE-MINI-LM-L6',
    // additional configuration parameters
  },
});

Listing Collections

Retrieve a list of all collections:

const collections = await emno.listCollections();

Retrieving a Collection

Get a specific collection by name or ID:

const collection = await emno.getCollection('collection_name_or_id');

Deleting a Collection

Delete a collection by name or ID:

await emno.deleteCollection('collection_name_or_id');

Updating a Collection

Update collection details:

const collection = await emno.getCollection('collection_name_or_id');
const updateData = { description: 'new_description' };
const updatedCollection = await collection.update(updateData);

Vectors

Adding Vectors to a Collection

Add vectors to a collection:

const collection = await emno.getCollection('collection_name_or_id');
const textToAdd = [{ metadata: {}, content: 'your_text_content' }];
const addedVectors = await collection.addText(textToAdd);

Retrieving Vectors

Get vectors by their IDs:

const collection = await emno.getCollection('collection_name_or_id');
const fetchedVectors = await collection.getVectors([
  'vector_id1',
  'vector_id2',
]);

Listing All Vectors

List all vectors in a collection:

const collection = await emno.getCollection('collection_name_or_id');
const vectors = await collection.listVectors();

Querying a Collection

Perform a text query in a collection:

const collection = await emno.getCollection('collection_name_or_id');
const queryVectorArray = {
  content: ['your_query_text'],
  topK: 2,
};
const queryResultsVectors = await collection.queryByText(queryVectorArray);

Getting Vector Count

Get the count of vectors in a collection:

const collection = await emno.getCollection('collection_name_or_id');
const count = await collection.count();

Updating Multiple Vectors

Update metadata for multiple vectors:

const collection = await emno.getCollection('collection_name_or_id');
const updatedVectors = await collection.updateVectors(updatedVectorDataList);

Deleting Vectors

Delete vectors by their IDs:

const collection = await emno.getCollection('collection_name_or_id');
await collection.deleteVectors(['vector_id1', 'vector_id2']);

Deleting All Vectors

Remove all vectors from a collection:

const collection = await emno.getCollection('collection_name_or_id');
await collection.deleteAllVectors();

Readme

Keywords

none

Package Sidebar

Install

npm i @emno/sdk

Homepage

www.emno.io/

Weekly Downloads

8

Version

1.4.0

License

MIT

Unpacked Size

68.1 kB

Total Files

7

Last publish

Collaborators

  • rajatkumar