Skip to main content

Pinecone

Pinecone is a vector database that simplifies the process of creating high-performance vector search applications

Official Websitehttps://www.pinecone.io
TagsDatabaseVector
Network Connection needs

This integration needs network access to the server where the service is running.

See the Network access page for details about how to achieve that.

Credential configuration

To configure this credential you need the environmment, and the api key to connect to your project.

Here you have an example of a filled credential configuration form in YepCode:

Pinecone snippets available in editor

note

The title is the triggering text for YepCode to autocomplete the script

Integration

New integration from credential
const pineconeClient = await yepcode.integration.pinecone('credential-slug')
New integration from plain authentication data
const { PineconeClient } = require("@pinecone-database/pinecone");

const pineconeClient = new PineconeClient();

await pineconeClient.init({
environment: "YOUR_ENVIRONMENT",
apiKey: "YOUR_API_KEY",
});

Create Index

Creates an index
await pineconeClient.createIndex({
createRequest: {
name: "example-index",
dimension: 1024,
},
});

List Indexes

Lists all indexes in your project
const indexesList = await pineconeClient.listIndexes();

Construct an Index Object

Construct an index objet with an existing index name
const index = await pineconeClient.Index("example-index");

Describe Index

Logs information about an index in your project
const indexDescription = await pineconeClient.describeIndex({
indexName: "example-index",
});

Delete Index

Deletes an index
await pineconeClient.deleteIndex({
indexName: "example-index",
});

Scale Replicas

Sets the number of replicas and pod type for an index
await pineconeClient.configureIndex({
indexName: "example-index",
patchRequest: {
replicas: 2,
podType: "p2",
},
});

Upsert Vectors

Upserts vector to an index
const index = pineconeClient.Index("example-index");
const upsertRequest = {
vectors: [
{
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
metadata: {
genre: "drama",
},
},
{
id: "vec2",
values: [0.2, 0.3, 0.4, 0.5],
metadata: {
genre: "action",
},
},
],
namespace: "example-namespace",
};
const upsertResponse = await index.upsert({ upsertRequest });

Query and Index

Queries an index filtering
await pineconeClient.configureIndex({
indexName: "example-index",
patchRequest: {
replicas: 2,
podType: "p2",
},
});

Update Vectors

Updates a vector
const index = pineconeClient.Index("example-index");
const updateRequest = {
id: "vec1",
values: [0.1, 0.2, 0.3, 0.4],
setMetadata: { genre: "drama" },
namespace: "example-namespace",
};
const updateResponse = await index.update({ updateRequest });

Delete Vectors

Deletes a vector
aconst index = pineconeClient.Index("example-index");
await index.delete1({
ids: ["vec1", "vec2"],
namespace: "example-namespace",
});

Create Collection

Creates a collection from an index
const createCollectionRequest = {
name: "example-collection",
source: "example-index",
};

await pineconeClient.createCollection({
createCollectionRequest,
});

List Collections

List the collections in your current project
const collectionsList = await pineconeClient.listCollections();

Describe Collection

Returns a description of one collection
const collectionDescription = await pineconeClient.describeCollection({
collectionName: "example-collection",
});

Delete Collection

Deletes a collection
await pineconeClient.deleteCollection({
collectionName: "example-collection",
});