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

vectorvault

v1.1.2

Published

VectorVault API - JavaScript Client: Streamline your front-end development with the powerful combination of OpenAI's API and VectorVault's Cloud Vector Database. This JavaScript client provides seamless integration for building advanced RAG (Retrieve and

Downloads

36

Readme

VectorVault

VectorVault API - JavaScript Client: Streamline your front-end development with the powerful combination of OpenAI's API and VectorVault's Cloud Vector Database. This JavaScript client provides seamless integration for building advanced RAG (Retrieve and Generate) applications. Whether you're working with JavaScript, HTML, or other web technologies, our API simplifies the process of fetching RAG responses through API POST requests. This package is the key to unlocking quick and efficient development for AI-powered web applications, ensuring a secure and robust connection to the VectorVault ecosystem. Start crafting exceptional RAG apps with minimal effort and maximum efficiency.

Installation

Install VectorVault via npm:

npm install vectorvault --save

Usage

To use VectorVault, you need to import it and instantiate it with your user details and API keys:

import VectorVault from 'vectorvault';

const user = '[email protected]';
const vault = 'your_vault_name';
const api = 'your_vectorvault_api_key';
const openai_key = 'your_openai_api_key';

const vectorVault = new VectorVault(user, vault, api, openai_key);

Basic Operations

Here are some of the basic operations you can perform:

// Get a chat response
vectorVault.getChat({ text: 'Your query here' })
  .then(response => console.log(response))
  .catch(error => console.error(error));

// Manage items in the vault
vectorVault.getItems([1])
  .then(items => console.log(items))
  .catch(error => console.error(error));

// Add new items to the cloud
vectorVault.addCloud({ text: 'Your text data here' })
  .then(response => console.log(response))
  .catch(error => console.error(error));

Streaming Chat Responses

The getChatStream function allows you to stream data from the VectorVault API. It requires two arguments: params, which is an object containing the parameters for your request, and callback, which is a function that will be called with each piece of data received from the stream.

Here is how you can use getChatStream:

// Define your callback function
function handleStreamedData(data) {
    // Process the streamed data here 
    console.log(data);
}

// Set up the parameters for your request
const streamParams = {
    text: "Your query here",
    // ...other parameters as needed
};

// Start streaming data
vectorVault.getChatStream(streamParams, handleStreamedData)
    .then(() => console.log("Streaming completed."))
    .catch(error => console.error("Streaming error:", error));

The params object can include any of the following properties:

text: The input text for the chat. history: The chat history, if applicable. summary: A boolean indicating if the response should be a summary. get_context: A boolean to indicate if you want to receive context information. n_context: The number of context turns you want to receive. return_context: A boolean to include the context in the response. smart_history_search: A boolean to enable smart history searching. model: The model you want to use, e.g., "gpt-3.5-turbo". include_context_meta: A boolean to include metadata about the context. metatag, metatag_prefixes, metatag_suffixes: Arrays for advanced context tagging. custom_prompt: A custom prompt to be used instead of the default. temperature: The creativity temperature. timeout: The timeout for the model response wait time. Make sure to replace "Your query here" with the actual text you want to send to the API.

Please note that getChatStream is an asynchronous function and should be handled with async/await or .then().catch() for proper error handling. If you don't already have a VectorVault API key, go get one at vectorvault.io