Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@pinecone-database/pinecone-ts-client
Advanced tools
Readme
This is the Typescript client for Pinecone. It is a wrapper around the Pinecone OpenAPI spec.
npm i @pinecone-database/pinecone-ts-client
Set the following environment variables:
PINECONE_API_KEY=your_api_key
PINECONE_ENVIRONMENT=your_environment
import { PineconeClient } from "@pinecone-database/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,
});
The Pinecone control plane allows you to perform the following operations:
const createRequest: CreateRequest = {
name: indexName,
dimension: dimensions,
metric,
};
await client.createIndex(createRequest);
await client.deleteIndex(indexName);
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
}
}
const list = await client.listIndexes();
Example result:
["index1", "index2"]
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);
const createCollectionRequest: CreateCollectionRequest = {
name: collection,
source: indexName,
};
await client.createCollection(createCollectionRequest);
await client.deleteCollection(collection);
const describeCollection = await client.describeCollection(collection);
Example result:
{
"name": "my-collection",
"status": "Ready",
"size": 3059815,
"dimension": 10
}
const list = await client.listCollections();
Example result:
["collection1", "collection2"]
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:
const upsertRequest: UpsertRequest = {
vectors,
namespace,
};
await index.upsert(upsertRequest);
const vectors = [...] // array of vectors
const queryRequest: QueryRequest = {
topK: 1,
vector,
namespace
}
const queryResponse = await index.query(queryRequest)
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);
const fetchResult = await index.fetch([vectorIDs], namespace);
await index.delete1([vectorIDs], false, namespace);
await index.delete1([], true, namespace);
FAQs
This is the Typescript client for Pinecone. It is a wrapper around the Pinecone OpenAPI spec.
We found that @pinecone-database/pinecone-ts-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.