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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pinecone-ts-client

v0.0.5

Published

This is the Typescript client for Pinecone. It is a wrapper around the Pinecone OpenAPI spec.

Downloads

19

Readme

Pinecone Typescript Client

This is the Typescript client for Pinecone. It is a wrapper around the Pinecone OpenAPI spec.

Maintenance Npm package version

Installation

npm install pinecone-ts-client

Usage

Set the following environment variables:

PINECONE_API_KEY=your_api_key
PINECONE_ENVIRONMENT=your_environment

Initializing the client

import { PineconeClient } from "pinecone-ts-client";

// Create a client
const client = new PineconeClient();

// Initialize the client
await client.init({
  apiKey: process.env.PINECONE_API_KEY,
  environment: process.env.PINECONE_ENVIRONMENT,
});

Control plane operations

The Pinecone control plane allows you to perform the following operations:

  1. Create, configure and delete indexes
  2. Get information about an existing indexes
  3. Create and delete collections
  4. Select an index to operate on

Indexes

Create Index

const createRequest: CreateRequest = {
  name: indexName,
  dimension: dimensions,
  metric,
};

await client.createIndex(createRequest);

Delete Index

await client.deleteIndex(indexName);

Describe Index

const indexDescription = await client.describeIndex(indexName);

Example result:

{
  "database": {
    "name": "my-index",
    "metric": "cosine",
    "dimension": 10,
    "replicas": 1,
    "shards": 1,
    "pods": 1,
    "pod_type": "p1.x1"
  },
  "status": {
    "waiting": [],
    "crashed": [],
    "host": "my-index-[project-id].svc.[environment].pinecone.io",
    "port": 433,
    "state": "Ready",
    "ready": true
  }
}

List Indexes

const list = await client.listIndexes();

Example result:

["index1", "index2"]

Select an index

To operate on an index, you must select it. This is done by calling the Index method on the client.

const index = client.Index(indexName);

Collections

Create Collection

const createCollectionRequest: CreateCollectionRequest = {
  name: collection,
  source: indexName,
};
await client.createCollection(createCollectionRequest);

Delete Collection

await client.deleteCollection(collection);

Describe Collection

const describeCollection = await client.describeCollection(collection);

Example result:

{}

List Collections

const list = await client.listCollections();

Example result:

["collection1", "collection2"]

Index operations

The Pinecone index operations allow you to perform the following operations instances of Vector.

A Vector is defined as follows:

type Vector = {
  id: string;
  values: number[];
  metadata?: object;
};

After selecting an index to operate on, you can:

1. Upsert vectors

const upsertRequest: UpsertRequest = {
  vectors,
  namespace,
};
await index.upsert(upsertRequest);
  1. Query for vectors
const vectors = [...] // array of vectors

const queryRequest: QueryRequest = {
  topK: 1,
  vector,
  namespace
}

const queryResponse = await index.query(queryRequest)
  1. Update a specific vector
const updateRequest: UpdateRequest = {
  id: vectorId, // the ID of the vector to update
  values: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0], // the new vector values
  setMetadata: metadata, // the new metadata
  namespace,
};
await index.update(updateRequest);
  1. Fetch vectors by their IDs
const fetchResult = await index.fetch([vectorIDs], namespace);
  1. Delete vectors
await index.delete1([vectorIDs], false, namespace);
  1. Delete all vectors in a namespace
await index.delete1([], true, namespace);