npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@vantage-discovery/vantage-node-sdk

v0.6.0-dev1

Published

<img src="assets/vantage_logo.png" title="Vantage Discovery Logo" width="300"/></br>

Downloads

8

Readme

Vantage Discovery Node SDK

The Vantage Discovery Node SDK provides an easy-to-use interface to interact with the Vantage vector database, enabling developers to seamlessly integrate vector search and collection management capabilities into their Node applications.

Installation

To install the Vantage Node SDK, run the following command:

npm i @vantage-discovery/vantage-node-sdk

Quickstart

To get started with the Vantage Node SDK, you'll need to set up your Vantage account and obtain your account ID and Vantage API key. Once you have your ID and key, you can initialize the VantageClient which you can then use to manage your account, collections and keys and perform searches.

import { VantageClient } from '@vantage-discovery/vantage-node-sdk';

const accountId = "ACCOUNT_ID"
const vantageApiKey = "API_KEY"

const configuration = {
    vantageApiKey: vantageApiKey,
    accountId: accountId
}

let client = new VantageClient(configuration)

Overview

The Vantage Discovery Node SDK is divided into several modules, allowing you to manage account, collections, and API keys, as well as perform various types of searches.

Key Features

  • Collection Management: Easily create, update, list, and delete collections.
  • Documents Upload: Upload your data easily to your collections.
  • Search: Perform semantic, embedding and "more like this/these" searches within your collections.
  • LLM Keys Management: Keep your LLM provider secrets safe and up-to-date.

🔍 Examples

Creating a Collection

To create a new collection for storing documents, specify the collection ID, the dimension of the embeddings, and the LLM (language learning model) details. Here, we use text-embedding-ada-002 from OpenAI with the necessary secret key.

📚 Visit management-api documentation for more details.

import { OpenAICollection } from '@vantage-discovery/vantage-node-sdk'

const newCollection: OpenAICollection = new OpenAICollection(
    "openai-collection",
    1536,
    "text-embedding-ada-002",
    "OPENAI_SECRET"
)

const response = client.createCollection({
    collection: newCollection
})

Uploading Documents

To upload documents to your collection, provide a list of document IDs and corresponding text. Each document is wrapped in a VantageManagedEmbeddingsDocument object. This example demonstrates uploading a batch of documents.

📚 Visit management-api documentation for more details.

const collectionId = "openai-collection"

const ids: string[] = [
    "1",
    "2",
    "3",
    "4",
];

const texts: string[] = [
    "First text",
    "Second text",
    "Third text",
    "Fourth text",
];

const documents: VantageManagedEmbeddingsDocument[] = ids.map(
    (id, index) => new VantageManagedEmbeddingsDocument(texts[index], id)
);

client.upsertDocuments({
    collectionId: collectionId, 
    documents: documents
});

Performing a Search

To perform a semantic search within your collection, specify the text you want to find similar documents for. This example retrieves documents similar to the provided text, printing out each document's ID and its similarity score.

📚 Visit search-api documentation for more details.

const collectionId = "openai-collection"
const queryText = "Find documents similar to this text"

const searchResults = client.semanticSearch(collectionId, queryText)

📚 Documentation

For detailed documentation on all methods and their parameters, please refer to the Vantage Discovery official documentation.